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) {
|
exports.eval = function(code, options) {
|
||||||
var g, js, sandbox;
|
var g, js, sandbox, _i, _len, _ref2;
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,9 @@
|
||||||
exports: {}
|
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[g] = global[g];
|
||||||
}
|
}
|
||||||
sandbox.global = sandbox;
|
sandbox.global = sandbox;
|
||||||
|
|
|
@ -16,14 +16,16 @@
|
||||||
};
|
};
|
||||||
backlog = '';
|
backlog = '';
|
||||||
run = (function() {
|
run = (function() {
|
||||||
var g, sandbox;
|
var g, sandbox, _i, _len, _ref;
|
||||||
sandbox = {
|
sandbox = {
|
||||||
require: require,
|
require: require,
|
||||||
module: {
|
module: {
|
||||||
exports: {}
|
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[g] = global[g];
|
||||||
}
|
}
|
||||||
sandbox.global = sandbox;
|
sandbox.global = sandbox;
|
||||||
|
|
|
@ -82,7 +82,7 @@ exports.eval = (code, options = {}) ->
|
||||||
sandbox =
|
sandbox =
|
||||||
require: require
|
require: require
|
||||||
module : { exports: {} }
|
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 = sandbox
|
||||||
sandbox.global.global = sandbox.global.root = sandbox.global.GLOBAL = sandbox
|
sandbox.global.global = sandbox.global.root = sandbox.global.GLOBAL = sandbox
|
||||||
sandbox.__filename = options.filename || 'eval'
|
sandbox.__filename = options.filename || 'eval'
|
||||||
|
|
|
@ -35,7 +35,7 @@ run = do ->
|
||||||
sandbox =
|
sandbox =
|
||||||
require: require
|
require: require
|
||||||
module : { exports: {} }
|
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 = sandbox
|
||||||
sandbox.global.global = sandbox.global.root = sandbox.global.GLOBAL = sandbox
|
sandbox.global.global = sandbox.global.root = sandbox.global.GLOBAL = sandbox
|
||||||
(buffer) ->
|
(buffer) ->
|
||||||
|
|
Loading…
Add table
Reference in a new issue