[Webkit-unassigned] [Bug 163208] New: [ES6]. Implement Annex B.3.3 function hoisting rules for eval

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 10 07:08:26 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=163208

            Bug ID: 163208
           Summary: [ES6]. Implement Annex B.3.3 function hoisting rules
                    for eval
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: gskachkov at gmail.com

Implement Annex B.3.3 function hoisting rules for eval.
Link to the spec https://tc39.github.io/ecma262/#sec-web-compat-evaldeclarationinstantiation

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.
////////////////

-- 
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/20161010/55474da4/attachment.html>


More information about the webkit-unassigned mailing list