[Webkit-unassigned] [Bug 163208] [ES6]. Implement Annex B.3.3 function hoisting rules for eval
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Apr 1 12:52:21 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=163208
--- Comment #62 from GSkachkov <gskachkov at gmail.com> ---
(In reply to Saam Barati from comment #61)
> Comment on attachment 304941 [details]
> Patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=304941&action=review
>
> > Source/JavaScriptCore/interpreter/Interpreter.cpp:1095
> > + int numTopLevelFunctionDecls = eval->numTopLevelFunctionDecls();
> > + unsigned numCodeBlockFunctionDecls = eval->numCodeBlockFunctionDecls();
>
> These names are not better IMO.
>
> I still don't understand what the difference here is. Can you explain this
> to me with an example?
As I remember spec, top level function in eval might lead to error of redeclaration.
```
function bar() {
{
let f = 20;
let value = 10;
eval("function f() { value = 20; }; f();");
print(value);
}
}
bar(); // SyntaxError: Can't create duplicate variable in eval: 'f'
```
but function declared in code block not lead to error
```
function baz() {
{
let f = 20;
let value = 10;
eval("{ function f() { value = 20; }; f();}");
print(value);
}
}
baz(); // 20
```
So we need to differentiate them.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170401/50ec27e2/attachment.html>
More information about the webkit-unassigned
mailing list