njs icon indicating copy to clipboard operation
njs copied to clipboard

eval() support (strict only mode).

Open xeioex opened this issue 6 years ago • 1 comments

xeioex avatar Aug 26 '19 07:08 xeioex

the main problem there will be indirect calls:

$ node --use-strict
> .editor
// Entering editor mode (^D to finish, ^C to cancel)
var x = 'global';
var gthis = this;
var scope = function() {
    var x = 'local';
    eval('console.log(1, x)');
    eval('var x; console.log(2, x)');
    (null,eval)('console.log(3, x)');
    var y = eval;
    y('console.log(4, x)');
    gthis.eval('console.log(5, x)');
    eval.call(null, 'console.log(6, x)');
    eval.bind()('console.log(7, x)');
};
scope();

1 'local'
2 undefined
3 'global'
4 'global'
5 'global'
6 'global'
7 'global'
undefined

drsm avatar Aug 26 '19 09:08 drsm