<html>
<head>
<base href="https://bugs.webkit.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6]. Implement Annex B.3.3 function hoisting rules for eval"
href="https://bugs.webkit.org/show_bug.cgi?id=163208#c64">Comment # 64</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6]. Implement Annex B.3.3 function hoisting rules for eval"
href="https://bugs.webkit.org/show_bug.cgi?id=163208">bug 163208</a>
from <span class="vcard"><a class="email" href="mailto:sbarati@apple.com" title="Saam Barati <sbarati@apple.com>"> <span class="fn">Saam Barati</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=304941&action=diff" name="attach_304941" title="Patch">attachment 304941</a> <a href="attachment.cgi?id=304941&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=304941&action=review">https://bugs.webkit.org/attachment.cgi?id=304941&action=review</a>
<span class="quote">> Source/JavaScriptCore/interpreter/Interpreter.cpp:1094
> + int numTopLevelFunctionDecls = eval->numTopLevelFunctionDecls();</span >
I know this is how the code was before, but let's make this function return an unsigned integer. It's dumb that this is a signed int.
<span class="quote">>>> Source/JavaScriptCore/interpreter/Interpreter.cpp:1095
>>> + 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.</span >
Ok. I understand what's going on now.
I like the name top level function. For the "CodeBlockFunctions", I'll propose a different name: "functionHoistingCandidates" or something similar.
This is more in line with our terminology elsewhere.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>