Skip to content

Level detection incorrect for named function expressions #8

@getify

Description

@getify
function foo() {
	var y = 3;
	var w = function baz(){
		var p = 2;
	};
}

In that code, the identifier baz should be in the same scope as var p (aka, level 2), since identifiers of named function expressions are always in their own function's scope (and read-only), not in the containing scope.

However, I tried this on the demo page (http://mazurov.github.io/eslevels-demo/) and it's incorrectly identifying it in the outer scope (level 1), the same as var y.

screen shot 2017-11-29 at 8 44 31 am

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions