shift-scope
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -68,3 +68,3 @@ "use strict"; | ||
DeclarationType.CLASS_DECLARATION = new BlockScopedDeclaration("ClassDeclaration"); | ||
DeclarationType.CLASS_NAME = new BlockScopedDeclaration("ClassExpressionName"); | ||
DeclarationType.CLASS_NAME = new BlockScopedDeclaration("ClassName"); | ||
DeclarationType.PARAMETER = new FunctionScopedDeclaration("Parameter"); | ||
@@ -71,0 +71,0 @@ DeclarationType.CATCH_PARAMETER = new BlockScopedDeclaration("CatchParam"); |
@@ -110,2 +110,5 @@ "use strict"; | ||
value: function reduceBindingIdentifier(node) { | ||
if (node.name == "*default*") { | ||
return new _scopeState2.default(); | ||
} | ||
return new _scopeState2.default({ bindingsForParent: [node] }); | ||
@@ -167,3 +170,4 @@ } | ||
return _get(Object.getPrototypeOf(ScopeAnalyzer.prototype), "reduceClassDeclaration", this).call(this, node, { name: name.addDeclarations(_declaration.DeclarationType.CLASS_DECLARATION), super: _super, elements: elements }); | ||
var s = _get(Object.getPrototypeOf(ScopeAnalyzer.prototype), "reduceClassDeclaration", this).call(this, node, { name: name, super: _super, elements: elements }).addDeclarations(_declaration.DeclarationType.CLASS_NAME).finish(node, _scope.ScopeType.CLASS_NAME); | ||
return s.concat(name.addDeclarations(_declaration.DeclarationType.CLASS_DECLARATION)); | ||
} | ||
@@ -170,0 +174,0 @@ }, { |
@@ -63,6 +63,7 @@ "use strict"; | ||
Assuming that the given node is defined in the scope, the map always returns at least one Variable. | ||
It will return two in precisely two cases: | ||
`try{}catch(e){var e = ...}`, and function declarations in blocks for which annex B.3.3 applies. | ||
In this case the same identifier refers to two variables, one var-scoped and one block-scoped. | ||
Both are returned, with the block-scoped variable being returned first. */ | ||
It will return two in precisely three cases: | ||
`try{}catch(e){var e = ...}`, function declarations in blocks for which annex B.3.3 applies, and class declarations. | ||
In this case the same identifier refers to two variables. | ||
Both are returned, with the block-scoped variable being returned first in the first two cases, and the inner variable | ||
being returned first in the third case. */ | ||
return this.variableMap.get(node); | ||
@@ -69,0 +70,0 @@ } |
@@ -147,2 +147,5 @@ "use strict"; | ||
value: function addFunctionDeclaration() { | ||
if (this.bindingsForParent.length == 0) { | ||
return this; // i.e., this function declaration is `export default function () {...}` | ||
} | ||
var binding = this.bindingsForParent[0]; | ||
@@ -255,2 +258,3 @@ var s = new ScopeState(this); | ||
case _scope.ScopeType.FUNCTION_NAME: | ||
case _scope.ScopeType.CLASS_NAME: | ||
case _scope.ScopeType.PARAMETER_EXPRESSION: | ||
@@ -257,0 +261,0 @@ // resolve references to only block-scoped free declarations |
{ | ||
"name": "shift-scope", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "produce a scope tree for Shift format ASTs", | ||
@@ -5,0 +5,0 @@ "author": "Shape Security Labs", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
122902
1439
0