Skip to content

Block-level functions and web extensions #73

Open
@jrvidal

Description

@jrvidal

Context: http://stackoverflow.com/questions/31419897/what-are-the-precise-semantics-of-block-level-functions-in-es6

I'm not well versed with the ES6 spec details, but from my understanding, there is some optional behavior for block-level function declarations that escope does not take into account.

In the following code:

// ES6

function foo() {

    {
        function bar() {};
    }

    bar(1);
}

the call to bar would not throw a ReferenceError if the web compatibility semantics extension is in effect.

The escope output for this code with {ecmaVersion: 6} does not link the bar reference with the bar declaration at all. Maybe an additional webExtensions flag for escope.analyze is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions