WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
167328
strict mode eval doesn't initialize functions with the proper scope
https://bugs.webkit.org/show_bug.cgi?id=167328
Summary
strict mode eval doesn't initialize functions with the proper scope
Saam Barati
Reported
2017-01-23 15:10:12 PST
They don't have access to the eval's lexical variables at the top level. For example, this doesn't work: eval("'use strict'; let x = 20; function foo() { return x; }; foo();") But these do: eval("'use strict'; let x = 20; let foo = function() { return x; }; foo();") eval("'use strict'; let x = 20; let y; { function foo() { return x; }; y =foo;} y();")
Attachments
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2017-01-23 15:18:57 PST
*** This bug has been marked as a duplicate of
bug 163208
***
Saam Barati
Comment 2
2017-01-25 11:20:03 PST
This isn't a duplicate.
Saam Barati
Comment 3
2017-01-25 12:06:58 PST
I think we should simplify how we do variables in strict mode eval. Currently, we rely on Interpreter::execute(Eval) to create a StrictEvalActivation that contains the "function" and "var" variables in it. However, I think this is probably unnecessary. I think we can do all of this in bytecode and just create a normal JSLexicalEnvironment for the "var" variables and "function" variables inside the bytecode generator (as long as we're in strict mode). If we're in sloppy mode, we should continue to do what we do now. Anybody have thoughts on this? Am I missing something that would make this not Just Work?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug