shift-parser
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -104,2 +104,5 @@ /** | ||
this.superPropertyExpressions = []; | ||
// YieldExpression and YieldGeneratorExpression nodes; cleared at function boundaries | ||
this.yieldExpressions = []; | ||
} | ||
@@ -392,2 +395,14 @@ | ||
}, { | ||
key: "observeYieldExpression", | ||
value: function observeYieldExpression(node) { | ||
this.yieldExpressions.push(node); | ||
return this; | ||
} | ||
}, { | ||
key: "clearYieldExpressions", | ||
value: function clearYieldExpressions() { | ||
this.yieldExpressions = []; | ||
return this; | ||
} | ||
}, { | ||
key: "addError", | ||
@@ -437,2 +452,3 @@ value: function addError(e) { | ||
[].push.apply(this.superPropertyExpressions, s.superPropertyExpressions); | ||
[].push.apply(this.yieldExpressions, s.yieldExpressions); | ||
return this; | ||
@@ -439,0 +455,0 @@ } |
@@ -187,3 +187,10 @@ /** | ||
} | ||
body.yieldExpressions.forEach(function (node) { | ||
body = body.addError(new _earlyErrorState.EarlyError(node, "Concise arrow bodies must not contain yield expressions")); | ||
}); | ||
params.yieldExpressions.forEach(function (node) { | ||
params = params.addError(new _earlyErrorState.EarlyError(node, "Arrow parameters must not contain yield expressions")); | ||
}); | ||
var s = _get(Object.getPrototypeOf(EarlyErrorChecker.prototype), "reduceArrowExpression", this).call(this, node, { params: params, body: body }); | ||
s = s.clearYieldExpressions(); | ||
s = s.observeVarBoundary(); | ||
@@ -199,3 +206,4 @@ return s; | ||
} | ||
return s.bindName(node.name, node); | ||
s = s.bindName(node.name, node); | ||
return s; | ||
} | ||
@@ -462,2 +470,3 @@ }, { | ||
s = s.clearUsedLabelNames(); | ||
s = s.clearYieldExpressions(); | ||
if (isStrictFunctionBody(node)) { | ||
@@ -491,2 +500,7 @@ s = s.enforceStrictErrors(); | ||
params = params.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR); | ||
if (node.isGenerator) { | ||
params.yieldExpressions.forEach(function (node) { | ||
params = params.addError(new _earlyErrorState.EarlyError(node, "Generator parameters must not contain yield expressions")); | ||
}); | ||
} | ||
params = params.clearNewTargetExpressions(); | ||
@@ -499,2 +513,3 @@ body = body.clearNewTargetExpressions(); | ||
var s = _get(Object.getPrototypeOf(EarlyErrorChecker.prototype), "reduceFunctionDeclaration", this).call(this, node, { name: name, params: params, body: body }); | ||
s = s.clearYieldExpressions(); | ||
s = s.observeFunctionDeclaration(); | ||
@@ -526,2 +541,7 @@ return s; | ||
params = params.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR); | ||
if (node.isGenerator) { | ||
params.yieldExpressions.forEach(function (node) { | ||
params = params.addError(new _earlyErrorState.EarlyError(node, "Generator parameters must not contain yield expressions")); | ||
}); | ||
} | ||
params = params.clearNewTargetExpressions(); | ||
@@ -535,2 +555,3 @@ body = body.clearNewTargetExpressions(); | ||
s = s.clearBoundNames(); | ||
s = s.clearYieldExpressions(); | ||
s = s.observeVarBoundary(); | ||
@@ -646,2 +667,7 @@ return s; | ||
} | ||
if (node.isGenerator) { | ||
params.yieldExpressions.forEach(function (node) { | ||
params = params.addError(new _earlyErrorState.EarlyError(node, "Generator parameters must not contain yield expressions")); | ||
}); | ||
} | ||
body = body.clearSuperPropertyExpressions(); | ||
@@ -656,2 +682,3 @@ params = params.clearSuperPropertyExpressions(); | ||
var s = _get(Object.getPrototypeOf(EarlyErrorChecker.prototype), "reduceMethod", this).call(this, node, { name: name, params: params, body: body }); | ||
s = s.clearYieldExpressions(); | ||
s = s.observeVarBoundary(); | ||
@@ -867,2 +894,16 @@ return s; | ||
} | ||
}, { | ||
key: "reduceYieldExpression", | ||
value: function reduceYieldExpression(node) { | ||
var s = _get(Object.getPrototypeOf(EarlyErrorChecker.prototype), "reduceYieldExpression", this).apply(this, arguments); | ||
s = s.observeYieldExpression(node); | ||
return s; | ||
} | ||
}, { | ||
key: "reduceYieldGeneratorExpression", | ||
value: function reduceYieldGeneratorExpression(node) { | ||
var s = _get(Object.getPrototypeOf(EarlyErrorChecker.prototype), "reduceYieldGeneratorExpression", this).apply(this, arguments); | ||
s = s.observeYieldExpression(node); | ||
return s; | ||
} | ||
}], [{ | ||
@@ -869,0 +910,0 @@ key: "check", |
{ | ||
"name": "shift-parser", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "ECMAScript parser that produces a Shift format AST", | ||
@@ -18,3 +18,3 @@ "author": "Shape Security Labs", | ||
"build": "babel --auxiliary-comment-before 'istanbul ignore next' --modules commonStrict --source-maps-inline --out-dir dist src", | ||
"prepublish": "npm update && npm run build", | ||
"prepublish": "rm -rf dist && npm update && npm run build", | ||
"watch": "babel --auxiliary-comment-before 'istanbul ignore next' --modules commonStrict --source-maps-inline --out-dir dist src --watch", | ||
@@ -21,0 +21,0 @@ "benchmark": "node benchmark", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
231794
5399
21802