diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js index c131e162..7c86ad8c 100644 --- a/lib/coffee-script/repl.js +++ b/lib/coffee-script/repl.js @@ -41,7 +41,7 @@ }; completeAttribute = function(text) { - var all, completions, match, obj, prefix, val; + var all, completions, key, match, obj, prefix, val; if (match = text.match(ACCESSOR)) { all = match[0], obj = match[1], prefix = match[2]; try { @@ -49,7 +49,14 @@ } catch (error) { return; } - completions = getCompletions(prefix, Object.getOwnPropertyNames(Object(val))); + completions = getCompletions(prefix, (function() { + var _results; + _results = []; + for (key in Object(val)) { + _results.push(key); + } + return _results; + })()); return [completions, prefix]; } }; diff --git a/src/repl.coffee b/src/repl.coffee index 756c50d9..92467e01 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -47,7 +47,7 @@ completeAttribute = (text) -> val = Script.runInThisContext obj catch error return - completions = getCompletions prefix, Object.getOwnPropertyNames Object val + completions = getCompletions prefix, (key for key of Object(val)) [completions, prefix] # Attempt to autocomplete an in-scope free variable: `one`.