cesanta / v7

Embedded JavaScript engine for C/C++
Other
1.43k stars 177 forks source link

calling `eval` indirectly does not reflect globally #563

Open kyriosli opened 8 years ago

kyriosli commented 8 years ago

We know that eval does not touch the local variable if it is called indirectly, for example:

(function(Math) { return (0,eval)("Math") })(1234)
// returns global.Math

and this did not work properly in v7.

mkmik commented 8 years ago

yeah, it's a known problem. We currently treat eval as a normal function. This issue will be fixed when we finally implement compact stack frames for function calls; for that to work we'll have to treat explicit calls to eval specially (and thus indirectly also fix this test-case). No ETA for the moment.

mkmik commented 8 years ago

BTW, @kyriosli, what is your use case ?