diff options
Diffstat (limited to 'node_modules/@babel/parser/lib/index.js')
| -rw-r--r-- | node_modules/@babel/parser/lib/index.js | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/node_modules/@babel/parser/lib/index.js b/node_modules/@babel/parser/lib/index.js index bcf69004..68ee00ca 100644 --- a/node_modules/@babel/parser/lib/index.js +++ b/node_modules/@babel/parser/lib/index.js @@ -3488,11 +3488,6 @@ function newAsyncArrowScope() { function newExpressionScope() { return new ExpressionScope(); } -const PARAM = 0b0000, - PARAM_YIELD = 0b0001, - PARAM_AWAIT = 0b0010, - PARAM_RETURN = 0b0100, - PARAM_IN = 0b1000; class ProductionParameterHandler { constructor() { this.stacks = []; @@ -3507,20 +3502,20 @@ class ProductionParameterHandler { return this.stacks[this.stacks.length - 1]; } get hasAwait() { - return (this.currentFlags() & PARAM_AWAIT) > 0; + return (this.currentFlags() & 2) > 0; } get hasYield() { - return (this.currentFlags() & PARAM_YIELD) > 0; + return (this.currentFlags() & 1) > 0; } get hasReturn() { - return (this.currentFlags() & PARAM_RETURN) > 0; + return (this.currentFlags() & 4) > 0; } get hasIn() { - return (this.currentFlags() & PARAM_IN) > 0; + return (this.currentFlags() & 8) > 0; } } function functionFlags(isAsync, isGenerator) { - return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0); + return (isAsync ? 2 : 0) | (isGenerator ? 1 : 0); } class UtilParser extends Tokenizer { addExtra(node, key, value, enumerable = true) { @@ -3717,9 +3712,9 @@ class UtilParser extends Tokenizer { }; } enterInitialScopes() { - let paramFlags = PARAM; + let paramFlags = 0; if (this.inModule) { - paramFlags |= PARAM_AWAIT; + paramFlags |= 2; } this.scope.enter(1); this.prodParam.enter(paramFlags); @@ -8762,7 +8757,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { node.body = inner; } else { this.scope.enter(256); - this.prodParam.enter(PARAM); + this.prodParam.enter(0); node.body = this.tsParseModuleBlock(); this.prodParam.exit(); this.scope.exit(); @@ -8780,7 +8775,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { } if (this.match(5)) { this.scope.enter(256); - this.prodParam.enter(PARAM); + this.prodParam.enter(0); node.body = this.tsParseModuleBlock(); this.prodParam.exit(); this.scope.exit(); @@ -8907,7 +8902,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { case "global": if (this.match(5)) { this.scope.enter(256); - this.prodParam.enter(PARAM); + this.prodParam.enter(0); const mod = node; mod.global = true; mod.id = expr; @@ -11338,7 +11333,7 @@ class ExpressionParser extends LValParser { const oldLabels = this.state.labels; this.state.labels = []; if (isAsync) { - this.prodParam.enter(PARAM_AWAIT); + this.prodParam.enter(2); node.body = this.parseBlock(); this.prodParam.exit(); } else { @@ -11902,7 +11897,7 @@ class ExpressionParser extends LValParser { this.scope.enter(2 | 4); let flags = functionFlags(isAsync, false); if (!this.match(5) && this.prodParam.hasIn) { - flags |= PARAM_IN; + flags |= 8; } this.prodParam.enter(flags); this.initFunction(node, isAsync); @@ -11936,7 +11931,7 @@ class ExpressionParser extends LValParser { const oldStrict = this.state.strict; const oldLabels = this.state.labels; this.state.labels = []; - this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN); + this.prodParam.enter(this.prodParam.currentFlags() | 4); node.body = this.parseBlock(true, false, hasStrictModeDirective => { const nonSimple = !this.isSimpleParamList(node.params); if (hasStrictModeDirective && nonSimple) { @@ -12277,9 +12272,9 @@ class ExpressionParser extends LValParser { } allowInAnd(callback) { const flags = this.prodParam.currentFlags(); - const prodParamToSet = PARAM_IN & ~flags; + const prodParamToSet = 8 & ~flags; if (prodParamToSet) { - this.prodParam.enter(flags | PARAM_IN); + this.prodParam.enter(flags | 8); try { return callback(); } finally { @@ -12290,9 +12285,9 @@ class ExpressionParser extends LValParser { } disallowInAnd(callback) { const flags = this.prodParam.currentFlags(); - const prodParamToClear = PARAM_IN & flags; + const prodParamToClear = 8 & flags; if (prodParamToClear) { - this.prodParam.enter(flags & ~PARAM_IN); + this.prodParam.enter(flags & ~8); try { return callback(); } finally { @@ -13207,7 +13202,7 @@ class StatementParser extends ExpressionParser { } body.push(stmt); } - afterBlockParse == null ? void 0 : afterBlockParse.call(this, hasStrictModeDirective); + afterBlockParse == null || afterBlockParse.call(this, hasStrictModeDirective); if (!oldStrict) { this.setStrict(false); } @@ -13583,7 +13578,7 @@ class StatementParser extends ExpressionParser { this.scope.enter(64 | 128 | 16); const oldLabels = this.state.labels; this.state.labels = []; - this.prodParam.enter(PARAM); + this.prodParam.enter(0); const body = member.body = []; this.parseBlockOrModuleBlockBody(body, undefined, false, 8); this.prodParam.exit(); @@ -13655,7 +13650,7 @@ class StatementParser extends ExpressionParser { parseInitializer(node) { this.scope.enter(64 | 16); this.expressionScope.enter(newExpressionScope()); - this.prodParam.enter(PARAM); + this.prodParam.enter(0); node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null; this.expressionScope.exit(); this.prodParam.exit(); |
