<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><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">163208</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ES6]. Implement Annex B.3.3 function hoisting rules for eval
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gskachkov@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Implement Annex B.3.3 function hoisting rules for eval.
Link to the spec <a href="https://tc39.github.io/ecma262/#sec-web-compat-evaldeclarationinstantiation">https://tc39.github.io/ecma262/#sec-web-compat-evaldeclarationinstantiation</a>
Also keep in mind that there are some case that should be covered by implementations, for instance:
'''
function foo() {
{
let f = 20;
eval(" { function f() { }; } ");
print(type f);// number
}
print(f);// undefined
}
foo();
'''
See discussion in this threadhttps://github.com/tc39/ecma262/issues/162#issuecomment-252051508
//////////////
Because:
'f' in the 2nd console.log(f) should be undefined.
Annex B.3.3.3 for EvalDeclarationInstantiation says in 1.d.2.ii: "If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for body [...]"
You can try to run this program where function f() { } is replaced with var f:
function foo() {
{
let f = 20;
eval(" { var f; } ");
console.log(f);
}
console.log(f);
}
foo();
This throws a redeclaration error, so Annex B.3.3.3 does not synthesize a var binding for the function.
////////////////</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>