<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><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> changed
<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>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Attachment #302079 Flags</td>
<td>review?
</td>
<td>review-
</td>
</tr></table>
<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#c54">Comment # 54</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=302079&action=diff" name="attach_302079" title="Patch">attachment 302079</a> <a href="attachment.cgi?id=302079&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=302079&action=review">https://bugs.webkit.org/attachment.cgi?id=302079&action=review</a>
Some comments below. Mostly looks good, but I think there might be a few bugs.
<span class="quote">> Source/JavaScriptCore/ChangeLog:18
> + we do not bind. In simple patch should lead to following
> + behavior:</span >
"In simple patch should lead to following behavior" => "This patch leads to the following behavior"
<span class="quote">> Source/JavaScriptCore/ChangeLog:29
> + boo();</span >
foo
<span class="quote">> Source/JavaScriptCore/ChangeLog:51
> + </span >
you need a call here to match the other ones. Or you can just remove the calls from your example, I think it's clear what you mean without them.
<span class="quote">> Source/JavaScriptCore/ChangeLog:59
> + function bas() {
> + {
> + let boo = 10;
> + eval(' { function boo() {} } ');
> + print(boo); // 10
> + }
> + print(boo); //Reference Error
> + }</span >
Can you open a bug to fix this issue:
(This exists both for eval and normal function hoisting):
eval(" { let foo; {function foo(){} } }");
<span class="quote">> Source/JavaScriptCore/ChangeLog:72
> + or return undefined if variable can be binded there.</span >
can => can't
<span class="quote">> Source/JavaScriptCore/ChangeLog:75
> + that is not covered by this path, and will be fixed in </span >
Typo: path => patch
<span class="quote">> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:767
> + for (FunctionMetadataNode* function : evalNode->functionStack())
> + m_codeBlock->addFunctionDecl(makeFunction(function));</span >
Doesn't this still cause us to unconditionally create the binding?
<span class="quote">> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:770
> + // unsigned numVariables = varDeclarations.size();</span >
Please remove.
<span class="quote">> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:779
> + if (!entry.value.isFunction())
> + variables.append(Identifier::fromUid(m_vm, entry.key.get()));
> + else
> + hoistedFunctions.append(Identifier::fromUid(m_vm, entry.key.get()));</span >
This looks wrong to me and looks like it'd cause weird behavior for strict mode. I think you want to check if it's a hoisting candidate instead.
<span class="quote">> Source/JavaScriptCore/interpreter/Interpreter.cpp:1076
> + if ((numVariables || numFunctions || numHoistedFunctions) && eval->isStrictMode()) {</span >
I don't think you want this number to be > 0 in strict mode.
<span class="quote">> Source/JavaScriptCore/runtime/CommonSlowPaths.cpp:827
> +SLOW_PATH_DECL(slow_path_is_var_scope)</span >
Please remove.
<span class="quote">> Source/JavaScriptCore/runtime/JSScope.cpp:220
> +ALWAYS_INLINE JSObject* JSScope::resolve(ExecState* exec, JSScope* scope, const Identifier& ident, FinishResolveEarlierFunctor predicate, bool doNotCountWithScope)</span >
Nit: I'd just make doNoutCountWithScope a templatized variable.</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>