mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
fixes #1390: persistence of non-enumerable global properties in the REPL
This commit is contained in:
parent
bbf1c6a8df
commit
454aa8433b
4 changed files with 10 additions and 6 deletions
|
@ -60,7 +60,7 @@
|
|||
}
|
||||
};
|
||||
exports.eval = function(code, options) {
|
||||
var g, js, sandbox;
|
||||
var g, js, sandbox, _i, _len, _ref2;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
|
@ -72,7 +72,9 @@
|
|||
exports: {}
|
||||
}
|
||||
};
|
||||
for (g in global) {
|
||||
_ref2 = Object.getOwnPropertyNames(global);
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
g = _ref2[_i];
|
||||
sandbox[g] = global[g];
|
||||
}
|
||||
sandbox.global = sandbox;
|
||||
|
|
|
@ -16,14 +16,16 @@
|
|||
};
|
||||
backlog = '';
|
||||
run = (function() {
|
||||
var g, sandbox;
|
||||
var g, sandbox, _i, _len, _ref;
|
||||
sandbox = {
|
||||
require: require,
|
||||
module: {
|
||||
exports: {}
|
||||
}
|
||||
};
|
||||
for (g in global) {
|
||||
_ref = Object.getOwnPropertyNames(global);
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
g = _ref[_i];
|
||||
sandbox[g] = global[g];
|
||||
}
|
||||
sandbox.global = sandbox;
|
||||
|
|
|
@ -82,7 +82,7 @@ exports.eval = (code, options = {}) ->
|
|||
sandbox =
|
||||
require: require
|
||||
module : { exports: {} }
|
||||
sandbox[g] = global[g] for g of global
|
||||
sandbox[g] = global[g] for g in Object.getOwnPropertyNames global
|
||||
sandbox.global = sandbox
|
||||
sandbox.global.global = sandbox.global.root = sandbox.global.GLOBAL = sandbox
|
||||
sandbox.__filename = options.filename || 'eval'
|
||||
|
|
|
@ -35,7 +35,7 @@ run = do ->
|
|||
sandbox =
|
||||
require: require
|
||||
module : { exports: {} }
|
||||
sandbox[g] = global[g] for g of global
|
||||
sandbox[g] = global[g] for g in Object.getOwnPropertyNames global
|
||||
sandbox.global = sandbox
|
||||
sandbox.global.global = sandbox.global.root = sandbox.global.GLOBAL = sandbox
|
||||
(buffer) ->
|
||||
|
|
Loading…
Add table
Reference in a new issue