Updating NPM dependencies
This commit is contained in:
4
node_modules/@babel/parser/CHANGELOG.md
generated
vendored
4
node_modules/@babel/parser/CHANGELOG.md
generated
vendored
@@ -9,11 +9,11 @@
|
||||
> - :house: [Internal]
|
||||
> - :nail_care: [Polish]
|
||||
|
||||
> Semver Policy: https://github.com/babel/babel/tree/master/packages/babel-parser#semver
|
||||
> Semver Policy: https://github.com/babel/babel/tree/main/packages/babel-parser#semver
|
||||
|
||||
_Note: Gaps between patch versions are faulty, broken or test releases._
|
||||
|
||||
See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) for the pre-6.8.0 version Changelog.
|
||||
See the [Babel Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) for the pre-6.8.0 version Changelog.
|
||||
|
||||
## 6.17.1 (2017-05-10)
|
||||
|
||||
|
||||
2
node_modules/@babel/parser/README.md
generated
vendored
2
node_modules/@babel/parser/README.md
generated
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
> A JavaScript parser
|
||||
|
||||
See our website [@babel/parser](https://babeljs.io/docs/en/next/babel-parser.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A+parser+%28babylon%29%22+is%3Aopen) associated with this package.
|
||||
See our website [@babel/parser](https://babeljs.io/docs/en/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%20(babylon)%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
9005
node_modules/@babel/parser/lib/index.js
generated
vendored
9005
node_modules/@babel/parser/lib/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/@babel/parser/lib/index.js.map
generated
vendored
2
node_modules/@babel/parser/lib/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
0
node_modules/@babel/parser/lib/options.js
generated
vendored
Executable file → Normal file
0
node_modules/@babel/parser/lib/options.js
generated
vendored
Executable file → Normal file
9
node_modules/@babel/parser/lib/parser/comments.js
generated
vendored
9
node_modules/@babel/parser/lib/parser/comments.js
generated
vendored
@@ -186,7 +186,14 @@ class CommentsParser extends _base.default {
|
||||
if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
|
||||
node.innerComments = trailingComments;
|
||||
} else {
|
||||
node.trailingComments = trailingComments;
|
||||
const firstTrailingCommentIndex = trailingComments.findIndex(comment => comment.end >= node.end);
|
||||
|
||||
if (firstTrailingCommentIndex > 0) {
|
||||
node.innerComments = trailingComments.slice(0, firstTrailingCommentIndex);
|
||||
node.trailingComments = trailingComments.slice(firstTrailingCommentIndex);
|
||||
} else {
|
||||
node.trailingComments = trailingComments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
154
node_modules/@babel/parser/lib/parser/error-message.js
generated
vendored
Normal file
154
node_modules/@babel/parser/lib/parser/error-message.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ErrorMessages = void 0;
|
||||
const ErrorMessages = Object.freeze({
|
||||
AccessorIsGenerator: "A %0ter cannot be a generator",
|
||||
ArgumentsInClass: "'arguments' is only allowed in functions and class methods",
|
||||
AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block",
|
||||
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function",
|
||||
AwaitExpressionFormalParameter: "await is not allowed in async function parameters",
|
||||
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules",
|
||||
AwaitNotInAsyncFunction: "'await' is only allowed within async functions",
|
||||
BadGetterArity: "getter must not have any formal parameters",
|
||||
BadSetterArity: "setter must have exactly one formal parameter",
|
||||
BadSetterRestParameter: "setter function argument must not be a rest parameter",
|
||||
ConstructorClassField: "Classes may not have a field named 'constructor'",
|
||||
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'",
|
||||
ConstructorIsAccessor: "Class constructor may not be an accessor",
|
||||
ConstructorIsAsync: "Constructor can't be an async function",
|
||||
ConstructorIsGenerator: "Constructor can't be a generator",
|
||||
DeclarationMissingInitializer: "%0 require an initialization value",
|
||||
DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax",
|
||||
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
||||
DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.",
|
||||
DecoratorSemicolon: "Decorators must not be followed by a semicolon",
|
||||
DecoratorStaticBlock: "Decorators can't be used with a static block",
|
||||
DeletePrivateField: "Deleting a private field is not allowed",
|
||||
DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
|
||||
DuplicateConstructor: "Duplicate constructor in the same class",
|
||||
DuplicateDefaultExport: "Only one default export allowed per module.",
|
||||
DuplicateExport: "`%0` has already been exported. Exported identifiers must be unique.",
|
||||
DuplicateProto: "Redefinition of __proto__ property",
|
||||
DuplicateRegExpFlags: "Duplicate regular expression flag",
|
||||
DuplicateStaticBlock: "Duplicate static block in the same class",
|
||||
ElementAfterRest: "Rest element must be last element",
|
||||
EscapedCharNotAnIdentifier: "Invalid Unicode escape",
|
||||
ExportBindingIsString: "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { %0 as '%1' } from 'some-module'`?",
|
||||
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'",
|
||||
ForInOfLoopInitializer: "%0 loop variable declaration may not have an initializer",
|
||||
GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block",
|
||||
IllegalBreakContinue: "Unsyntactic %0",
|
||||
IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list",
|
||||
IllegalReturn: "'return' outside of function",
|
||||
ImportBindingIsString: 'A string literal cannot be used as an imported binding.\n- Did you mean `import { "%0" as foo }`?',
|
||||
ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments",
|
||||
ImportCallArity: "import() requires exactly %0",
|
||||
ImportCallNotNewExpression: "Cannot use new with import(...)",
|
||||
ImportCallSpreadArgument: "... is not allowed in import()",
|
||||
ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`,
|
||||
ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: "module"'`,
|
||||
InvalidBigIntLiteral: "Invalid BigIntLiteral",
|
||||
InvalidCodePoint: "Code point out of bounds",
|
||||
InvalidDecimal: "Invalid decimal",
|
||||
InvalidDigit: "Expected number in radix %0",
|
||||
InvalidEscapeSequence: "Bad character escape sequence",
|
||||
InvalidEscapeSequenceTemplate: "Invalid escape sequence in template",
|
||||
InvalidEscapedReservedWord: "Escape sequence in keyword %0",
|
||||
InvalidIdentifier: "Invalid identifier %0",
|
||||
InvalidLhs: "Invalid left-hand side in %0",
|
||||
InvalidLhsBinding: "Binding invalid left-hand side in %0",
|
||||
InvalidNumber: "Invalid number",
|
||||
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'",
|
||||
InvalidOrUnexpectedToken: "Unexpected character '%0'",
|
||||
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern",
|
||||
InvalidPrivateFieldResolution: "Private name #%0 is not defined",
|
||||
InvalidPropertyBindingPattern: "Binding member expression",
|
||||
InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions",
|
||||
InvalidRestAssignmentPattern: "Invalid rest operator's argument",
|
||||
LabelRedeclaration: "Label '%0' is already declared",
|
||||
LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations.",
|
||||
LineTerminatorBeforeArrow: "No line break is allowed before '=>'",
|
||||
MalformedRegExpFlags: "Invalid regular expression flag",
|
||||
MissingClassName: "A class name is required",
|
||||
MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
|
||||
MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX",
|
||||
MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators",
|
||||
ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`",
|
||||
ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values",
|
||||
ModuleAttributesWithDuplicateKeys: 'Duplicate key "%0" is not allowed in module attributes',
|
||||
ModuleExportNameHasLoneSurrogate: "An export name cannot include a lone surrogate, found '\\u%0'",
|
||||
ModuleExportUndefined: "Export '%0' is not defined",
|
||||
MultipleDefaultsInSwitch: "Multiple default clauses",
|
||||
NewlineAfterThrow: "Illegal newline after throw",
|
||||
NoCatchOrFinally: "Missing catch or finally clause",
|
||||
NumberIdentifier: "Identifier directly after number",
|
||||
NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences",
|
||||
ObsoleteAwaitStar: "await* has been removed from the async functions proposal. Use Promise.all() instead.",
|
||||
OptionalChainingNoNew: "constructors in/after an Optional Chain are not allowed",
|
||||
OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain",
|
||||
ParamDupe: "Argument name clash",
|
||||
PatternHasAccessor: "Object pattern can't contain getter or setter",
|
||||
PatternHasMethod: "Object pattern can't contain methods",
|
||||
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized',
|
||||
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression",
|
||||
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression",
|
||||
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference",
|
||||
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding",
|
||||
PrimaryTopicRequiresSmartPipeline: "Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option.",
|
||||
PrivateInExpectedIn: "Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`)",
|
||||
PrivateNameRedeclaration: "Duplicate private name #%0",
|
||||
RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
|
||||
RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
|
||||
RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'",
|
||||
RecordNoProto: "'__proto__' is not allowed in Record expressions",
|
||||
RestTrailingComma: "Unexpected trailing comma after rest element",
|
||||
SloppyFunction: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",
|
||||
StaticPrototype: "Classes may not have static property named prototype",
|
||||
StrictDelete: "Deleting local variable in strict mode",
|
||||
StrictEvalArguments: "Assigning to '%0' in strict mode",
|
||||
StrictEvalArgumentsBinding: "Binding '%0' in strict mode",
|
||||
StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block",
|
||||
StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'",
|
||||
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode",
|
||||
StrictWith: "'with' in strict mode",
|
||||
SuperNotAllowed: "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
|
||||
SuperPrivateField: "Private fields can't be accessed on super",
|
||||
TrailingDecorator: "Decorators must be attached to a class element",
|
||||
TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
|
||||
TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
|
||||
TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'",
|
||||
UnexpectedArgumentPlaceholder: "Unexpected argument placeholder",
|
||||
UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal',
|
||||
UnexpectedDigitAfterHash: "Unexpected digit after hash token",
|
||||
UnexpectedImportExport: "'import' and 'export' may only appear at the top level",
|
||||
UnexpectedKeyword: "Unexpected keyword '%0'",
|
||||
UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration",
|
||||
UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context",
|
||||
UnexpectedNewTarget: "new.target can only be used in functions",
|
||||
UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits",
|
||||
UnexpectedPrivateField: "Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).",
|
||||
UnexpectedReservedWord: "Unexpected reserved word '%0'",
|
||||
UnexpectedSuper: "super is only allowed in object methods and classes",
|
||||
UnexpectedToken: "Unexpected token '%0'",
|
||||
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
||||
UnsupportedBind: "Binding should be performed on object property.",
|
||||
UnsupportedDecoratorExport: "A decorated export must export a class declaration",
|
||||
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
||||
UnsupportedImport: "import can only be used in import() or import.meta",
|
||||
UnsupportedMetaProperty: "The only valid meta property for %0 is %0.%1",
|
||||
UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters",
|
||||
UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties",
|
||||
UnsupportedSuper: "super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop])",
|
||||
UnterminatedComment: "Unterminated comment",
|
||||
UnterminatedRegExp: "Unterminated regular expression",
|
||||
UnterminatedString: "Unterminated string constant",
|
||||
UnterminatedTemplate: "Unterminated template",
|
||||
VarRedeclaration: "Identifier '%0' has already been declared",
|
||||
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator",
|
||||
YieldInParameter: "Yield expression is not allowed in formal parameters",
|
||||
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0"
|
||||
});
|
||||
exports.ErrorMessages = ErrorMessages;
|
||||
@@ -3,38 +3,45 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Errors", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _errorMessage.ErrorMessages;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _location = require("../util/location");
|
||||
|
||||
var _comments = _interopRequireDefault(require("./comments"));
|
||||
|
||||
var _errorMessage = require("./error-message.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class LocationParser extends _comments.default {
|
||||
class ParserError extends _comments.default {
|
||||
getLocationForPosition(pos) {
|
||||
let loc;
|
||||
if (pos === this.state.start) loc = this.state.startLoc;else if (pos === this.state.lastTokStart) loc = this.state.lastTokStartLoc;else if (pos === this.state.end) loc = this.state.endLoc;else if (pos === this.state.lastTokEnd) loc = this.state.lastTokEndLoc;else loc = (0, _location.getLineInfo)(this.input, pos);
|
||||
return loc;
|
||||
}
|
||||
|
||||
raise(pos, message, {
|
||||
missingPluginNames,
|
||||
code
|
||||
} = {}) {
|
||||
raise(pos, errorTemplate, ...params) {
|
||||
return this.raiseWithData(pos, undefined, errorTemplate, ...params);
|
||||
}
|
||||
|
||||
raiseWithData(pos, data, errorTemplate, ...params) {
|
||||
const loc = this.getLocationForPosition(pos);
|
||||
message += ` (${loc.line}:${loc.column})`;
|
||||
const message = errorTemplate.replace(/%(\d+)/g, (_, i) => params[i]) + ` (${loc.line}:${loc.column})`;
|
||||
return this._raise(Object.assign({
|
||||
loc,
|
||||
pos
|
||||
}, data), message);
|
||||
}
|
||||
|
||||
_raise(errorContext, message) {
|
||||
const err = new SyntaxError(message);
|
||||
err.pos = pos;
|
||||
err.loc = loc;
|
||||
|
||||
if (missingPluginNames) {
|
||||
err.missingPlugin = missingPluginNames;
|
||||
}
|
||||
|
||||
if (code !== undefined) {
|
||||
err.code = code;
|
||||
}
|
||||
Object.assign(err, errorContext);
|
||||
|
||||
if (this.options.errorRecovery) {
|
||||
if (!this.isLookahead) this.state.errors.push(err);
|
||||
@@ -46,4 +53,4 @@ class LocationParser extends _comments.default {
|
||||
|
||||
}
|
||||
|
||||
exports.default = LocationParser;
|
||||
exports.default = ParserError;
|
||||
1014
node_modules/@babel/parser/lib/parser/expression.js
generated
vendored
1014
node_modules/@babel/parser/lib/parser/expression.js
generated
vendored
File diff suppressed because it is too large
Load Diff
17
node_modules/@babel/parser/lib/parser/index.js
generated
vendored
17
node_modules/@babel/parser/lib/parser/index.js
generated
vendored
@@ -15,6 +15,14 @@ var _scope = _interopRequireDefault(require("../util/scope"));
|
||||
|
||||
var _classScope = _interopRequireDefault(require("../util/class-scope"));
|
||||
|
||||
var _expressionScope = _interopRequireDefault(require("../util/expression-scope"));
|
||||
|
||||
var _productionParameter = _interopRequireWildcard(require("../util/production-parameter"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Parser extends _statement.default {
|
||||
@@ -25,7 +33,9 @@ class Parser extends _statement.default {
|
||||
this.options = options;
|
||||
this.inModule = this.options.sourceType === "module";
|
||||
this.scope = new ScopeHandler(this.raise.bind(this), this.inModule);
|
||||
this.prodParam = new _productionParameter.default();
|
||||
this.classScope = new _classScope.default(this.raise.bind(this));
|
||||
this.expressionScope = new _expressionScope.default(this.raise.bind(this));
|
||||
this.plugins = pluginsMap(this.options.plugins);
|
||||
this.filename = options.sourceFilename;
|
||||
}
|
||||
@@ -35,13 +45,14 @@ class Parser extends _statement.default {
|
||||
}
|
||||
|
||||
parse() {
|
||||
let scopeFlags = _scopeflags.SCOPE_PROGRAM;
|
||||
let paramFlags = _productionParameter.PARAM;
|
||||
|
||||
if (this.hasPlugin("topLevelAwait") && this.inModule) {
|
||||
scopeFlags |= _scopeflags.SCOPE_ASYNC;
|
||||
paramFlags |= _productionParameter.PARAM_AWAIT;
|
||||
}
|
||||
|
||||
this.scope.enter(scopeFlags);
|
||||
this.scope.enter(_scopeflags.SCOPE_PROGRAM);
|
||||
this.prodParam.enter(paramFlags);
|
||||
const file = this.startNode();
|
||||
const program = this.startNode();
|
||||
this.nextToken();
|
||||
|
||||
55
node_modules/@babel/parser/lib/parser/lval.js
generated
vendored
55
node_modules/@babel/parser/lib/parser/lval.js
generated
vendored
@@ -15,21 +15,21 @@ var _scopeflags = require("../util/scopeflags");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var _error = require("./error");
|
||||
|
||||
const unwrapParenthesizedExpression = node => {
|
||||
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
||||
};
|
||||
|
||||
class LValParser extends _node.NodeUtils {
|
||||
toAssignable(node) {
|
||||
var _node$extra, _node$extra3;
|
||||
|
||||
let parenthesized = undefined;
|
||||
|
||||
if (node.type === "ParenthesizedExpression" || ((_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized)) {
|
||||
if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
|
||||
parenthesized = unwrapParenthesizedExpression(node);
|
||||
|
||||
if (parenthesized.type !== "Identifier" && parenthesized.type !== "MemberExpression") {
|
||||
this.raise(node.start, "Invalid parenthesized assignment pattern");
|
||||
this.raise(node.start, _error.Errors.InvalidParenthesizedAssignment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,13 +44,11 @@ class LValParser extends _node.NodeUtils {
|
||||
node.type = "ObjectPattern";
|
||||
|
||||
for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
|
||||
var _node$extra2;
|
||||
|
||||
const prop = node.properties[i];
|
||||
const isLast = i === last;
|
||||
this.toAssignableObjectExpressionProp(prop, isLast);
|
||||
|
||||
if (isLast && prop.type === "RestElement" && ((_node$extra2 = node.extra) == null ? void 0 : _node$extra2.trailingComma)) {
|
||||
if (isLast && prop.type === "RestElement" && node.extra?.trailingComma) {
|
||||
this.raiseRestNotLast(node.extra.trailingComma);
|
||||
}
|
||||
}
|
||||
@@ -72,12 +70,12 @@ class LValParser extends _node.NodeUtils {
|
||||
|
||||
case "ArrayExpression":
|
||||
node.type = "ArrayPattern";
|
||||
this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingComma);
|
||||
this.toAssignableList(node.elements, node.extra?.trailingComma);
|
||||
break;
|
||||
|
||||
case "AssignmentExpression":
|
||||
if (node.operator !== "=") {
|
||||
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
|
||||
this.raise(node.left.end, _error.Errors.MissingEqInAssignment);
|
||||
}
|
||||
|
||||
node.type = "AssignmentPattern";
|
||||
@@ -97,7 +95,7 @@ class LValParser extends _node.NodeUtils {
|
||||
|
||||
toAssignableObjectExpressionProp(prop, isLast) {
|
||||
if (prop.type === "ObjectMethod") {
|
||||
const error = prop.kind === "get" || prop.kind === "set" ? "Object pattern can't contain getter or setter" : "Object pattern can't contain methods";
|
||||
const error = prop.kind === "get" || prop.kind === "set" ? _error.Errors.PatternHasAccessor : _error.Errors.PatternHasMethod;
|
||||
this.raise(prop.key.start, error);
|
||||
} else if (prop.type === "SpreadElement" && !isLast) {
|
||||
this.raiseRestNotLast(prop.start);
|
||||
@@ -112,9 +110,9 @@ class LValParser extends _node.NodeUtils {
|
||||
if (end) {
|
||||
const last = exprList[end - 1];
|
||||
|
||||
if (last && last.type === "RestElement") {
|
||||
if (last?.type === "RestElement") {
|
||||
--end;
|
||||
} else if (last && last.type === "SpreadElement") {
|
||||
} else if (last?.type === "SpreadElement") {
|
||||
last.type = "RestElement";
|
||||
const arg = last.argument;
|
||||
this.toAssignable(arg);
|
||||
@@ -156,7 +154,7 @@ class LValParser extends _node.NodeUtils {
|
||||
for (let _i = 0; _i < exprList.length; _i++) {
|
||||
const expr = exprList[_i];
|
||||
|
||||
if (expr && expr.type === "ArrayExpression") {
|
||||
if (expr?.type === "ArrayExpression") {
|
||||
this.toReferencedListDeep(expr.elements);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +163,7 @@ class LValParser extends _node.NodeUtils {
|
||||
parseSpread(refExpressionErrors, refNeedsArrowPos) {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
node.argument = this.parseMaybeAssign(false, refExpressionErrors, undefined, refNeedsArrowPos);
|
||||
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined, refNeedsArrowPos);
|
||||
return this.finishNode(node, "SpreadElement");
|
||||
}
|
||||
|
||||
@@ -187,7 +185,7 @@ class LValParser extends _node.NodeUtils {
|
||||
}
|
||||
|
||||
case _types.types.braceL:
|
||||
return this.parseObj(true);
|
||||
return this.parseObjectLike(_types.types.braceR, true);
|
||||
}
|
||||
|
||||
return this.parseIdentifier();
|
||||
@@ -217,7 +215,7 @@ class LValParser extends _node.NodeUtils {
|
||||
const decorators = [];
|
||||
|
||||
if (this.match(_types.types.at) && this.hasPlugin("decorators")) {
|
||||
this.raise(this.state.start, "Stage 2 decorators cannot be used to decorate parameters");
|
||||
this.raise(this.state.start, _error.Errors.UnsupportedParameterDecorator);
|
||||
}
|
||||
|
||||
while (this.match(_types.types.at)) {
|
||||
@@ -248,13 +246,13 @@ class LValParser extends _node.NodeUtils {
|
||||
}
|
||||
|
||||
parseMaybeDefault(startPos, startLoc, left) {
|
||||
startLoc = startLoc || this.state.startLoc;
|
||||
startPos = startPos || this.state.start;
|
||||
left = left || this.parseBindingAtom();
|
||||
startLoc = startLoc ?? this.state.startLoc;
|
||||
startPos = startPos ?? this.state.start;
|
||||
left = left ?? this.parseBindingAtom();
|
||||
if (!this.eat(_types.types.eq)) return left;
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.left = left;
|
||||
node.right = this.parseMaybeAssign();
|
||||
node.right = this.parseMaybeAssignAllowIn();
|
||||
return this.finishNode(node, "AssignmentPattern");
|
||||
}
|
||||
|
||||
@@ -262,21 +260,21 @@ class LValParser extends _node.NodeUtils {
|
||||
switch (expr.type) {
|
||||
case "Identifier":
|
||||
if (this.state.strict && (strictModeChanged ? (0, _identifier.isStrictBindReservedWord)(expr.name, this.inModule) : (0, _identifier.isStrictBindOnlyReservedWord)(expr.name))) {
|
||||
this.raise(expr.start, `${bindingType === _scopeflags.BIND_NONE ? "Assigning to" : "Binding"} '${expr.name}' in strict mode`);
|
||||
this.raise(expr.start, bindingType === _scopeflags.BIND_NONE ? _error.Errors.StrictEvalArguments : _error.Errors.StrictEvalArgumentsBinding, expr.name);
|
||||
}
|
||||
|
||||
if (checkClashes) {
|
||||
const key = `_${expr.name}`;
|
||||
|
||||
if (checkClashes[key]) {
|
||||
this.raise(expr.start, "Argument name clash");
|
||||
this.raise(expr.start, _error.Errors.ParamDupe);
|
||||
} else {
|
||||
checkClashes[key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (disallowLetBinding && expr.name === "let") {
|
||||
this.raise(expr.start, "'let' is not allowed to be used as a name in 'let' or 'const' declarations.");
|
||||
this.raise(expr.start, _error.Errors.LetInLexicalBinding);
|
||||
}
|
||||
|
||||
if (!(bindingType & _scopeflags.BIND_NONE)) {
|
||||
@@ -287,7 +285,7 @@ class LValParser extends _node.NodeUtils {
|
||||
|
||||
case "MemberExpression":
|
||||
if (bindingType !== _scopeflags.BIND_NONE) {
|
||||
this.raise(expr.start, "Binding member expression");
|
||||
this.raise(expr.start, _error.Errors.InvalidPropertyBindingPattern);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -326,15 +324,14 @@ class LValParser extends _node.NodeUtils {
|
||||
|
||||
default:
|
||||
{
|
||||
const message = (bindingType === _scopeflags.BIND_NONE ? "Invalid" : "Binding invalid") + " left-hand side" + (contextDescription ? " in " + contextDescription : "expression");
|
||||
this.raise(expr.start, message);
|
||||
this.raise(expr.start, bindingType === _scopeflags.BIND_NONE ? _error.Errors.InvalidLhs : _error.Errors.InvalidLhsBinding, contextDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkToRestConversion(node) {
|
||||
if (node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression") {
|
||||
this.raise(node.argument.start, "Invalid rest operator's argument");
|
||||
this.raise(node.argument.start, _error.Errors.InvalidRestAssignmentPattern);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,11 +346,11 @@ class LValParser extends _node.NodeUtils {
|
||||
}
|
||||
|
||||
raiseRestNotLast(pos) {
|
||||
throw this.raise(pos, `Rest element must be last element`);
|
||||
throw this.raise(pos, _error.Errors.ElementAfterRest);
|
||||
}
|
||||
|
||||
raiseTrailingCommaAfterRest(pos) {
|
||||
this.raise(pos, `Unexpected trailing comma after rest element`);
|
||||
this.raise(pos, _error.Errors.RestTrailingComma);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
13
node_modules/@babel/parser/lib/parser/node.js
generated
vendored
13
node_modules/@babel/parser/lib/parser/node.js
generated
vendored
@@ -13,12 +13,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
class Node {
|
||||
constructor(parser, pos, loc) {
|
||||
this.type = void 0;
|
||||
this.start = void 0;
|
||||
this.end = void 0;
|
||||
this.loc = void 0;
|
||||
this.range = void 0;
|
||||
this.leadingComments = void 0;
|
||||
this.trailingComments = void 0;
|
||||
this.innerComments = void 0;
|
||||
this.extra = void 0;
|
||||
this.type = "";
|
||||
this.start = pos;
|
||||
this.end = 0;
|
||||
this.loc = new _location.SourceLocation(loc);
|
||||
if (parser && parser.options.ranges) this.range = [pos, 0];
|
||||
if (parser && parser.filename) this.loc.filename = parser.filename;
|
||||
if (parser?.options.ranges) this.range = [pos, 0];
|
||||
if (parser?.filename) this.loc.filename = parser.filename;
|
||||
}
|
||||
|
||||
__clone() {
|
||||
|
||||
562
node_modules/@babel/parser/lib/parser/statement.js
generated
vendored
562
node_modules/@babel/parser/lib/parser/statement.js
generated
vendored
File diff suppressed because it is too large
Load Diff
66
node_modules/@babel/parser/lib/parser/util.js
generated
vendored
66
node_modules/@babel/parser/lib/parser/util.js
generated
vendored
@@ -15,9 +15,9 @@ var _whitespace = require("../util/whitespace");
|
||||
|
||||
var _identifier = require("../util/identifier");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _error = require("./error");
|
||||
|
||||
const literal = /^('|")((?:\\?.)*?)\1/;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class UtilParser extends _tokenizer.default {
|
||||
addExtra(node, key, val) {
|
||||
@@ -30,21 +30,6 @@ class UtilParser extends _tokenizer.default {
|
||||
return this.match(_types.types.relational) && this.state.value === op;
|
||||
}
|
||||
|
||||
isLookaheadRelational(op) {
|
||||
const next = this.nextTokenStart();
|
||||
|
||||
if (this.input.charAt(next) === op) {
|
||||
if (next + 1 === this.input.length) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const afterNext = this.input.charCodeAt(next + 1);
|
||||
return afterNext !== op.charCodeAt(0) && afterNext !== 61;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
expectRelational(op) {
|
||||
if (this.isRelational(op)) {
|
||||
this.next();
|
||||
@@ -111,9 +96,9 @@ class UtilParser extends _tokenizer.default {
|
||||
|
||||
expectPlugin(name, pos) {
|
||||
if (!this.hasPlugin(name)) {
|
||||
throw this.raise(pos != null ? pos : this.state.start, `This experimental syntax requires enabling the parser plugin: '${name}'`, {
|
||||
missingPluginNames: [name]
|
||||
});
|
||||
throw this.raiseWithData(pos != null ? pos : this.state.start, {
|
||||
missingPlugin: [name]
|
||||
}, `This experimental syntax requires enabling the parser plugin: '${name}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -121,41 +106,12 @@ class UtilParser extends _tokenizer.default {
|
||||
|
||||
expectOnePlugin(names, pos) {
|
||||
if (!names.some(n => this.hasPlugin(n))) {
|
||||
throw this.raise(pos != null ? pos : this.state.start, `This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(", ")}'`, {
|
||||
missingPluginNames: names
|
||||
});
|
||||
throw this.raiseWithData(pos != null ? pos : this.state.start, {
|
||||
missingPlugin: names
|
||||
}, `This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(", ")}'`);
|
||||
}
|
||||
}
|
||||
|
||||
checkYieldAwaitInDefaultParams() {
|
||||
if (this.state.yieldPos !== -1 && (this.state.awaitPos === -1 || this.state.yieldPos < this.state.awaitPos)) {
|
||||
this.raise(this.state.yieldPos, "Yield cannot be used as name inside a generator function");
|
||||
}
|
||||
|
||||
if (this.state.awaitPos !== -1) {
|
||||
this.raise(this.state.awaitPos, "Await cannot be used as name inside an async function");
|
||||
}
|
||||
}
|
||||
|
||||
strictDirective(start) {
|
||||
for (;;) {
|
||||
_whitespace.skipWhiteSpace.lastIndex = start;
|
||||
start += _whitespace.skipWhiteSpace.exec(this.input)[0].length;
|
||||
const match = literal.exec(this.input.slice(start));
|
||||
if (!match) break;
|
||||
if (match[2] === "use strict") return true;
|
||||
start += match[0].length;
|
||||
_whitespace.skipWhiteSpace.lastIndex = start;
|
||||
start += _whitespace.skipWhiteSpace.exec(this.input)[0].length;
|
||||
|
||||
if (this.input[start] === ";") {
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
tryParse(fn, oldState = this.state.clone()) {
|
||||
const abortSignal = {
|
||||
node: null
|
||||
@@ -227,10 +183,14 @@ class UtilParser extends _tokenizer.default {
|
||||
}
|
||||
|
||||
if (doubleProto >= 0) {
|
||||
this.raise(doubleProto, "Redefinition of __proto__ property");
|
||||
this.raise(doubleProto, _error.Errors.DuplicateProto);
|
||||
}
|
||||
}
|
||||
|
||||
isLiteralPropertyName() {
|
||||
return this.match(_types.types.name) || !!this.state.type.keyword || this.match(_types.types.string) || this.match(_types.types.num) || this.match(_types.types.bigint) || this.match(_types.types.decimal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = UtilParser;
|
||||
|
||||
17
node_modules/@babel/parser/lib/plugin-utils.js
generated
vendored
17
node_modules/@babel/parser/lib/plugin-utils.js
generated
vendored
@@ -49,6 +49,7 @@ function getPluginOption(plugins, name, option) {
|
||||
}
|
||||
|
||||
const PIPELINE_PROPOSALS = ["minimal", "smart", "fsharp"];
|
||||
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
||||
|
||||
function validatePlugins(plugins) {
|
||||
if (hasPlugin(plugins, "decorators")) {
|
||||
@@ -76,6 +77,22 @@ function validatePlugins(plugins) {
|
||||
if (hasPlugin(plugins, "pipelineOperator") && !PIPELINE_PROPOSALS.includes(getPluginOption(plugins, "pipelineOperator", "proposal"))) {
|
||||
throw new Error("'pipelineOperator' requires 'proposal' option whose value should be one of: " + PIPELINE_PROPOSALS.map(p => `'${p}'`).join(", "));
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "moduleAttributes")) {
|
||||
if (hasPlugin(plugins, "importAssertions")) {
|
||||
throw new Error("Cannot combine importAssertions and moduleAttributes plugins.");
|
||||
}
|
||||
|
||||
const moduleAttributesVerionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
|
||||
|
||||
if (moduleAttributesVerionPluginOption !== "may-2020") {
|
||||
throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "recordAndTuple") && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
|
||||
throw new Error("'recordAndTuple' requires 'syntaxType' option whose value should be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
const mixinPlugins = {
|
||||
|
||||
104
node_modules/@babel/parser/lib/plugins/estree.js
generated
vendored
104
node_modules/@babel/parser/lib/plugins/estree.js
generated
vendored
@@ -11,6 +11,8 @@ var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
var _scopeflags = require("../util/scopeflags");
|
||||
|
||||
var _error = require("../parser/error");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
@@ -45,6 +47,13 @@ var _default = superClass => class extends superClass {
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseDecimalLiteral(value) {
|
||||
const decimal = null;
|
||||
const node = this.estreeParseLiteral(decimal);
|
||||
node.decimal = String(node.value || value);
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseLiteral(value) {
|
||||
return this.parseLiteral(value, "Literal");
|
||||
}
|
||||
@@ -73,20 +82,8 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
}
|
||||
|
||||
checkGetterSetterParams(method) {
|
||||
const prop = method;
|
||||
const paramCount = prop.kind === "get" ? 0 : 1;
|
||||
const start = prop.start;
|
||||
|
||||
if (prop.value.params.length !== paramCount) {
|
||||
if (prop.kind === "get") {
|
||||
this.raise(start, "getter must not have any formal parameters");
|
||||
} else {
|
||||
this.raise(start, "setter must have exactly one formal parameter");
|
||||
}
|
||||
} else if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
|
||||
this.raise(start, "setter function argument must not be a rest parameter");
|
||||
}
|
||||
getObjectOrClassMethodParams(method) {
|
||||
return method.value.params;
|
||||
}
|
||||
|
||||
checkLVal(expr, bindingType = _scopeflags.BIND_NONE, checkClashes, contextDescription, disallowLetBinding) {
|
||||
@@ -102,29 +99,16 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
}
|
||||
|
||||
checkDuplicatedProto(prop, protoRef, refExpressionErrors) {
|
||||
if (prop.type === "SpreadElement" || prop.computed || prop.method || prop.shorthand) {
|
||||
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
|
||||
if (prop.method) {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = prop.key;
|
||||
const name = key.type === "Identifier" ? key.name : String(key.value);
|
||||
|
||||
if (name === "__proto__" && prop.kind === "init") {
|
||||
if (protoRef.used) {
|
||||
if (refExpressionErrors && refExpressionErrors.doubleProto === -1) {
|
||||
refExpressionErrors.doubleProto = key.start;
|
||||
} else {
|
||||
this.raise(key.start, "Redefinition of __proto__ property");
|
||||
}
|
||||
}
|
||||
|
||||
protoRef.used = true;
|
||||
}
|
||||
super.checkProto(prop, isRecord, protoRef, refExpressionErrors);
|
||||
}
|
||||
|
||||
isValidDirective(stmt) {
|
||||
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized);
|
||||
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !stmt.expression.extra?.parenthesized;
|
||||
}
|
||||
|
||||
stmtToDirective(stmt) {
|
||||
@@ -164,6 +148,9 @@ var _default = superClass => class extends superClass {
|
||||
case _types.types.bigint:
|
||||
return this.estreeParseBigIntLiteral(this.state.value);
|
||||
|
||||
case _types.types.decimal:
|
||||
return this.estreeParseDecimalLiteral(this.state.value);
|
||||
|
||||
case _types.types._null:
|
||||
return this.estreeParseLiteral(null);
|
||||
|
||||
@@ -201,8 +188,8 @@ var _default = superClass => class extends superClass {
|
||||
return this.finishNode(node, type);
|
||||
}
|
||||
|
||||
parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) {
|
||||
const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc);
|
||||
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
||||
const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor);
|
||||
|
||||
if (node) {
|
||||
node.type = "Property";
|
||||
@@ -235,9 +222,9 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
toAssignableObjectExpressionProp(prop, isLast) {
|
||||
if (prop.kind === "get" || prop.kind === "set") {
|
||||
throw this.raise(prop.key.start, "Object pattern can't contain getter or setter");
|
||||
throw this.raise(prop.key.start, _error.Errors.PatternHasAccessor);
|
||||
} else if (prop.method) {
|
||||
throw this.raise(prop.key.start, "Object pattern can't contain methods");
|
||||
throw this.raise(prop.key.start, _error.Errors.PatternHasMethod);
|
||||
} else {
|
||||
super.toAssignableObjectExpressionProp(prop, isLast);
|
||||
}
|
||||
@@ -256,12 +243,53 @@ var _default = superClass => class extends superClass {
|
||||
return node;
|
||||
}
|
||||
|
||||
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
||||
if (!exprList) {
|
||||
toReferencedArguments(node) {
|
||||
if (node.type === "ImportExpression") {
|
||||
return;
|
||||
}
|
||||
|
||||
super.toReferencedListDeep(exprList, isParenthesizedExpr);
|
||||
super.toReferencedArguments(node);
|
||||
}
|
||||
|
||||
parseExport(node) {
|
||||
super.parseExport(node);
|
||||
|
||||
switch (node.type) {
|
||||
case "ExportAllDeclaration":
|
||||
node.exported = null;
|
||||
break;
|
||||
|
||||
case "ExportNamedDeclaration":
|
||||
if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
|
||||
node.type = "ExportAllDeclaration";
|
||||
node.exported = node.specifiers[0].exported;
|
||||
delete node.specifiers;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
parseSubscript(base, startPos, startLoc, noCalls, state) {
|
||||
const node = super.parseSubscript(base, startPos, startLoc, noCalls, state);
|
||||
|
||||
if (state.optionalChainMember) {
|
||||
if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
|
||||
node.type = node.type.substring(8);
|
||||
}
|
||||
|
||||
if (state.stop) {
|
||||
const chain = this.startNodeAtNode(node);
|
||||
chain.expression = node;
|
||||
return this.finishNode(chain, "ChainExpression");
|
||||
}
|
||||
} else if (node.type === "MemberExpression" || node.type === "CallExpression") {
|
||||
node.optional = false;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
4964
node_modules/@babel/parser/lib/plugins/flow.js
generated
vendored
4964
node_modules/@babel/parser/lib/plugins/flow.js
generated
vendored
File diff suppressed because it is too large
Load Diff
28
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
28
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
@@ -17,6 +17,8 @@ var _identifier = require("../../util/identifier");
|
||||
|
||||
var _whitespace = require("../../util/whitespace");
|
||||
|
||||
var _error = require("../../parser/error");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
@@ -25,6 +27,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
const HEX_NUMBER = /^[\da-fA-F]+$/;
|
||||
const DECIMAL_NUMBER = /^\d+$/;
|
||||
const JsxErrors = Object.freeze({
|
||||
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression",
|
||||
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
|
||||
MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>",
|
||||
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text",
|
||||
UnterminatedJsxContent: "Unterminated JSX contents",
|
||||
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
||||
});
|
||||
_context.types.j_oTag = new _context.TokContext("<tag", false);
|
||||
_context.types.j_cTag = new _context.TokContext("</tag", false);
|
||||
_context.types.j_expr = new _context.TokContext("<tag>...</tag>", true, true);
|
||||
@@ -81,7 +91,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated JSX contents");
|
||||
throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -143,7 +153,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated string constant");
|
||||
throw this.raise(this.state.start, _error.Errors.UnterminatedString);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -275,7 +285,7 @@ var _default = superClass => class extends superClass {
|
||||
node = this.jsxParseExpressionContainer(node);
|
||||
|
||||
if (node.expression.type === "JSXEmptyExpression") {
|
||||
this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
|
||||
this.raise(node.start, JsxErrors.AttributeIsEmpty);
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -285,7 +295,7 @@ var _default = superClass => class extends superClass {
|
||||
return this.parseExprAtom();
|
||||
|
||||
default:
|
||||
throw this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
|
||||
throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +327,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
if (this.eat(_types.types.braceL)) {
|
||||
this.expect(_types.types.ellipsis);
|
||||
node.argument = this.parseMaybeAssign();
|
||||
node.argument = this.parseMaybeAssignAllowIn();
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXSpreadAttribute");
|
||||
}
|
||||
@@ -411,12 +421,12 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
|
||||
if (isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <>");
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagFragment);
|
||||
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
|
||||
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
||||
this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +442,7 @@ var _default = superClass => class extends superClass {
|
||||
node.children = children;
|
||||
|
||||
if (this.isRelational("<")) {
|
||||
throw this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag. " + "Did you want a JSX fragment <>...</>?");
|
||||
throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements);
|
||||
}
|
||||
|
||||
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
||||
|
||||
19
node_modules/@babel/parser/lib/plugins/placeholders.js
generated
vendored
19
node_modules/@babel/parser/lib/plugins/placeholders.js
generated
vendored
@@ -108,6 +108,7 @@ var _default = superClass => class extends superClass {
|
||||
const type = isStatement ? "ClassDeclaration" : "ClassExpression";
|
||||
this.next();
|
||||
this.takeDecorators(node);
|
||||
const oldStrict = this.state.strict;
|
||||
const placeholder = this.parsePlaceholder("Identifier");
|
||||
|
||||
if (placeholder) {
|
||||
@@ -125,7 +126,7 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
|
||||
this.parseClassSuper(node);
|
||||
node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass);
|
||||
node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass, oldStrict);
|
||||
return this.finishNode(node, type);
|
||||
}
|
||||
|
||||
@@ -147,6 +148,20 @@ var _default = superClass => class extends superClass {
|
||||
return super.parseExport(node);
|
||||
}
|
||||
|
||||
isExportDefaultSpecifier() {
|
||||
if (this.match(_types.types._default)) {
|
||||
const next = this.nextTokenStart();
|
||||
|
||||
if (this.isUnparsedContextual(next, "from")) {
|
||||
if (this.input.startsWith(_types.types.placeholder.label, this.nextTokenStartSince(next + 4))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.isExportDefaultSpecifier();
|
||||
}
|
||||
|
||||
maybeParseExportDefaultSpecifier(node) {
|
||||
if (node.specifiers && node.specifiers.length > 0) {
|
||||
return true;
|
||||
@@ -160,7 +175,7 @@ var _default = superClass => class extends superClass {
|
||||
specifiers
|
||||
} = node;
|
||||
|
||||
if (specifiers && specifiers.length) {
|
||||
if (specifiers?.length) {
|
||||
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
|
||||
}
|
||||
|
||||
|
||||
451
node_modules/@babel/parser/lib/plugins/typescript/index.js
generated
vendored
451
node_modules/@babel/parser/lib/plugins/typescript/index.js
generated
vendored
@@ -15,6 +15,10 @@ var _scopeflags = require("../../util/scopeflags");
|
||||
|
||||
var _scope = _interopRequireDefault(require("./scope"));
|
||||
|
||||
var _productionParameter = require("../../util/production-parameter");
|
||||
|
||||
var _error = require("../../parser/error");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
@@ -35,6 +39,36 @@ function assert(x) {
|
||||
}
|
||||
}
|
||||
|
||||
const TSErrors = Object.freeze({
|
||||
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier",
|
||||
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier",
|
||||
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
|
||||
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
||||
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
||||
DuplicateModifier: "Duplicate modifier: '%0'",
|
||||
EmptyHeritageClauseType: "'%0' list cannot be empty.",
|
||||
EmptyTypeArguments: "Type argument list cannot be empty.",
|
||||
EmptyTypeParameters: "Type parameter list cannot be empty.",
|
||||
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier",
|
||||
IndexSignatureHasAccessibility: "Index signatures cannot have an accessibility modifier ('%0')",
|
||||
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier",
|
||||
IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier",
|
||||
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
||||
MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
|
||||
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
||||
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
||||
PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
|
||||
PrivateElementHasAccessibility: "Private elements cannot have an accessibility modifier ('%0')",
|
||||
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`",
|
||||
UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
|
||||
UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
|
||||
UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
|
||||
UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
|
||||
UnsupportedImportTypeArgument: "Argument in a type import must be a string literal",
|
||||
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
||||
UnsupportedSignatureParameterKind: "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got %0"
|
||||
});
|
||||
|
||||
function keywordTypeFromName(value) {
|
||||
switch (value) {
|
||||
case "any":
|
||||
@@ -100,22 +134,18 @@ var _default = superClass => class extends superClass {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
tsParseModifiers(allowedModifiers) {
|
||||
const modifiers = Object.create(null);
|
||||
|
||||
while (true) {
|
||||
tsParseModifiers(modified, allowedModifiers) {
|
||||
for (;;) {
|
||||
const startPos = this.state.start;
|
||||
const modifier = this.tsParseModifier(allowedModifiers);
|
||||
if (!modifier) break;
|
||||
|
||||
if (Object.hasOwnProperty.call(modifiers, modifier)) {
|
||||
this.raise(startPos, `Duplicate modifier: '${modifier}'`);
|
||||
if (Object.hasOwnProperty.call(modified, modifier)) {
|
||||
this.raise(startPos, TSErrors.DuplicateModifier, modifier);
|
||||
}
|
||||
|
||||
modifiers[modifier] = true;
|
||||
modified[modifier] = true;
|
||||
}
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
tsIsListTerminator(kind) {
|
||||
@@ -154,7 +184,7 @@ var _default = superClass => class extends superClass {
|
||||
tsParseDelimitedListWorker(kind, parseElement, expectSuccess) {
|
||||
const result = [];
|
||||
|
||||
while (true) {
|
||||
for (;;) {
|
||||
if (this.tsIsListTerminator(kind)) {
|
||||
break;
|
||||
}
|
||||
@@ -211,7 +241,7 @@ var _default = superClass => class extends superClass {
|
||||
this.expect(_types.types.parenL);
|
||||
|
||||
if (!this.match(_types.types.string)) {
|
||||
this.raise(this.state.start, "Argument in a type import must be a string literal");
|
||||
this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument);
|
||||
}
|
||||
|
||||
node.argument = this.parseExprAtom();
|
||||
@@ -303,6 +333,11 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
|
||||
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true);
|
||||
|
||||
if (node.params.length === 0) {
|
||||
this.raise(node.start, TSErrors.EmptyTypeParameters);
|
||||
}
|
||||
|
||||
return this.finishNode(node, "TSTypeParameterDeclaration");
|
||||
}
|
||||
|
||||
@@ -331,7 +366,7 @@ var _default = superClass => class extends superClass {
|
||||
tsParseBindingListForSignature() {
|
||||
return this.parseBindingList(_types.types.parenR, 41).map(pattern => {
|
||||
if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") {
|
||||
this.raise(pattern.start, "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern," + `instead got ${pattern.type}`);
|
||||
this.raise(pattern.start, TSErrors.UnsupportedSignatureParameterKind, pattern.type);
|
||||
}
|
||||
|
||||
return pattern;
|
||||
@@ -481,6 +516,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
this.expect(_types.types.bracketL);
|
||||
node.typeParameter = this.tsParseMappedTypeParameter();
|
||||
node.nameType = this.eatContextual("as") ? this.tsParseType() : null;
|
||||
this.expect(_types.types.bracketR);
|
||||
|
||||
if (this.match(_types.types.plusMin)) {
|
||||
@@ -501,35 +537,66 @@ var _default = superClass => class extends superClass {
|
||||
const node = this.startNode();
|
||||
node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
|
||||
let seenOptionalElement = false;
|
||||
let labeledElements = null;
|
||||
node.elementTypes.forEach(elementNode => {
|
||||
if (elementNode.type === "TSOptionalType") {
|
||||
seenOptionalElement = true;
|
||||
} else if (seenOptionalElement && elementNode.type !== "TSRestType") {
|
||||
this.raise(elementNode.start, "A required element cannot follow an optional element.");
|
||||
let {
|
||||
type
|
||||
} = elementNode;
|
||||
|
||||
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
|
||||
this.raise(elementNode.start, TSErrors.OptionalTypeBeforeRequired);
|
||||
}
|
||||
|
||||
seenOptionalElement = seenOptionalElement || type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType";
|
||||
|
||||
if (type === "TSRestType") {
|
||||
elementNode = elementNode.typeAnnotation;
|
||||
type = elementNode.type;
|
||||
}
|
||||
|
||||
const isLabeled = type === "TSNamedTupleMember";
|
||||
labeledElements = labeledElements ?? isLabeled;
|
||||
|
||||
if (labeledElements !== isLabeled) {
|
||||
this.raise(elementNode.start, TSErrors.MixedLabeledAndUnlabeledElements);
|
||||
}
|
||||
});
|
||||
return this.finishNode(node, "TSTupleType");
|
||||
}
|
||||
|
||||
tsParseTupleElementType() {
|
||||
if (this.match(_types.types.ellipsis)) {
|
||||
const restNode = this.startNode();
|
||||
this.next();
|
||||
restNode.typeAnnotation = this.tsParseType();
|
||||
const {
|
||||
start: startPos,
|
||||
startLoc
|
||||
} = this.state;
|
||||
const rest = this.eat(_types.types.ellipsis);
|
||||
let type = this.tsParseType();
|
||||
const optional = this.eat(_types.types.question);
|
||||
const labeled = this.eat(_types.types.colon);
|
||||
|
||||
if (this.match(_types.types.comma) && this.lookaheadCharCode() !== 93) {
|
||||
this.raiseRestNotLast(this.state.start);
|
||||
if (labeled) {
|
||||
const labeledNode = this.startNodeAtNode(type);
|
||||
labeledNode.optional = optional;
|
||||
|
||||
if (type.type === "TSTypeReference" && !type.typeParameters && type.typeName.type === "Identifier") {
|
||||
labeledNode.label = type.typeName;
|
||||
} else {
|
||||
this.raise(type.start, TSErrors.InvalidTupleMemberLabel);
|
||||
labeledNode.label = type;
|
||||
}
|
||||
|
||||
return this.finishNode(restNode, "TSRestType");
|
||||
}
|
||||
|
||||
const type = this.tsParseType();
|
||||
|
||||
if (this.eat(_types.types.question)) {
|
||||
labeledNode.elementType = this.tsParseType();
|
||||
type = this.finishNode(labeledNode, "TSNamedTupleMember");
|
||||
} else if (optional) {
|
||||
const optionalTypeNode = this.startNodeAtNode(type);
|
||||
optionalTypeNode.typeAnnotation = type;
|
||||
return this.finishNode(optionalTypeNode, "TSOptionalType");
|
||||
type = this.finishNode(optionalTypeNode, "TSOptionalType");
|
||||
}
|
||||
|
||||
if (rest) {
|
||||
const restNode = this.startNodeAt(startPos, startLoc);
|
||||
restNode.typeAnnotation = type;
|
||||
type = this.finishNode(restNode, "TSRestType");
|
||||
}
|
||||
|
||||
return type;
|
||||
@@ -560,6 +627,7 @@ var _default = superClass => class extends superClass {
|
||||
node.literal = (() => {
|
||||
switch (this.state.type) {
|
||||
case _types.types.num:
|
||||
case _types.types.bigint:
|
||||
case _types.types.string:
|
||||
case _types.types._true:
|
||||
case _types.types._false:
|
||||
@@ -575,16 +643,15 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
tsParseTemplateLiteralType() {
|
||||
const node = this.startNode();
|
||||
const templateNode = this.parseTemplate(false);
|
||||
|
||||
if (templateNode.expressions.length > 0) {
|
||||
this.raise(templateNode.expressions[0].start, "Template literal types cannot have any substitution");
|
||||
}
|
||||
|
||||
node.literal = templateNode;
|
||||
node.literal = this.parseTemplate(false);
|
||||
return this.finishNode(node, "TSLiteralType");
|
||||
}
|
||||
|
||||
parseTemplateSubstitution() {
|
||||
if (this.state.inType) return this.tsParseType();
|
||||
return super.parseTemplateSubstitution();
|
||||
}
|
||||
|
||||
tsParseThisTypeOrThisTypePredicate() {
|
||||
const thisKeyword = this.tsParseThisTypeNode();
|
||||
|
||||
@@ -614,6 +681,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
case _types.types.string:
|
||||
case _types.types.num:
|
||||
case _types.types.bigint:
|
||||
case _types.types._true:
|
||||
case _types.types._false:
|
||||
return this.tsParseLiteralTypeNode();
|
||||
@@ -621,8 +689,9 @@ var _default = superClass => class extends superClass {
|
||||
case _types.types.plusMin:
|
||||
if (this.state.value === "-") {
|
||||
const node = this.startNode();
|
||||
const nextToken = this.lookahead();
|
||||
|
||||
if (this.lookahead().type !== _types.types.num) {
|
||||
if (nextToken.type !== _types.types.num && nextToken.type !== _types.types.bigint) {
|
||||
throw this.unexpected();
|
||||
}
|
||||
|
||||
@@ -698,7 +767,7 @@ var _default = superClass => class extends superClass {
|
||||
return;
|
||||
|
||||
default:
|
||||
this.raise(node.start, "'readonly' type modifier is only permitted on array and tuple literal types.");
|
||||
this.raise(node.start, TSErrors.UnexpectedReadonly);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -822,7 +891,7 @@ var _default = superClass => class extends superClass {
|
||||
return this.tsInType(() => {
|
||||
const t = this.startNode();
|
||||
this.expect(returnToken);
|
||||
const asserts = this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
|
||||
const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
|
||||
|
||||
if (asserts && this.match(_types.types._this)) {
|
||||
let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
|
||||
@@ -898,7 +967,7 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
|
||||
if (containsEsc) {
|
||||
this.raise(this.state.lastTokStart, "Escape sequence in keyword asserts");
|
||||
this.raise(this.state.lastTokStart, _error.Errors.InvalidEscapedReservedWord, "asserts");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -958,7 +1027,7 @@ var _default = superClass => class extends superClass {
|
||||
const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this));
|
||||
|
||||
if (!delimitedList.length) {
|
||||
this.raise(originalStart, `'${descriptor}' list cannot be empty.`);
|
||||
this.raise(originalStart, TSErrors.EmptyHeritageClauseType, descriptor);
|
||||
}
|
||||
|
||||
return delimitedList;
|
||||
@@ -994,7 +1063,17 @@ var _default = superClass => class extends superClass {
|
||||
node.id = this.parseIdentifier();
|
||||
this.checkLVal(node.id, _scopeflags.BIND_TS_TYPE, undefined, "typescript type alias");
|
||||
node.typeParameters = this.tsTryParseTypeParameters();
|
||||
node.typeAnnotation = this.tsExpectThenParseType(_types.types.eq);
|
||||
node.typeAnnotation = this.tsInType(() => {
|
||||
this.expect(_types.types.eq);
|
||||
|
||||
if (this.isContextual("intrinsic") && this.lookahead().type !== _types.types.dot) {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
return this.finishNode(node, "TSIntrinsicKeyword");
|
||||
}
|
||||
|
||||
return this.tsParseType();
|
||||
});
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "TSTypeAliasDeclaration");
|
||||
}
|
||||
@@ -1045,7 +1124,7 @@ var _default = superClass => class extends superClass {
|
||||
node.id = this.match(_types.types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
|
||||
|
||||
if (this.eat(_types.types.eq)) {
|
||||
node.initializer = this.parseMaybeAssign();
|
||||
node.initializer = this.parseMaybeAssignAllowIn();
|
||||
}
|
||||
|
||||
return this.finishNode(node, "TSEnumMember");
|
||||
@@ -1083,7 +1162,9 @@ var _default = superClass => class extends superClass {
|
||||
node.body = inner;
|
||||
} else {
|
||||
this.scope.enter(_scopeflags.SCOPE_TS_MODULE);
|
||||
this.prodParam.enter(_productionParameter.PARAM);
|
||||
node.body = this.tsParseModuleBlock();
|
||||
this.prodParam.exit();
|
||||
this.scope.exit();
|
||||
}
|
||||
|
||||
@@ -1102,7 +1183,9 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
if (this.match(_types.types.braceL)) {
|
||||
this.scope.enter(_scopeflags.SCOPE_TS_MODULE);
|
||||
this.prodParam.enter(_productionParameter.PARAM);
|
||||
node.body = this.tsParseModuleBlock();
|
||||
this.prodParam.exit();
|
||||
this.scope.exit();
|
||||
} else {
|
||||
this.semicolon();
|
||||
@@ -1182,36 +1265,39 @@ var _default = superClass => class extends superClass {
|
||||
kind = "let";
|
||||
}
|
||||
|
||||
switch (starttype) {
|
||||
case _types.types._function:
|
||||
return this.parseFunctionStatement(nany, false, true);
|
||||
return this.tsInDeclareContext(() => {
|
||||
switch (starttype) {
|
||||
case _types.types._function:
|
||||
nany.declare = true;
|
||||
return this.parseFunctionStatement(nany, false, true);
|
||||
|
||||
case _types.types._class:
|
||||
nany.declare = true;
|
||||
return this.parseClass(nany, true, false);
|
||||
case _types.types._class:
|
||||
nany.declare = true;
|
||||
return this.parseClass(nany, true, false);
|
||||
|
||||
case _types.types._const:
|
||||
if (this.match(_types.types._const) && this.isLookaheadContextual("enum")) {
|
||||
this.expect(_types.types._const);
|
||||
this.expectContextual("enum");
|
||||
return this.tsParseEnumDeclaration(nany, true);
|
||||
}
|
||||
|
||||
case _types.types._var:
|
||||
kind = kind || this.state.value;
|
||||
return this.parseVarStatement(nany, kind);
|
||||
|
||||
case _types.types.name:
|
||||
{
|
||||
const value = this.state.value;
|
||||
|
||||
if (value === "global") {
|
||||
return this.tsParseAmbientExternalModuleDeclaration(nany);
|
||||
} else {
|
||||
return this.tsParseDeclaration(nany, value, true);
|
||||
case _types.types._const:
|
||||
if (this.match(_types.types._const) && this.isLookaheadContextual("enum")) {
|
||||
this.expect(_types.types._const);
|
||||
this.expectContextual("enum");
|
||||
return this.tsParseEnumDeclaration(nany, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case _types.types._var:
|
||||
kind = kind || this.state.value;
|
||||
return this.parseVarStatement(nany, kind);
|
||||
|
||||
case _types.types.name:
|
||||
{
|
||||
const value = this.state.value;
|
||||
|
||||
if (value === "global") {
|
||||
return this.tsParseAmbientExternalModuleDeclaration(nany);
|
||||
} else {
|
||||
return this.tsParseDeclaration(nany, value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tsTryParseExportDeclaration() {
|
||||
@@ -1235,11 +1321,13 @@ var _default = superClass => class extends superClass {
|
||||
case "global":
|
||||
if (this.match(_types.types.braceL)) {
|
||||
this.scope.enter(_scopeflags.SCOPE_TS_MODULE);
|
||||
this.prodParam.enter(_productionParameter.PARAM);
|
||||
const mod = node;
|
||||
mod.global = true;
|
||||
mod.id = expr;
|
||||
mod.body = this.tsParseModuleBlock();
|
||||
this.scope.exit();
|
||||
this.prodParam.exit();
|
||||
return this.finishNode(mod, "TSModuleDeclaration");
|
||||
}
|
||||
|
||||
@@ -1324,6 +1412,8 @@ var _default = superClass => class extends superClass {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
||||
this.state.maybeInArrowParameters = true;
|
||||
const res = this.tsTryParseAndCatch(() => {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.typeParameters = this.tsParseTypeParameters();
|
||||
@@ -1332,6 +1422,7 @@ var _default = superClass => class extends superClass {
|
||||
this.expect(_types.types.arrow);
|
||||
return node;
|
||||
});
|
||||
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
||||
|
||||
if (!res) {
|
||||
return undefined;
|
||||
@@ -1346,6 +1437,11 @@ var _default = superClass => class extends superClass {
|
||||
this.expectRelational("<");
|
||||
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
||||
}));
|
||||
|
||||
if (node.params.length === 0) {
|
||||
this.raise(node.start, TSErrors.EmptyTypeArguments);
|
||||
}
|
||||
|
||||
this.state.exprAllowed = false;
|
||||
this.expectRelational(">");
|
||||
return this.finishNode(node, "TSTypeParameterInstantiation");
|
||||
@@ -1379,9 +1475,13 @@ var _default = superClass => class extends superClass {
|
||||
let accessibility;
|
||||
let readonly = false;
|
||||
|
||||
if (allowModifiers) {
|
||||
if (allowModifiers !== undefined) {
|
||||
accessibility = this.parseAccessModifier();
|
||||
readonly = !!this.tsParseModifier(["readonly"]);
|
||||
|
||||
if (allowModifiers === false && (accessibility || readonly)) {
|
||||
this.raise(startPos, TSErrors.UnexpectedParameterModifier);
|
||||
}
|
||||
}
|
||||
|
||||
const left = this.parseMaybeDefault();
|
||||
@@ -1399,7 +1499,7 @@ var _default = superClass => class extends superClass {
|
||||
if (readonly) pp.readonly = readonly;
|
||||
|
||||
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
|
||||
this.raise(pp.start, "A parameter property may not be declared using a binding pattern.");
|
||||
this.raise(pp.start, TSErrors.UnsupportedParameterPropertyKind);
|
||||
}
|
||||
|
||||
pp.parameter = elt;
|
||||
@@ -1425,6 +1525,15 @@ var _default = superClass => class extends superClass {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bodilessType === "TSDeclareFunction" && this.state.isDeclareContext) {
|
||||
this.raise(node.start, TSErrors.DeclareFunctionHasImplementation);
|
||||
|
||||
if (node.declare) {
|
||||
super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.parseFunctionBodyAndFinish(node, type, isMethod);
|
||||
}
|
||||
|
||||
@@ -1436,6 +1545,29 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
}
|
||||
|
||||
tsCheckForInvalidTypeCasts(items) {
|
||||
items.forEach(node => {
|
||||
if (node?.type === "TSTypeCastExpression") {
|
||||
this.raise(node.typeAnnotation.start, TSErrors.UnexpectedTypeAnnotation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toReferencedList(exprList, isInParens) {
|
||||
this.tsCheckForInvalidTypeCasts(exprList);
|
||||
return exprList;
|
||||
}
|
||||
|
||||
parseArrayLike(...args) {
|
||||
const node = super.parseArrayLike(...args);
|
||||
|
||||
if (node.type === "ArrayExpression") {
|
||||
this.tsCheckForInvalidTypeCasts(node.elements);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
parseSubscript(base, startPos, startLoc, noCalls, state) {
|
||||
if (!this.hasPrecedingLineBreak() && this.match(_types.types.bang)) {
|
||||
this.state.exprAllowed = false;
|
||||
@@ -1447,7 +1579,7 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
if (this.isRelational("<")) {
|
||||
const result = this.tsTryParseAndCatch(() => {
|
||||
if (!noCalls && this.atPossibleAsync(base)) {
|
||||
if (!noCalls && this.atPossibleAsyncArrow(base)) {
|
||||
const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startPos, startLoc);
|
||||
|
||||
if (asyncArrowFn) {
|
||||
@@ -1462,10 +1594,13 @@ var _default = superClass => class extends superClass {
|
||||
if (typeArguments) {
|
||||
if (!noCalls && this.eat(_types.types.parenL)) {
|
||||
node.arguments = this.parseCallExpressionArguments(_types.types.parenR, false);
|
||||
this.tsCheckForInvalidTypeCasts(node.arguments);
|
||||
node.typeParameters = typeArguments;
|
||||
return this.finishCallExpression(node, state.optionalChainMember);
|
||||
} else if (this.match(_types.types.backQuote)) {
|
||||
return this.parseTaggedTemplateExpression(startPos, startLoc, base, state, typeArguments);
|
||||
const result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
||||
result.typeParameters = typeArguments;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1493,7 +1628,7 @@ var _default = superClass => class extends superClass {
|
||||
super.parseNewArguments(node);
|
||||
}
|
||||
|
||||
parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn) {
|
||||
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
|
||||
if (nonNull(_types.types._in.binop) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual("as")) {
|
||||
const node = this.startNodeAt(leftStartPos, leftStartLoc);
|
||||
node.expression = left;
|
||||
@@ -1507,10 +1642,11 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
|
||||
this.finishNode(node, "TSAsExpression");
|
||||
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
|
||||
this.reScan_lt_gt();
|
||||
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec);
|
||||
}
|
||||
|
||||
return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn);
|
||||
return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec);
|
||||
}
|
||||
|
||||
checkReservedWord(word, startLoc, checkKeywords, isBinding) {}
|
||||
@@ -1518,11 +1654,30 @@ var _default = superClass => class extends superClass {
|
||||
checkDuplicateExports() {}
|
||||
|
||||
parseImport(node) {
|
||||
if (this.match(_types.types.name) && this.lookahead().type === _types.types.eq) {
|
||||
return this.tsParseImportEqualsDeclaration(node);
|
||||
if (this.match(_types.types.name) || this.match(_types.types.star) || this.match(_types.types.braceL)) {
|
||||
const ahead = this.lookahead();
|
||||
|
||||
if (this.match(_types.types.name) && ahead.type === _types.types.eq) {
|
||||
return this.tsParseImportEqualsDeclaration(node);
|
||||
}
|
||||
|
||||
if (this.isContextual("type") && ahead.type !== _types.types.comma && !(ahead.type === _types.types.name && ahead.value === "from")) {
|
||||
node.importKind = "type";
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
|
||||
return super.parseImport(node);
|
||||
if (!node.importKind) {
|
||||
node.importKind = "value";
|
||||
}
|
||||
|
||||
const importNode = super.parseImport(node);
|
||||
|
||||
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
||||
this.raise(importNode.start, "A type-only import can specify a default import or named bindings, but not both.");
|
||||
}
|
||||
|
||||
return importNode;
|
||||
}
|
||||
|
||||
parseExport(node) {
|
||||
@@ -1541,6 +1696,13 @@ var _default = superClass => class extends superClass {
|
||||
this.semicolon();
|
||||
return this.finishNode(decl, "TSNamespaceExportDeclaration");
|
||||
} else {
|
||||
if (this.isContextual("type") && this.lookahead().type === _types.types.braceL) {
|
||||
this.next();
|
||||
node.exportKind = "type";
|
||||
} else {
|
||||
node.exportKind = "value";
|
||||
}
|
||||
|
||||
return super.parseExport(node);
|
||||
}
|
||||
}
|
||||
@@ -1585,36 +1747,50 @@ var _default = superClass => class extends superClass {
|
||||
return this.tsParseModifier(["public", "protected", "private"]);
|
||||
}
|
||||
|
||||
parseClassMember(classBody, member, state, constructorAllowsSuper) {
|
||||
parseClassMember(classBody, member, state) {
|
||||
this.tsParseModifiers(member, ["declare"]);
|
||||
const accessibility = this.parseAccessModifier();
|
||||
if (accessibility) member.accessibility = accessibility;
|
||||
super.parseClassMember(classBody, member, state, constructorAllowsSuper);
|
||||
this.tsParseModifiers(member, ["declare"]);
|
||||
|
||||
const callParseClassMember = () => {
|
||||
super.parseClassMember(classBody, member, state);
|
||||
};
|
||||
|
||||
if (member.declare) {
|
||||
this.tsInDeclareContext(callParseClassMember);
|
||||
} else {
|
||||
callParseClassMember();
|
||||
}
|
||||
}
|
||||
|
||||
parseClassMemberWithIsStatic(classBody, member, state, isStatic, constructorAllowsSuper) {
|
||||
const modifiers = this.tsParseModifiers(["abstract", "readonly", "declare"]);
|
||||
Object.assign(member, modifiers);
|
||||
parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
|
||||
this.tsParseModifiers(member, ["abstract", "readonly", "declare"]);
|
||||
const idx = this.tsTryParseIndexSignature(member);
|
||||
|
||||
if (idx) {
|
||||
classBody.body.push(idx);
|
||||
|
||||
if (modifiers.abstract) {
|
||||
this.raise(member.start, "Index signatures cannot have the 'abstract' modifier");
|
||||
if (member.abstract) {
|
||||
this.raise(member.start, TSErrors.IndexSignatureHasAbstract);
|
||||
}
|
||||
|
||||
if (isStatic) {
|
||||
this.raise(member.start, "Index signatures cannot have the 'static' modifier");
|
||||
this.raise(member.start, TSErrors.IndexSignatureHasStatic);
|
||||
}
|
||||
|
||||
if (member.accessibility) {
|
||||
this.raise(member.start, `Index signatures cannot have an accessibility modifier ('${member.accessibility}')`);
|
||||
this.raise(member.start, TSErrors.IndexSignatureHasAccessibility, member.accessibility);
|
||||
}
|
||||
|
||||
if (member.declare) {
|
||||
this.raise(member.start, TSErrors.IndexSignatureHasDeclare);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic, constructorAllowsSuper);
|
||||
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
||||
}
|
||||
|
||||
parsePostMemberNameModifiers(methodOrProp) {
|
||||
@@ -1622,11 +1798,11 @@ var _default = superClass => class extends superClass {
|
||||
if (optional) methodOrProp.optional = true;
|
||||
|
||||
if (methodOrProp.readonly && this.match(_types.types.parenL)) {
|
||||
this.raise(methodOrProp.start, "Class methods cannot have the 'readonly' modifier");
|
||||
this.raise(methodOrProp.start, TSErrors.ClassMethodHasReadonly);
|
||||
}
|
||||
|
||||
if (methodOrProp.declare && this.match(_types.types.parenL)) {
|
||||
this.raise(methodOrProp.start, "Class methods cannot have the 'declare' modifier");
|
||||
this.raise(methodOrProp.start, TSErrors.ClassMethodHasDeclare);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1640,12 +1816,12 @@ var _default = superClass => class extends superClass {
|
||||
return super.shouldParseExportDeclaration();
|
||||
}
|
||||
|
||||
parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
|
||||
parseConditional(expr, startPos, startLoc, refNeedsArrowPos) {
|
||||
if (!refNeedsArrowPos || !this.match(_types.types.question)) {
|
||||
return super.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
|
||||
return super.parseConditional(expr, startPos, startLoc, refNeedsArrowPos);
|
||||
}
|
||||
|
||||
const result = this.tryParse(() => super.parseConditional(expr, noIn, startPos, startLoc));
|
||||
const result = this.tryParse(() => super.parseConditional(expr, startPos, startLoc));
|
||||
|
||||
if (!result.node) {
|
||||
refNeedsArrowPos.start = result.error.pos || this.state.start;
|
||||
@@ -1688,6 +1864,10 @@ var _default = superClass => class extends superClass {
|
||||
declaration = super.parseExportDeclaration(node);
|
||||
}
|
||||
|
||||
if (declaration && (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare)) {
|
||||
node.exportKind = "type";
|
||||
}
|
||||
|
||||
if (declaration && isDeclare) {
|
||||
this.resetStartLocation(declaration, startPos, startLoc);
|
||||
declaration.declare = true;
|
||||
@@ -1718,8 +1898,8 @@ var _default = superClass => class extends superClass {
|
||||
parseClassProperty(node) {
|
||||
this.parseClassPropertyAnnotation(node);
|
||||
|
||||
if (node.declare && this.match(_types.types.equal)) {
|
||||
this.raise(this.state.start, "'declare' class fields cannot have an initializer");
|
||||
if (this.state.isDeclareContext && this.match(_types.types.eq)) {
|
||||
this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer);
|
||||
}
|
||||
|
||||
return super.parseClassProperty(node);
|
||||
@@ -1727,11 +1907,11 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
parseClassPrivateProperty(node) {
|
||||
if (node.abstract) {
|
||||
this.raise(node.start, "Private elements cannot have the 'abstract' modifier.");
|
||||
this.raise(node.start, TSErrors.PrivateElementHasAbstract);
|
||||
}
|
||||
|
||||
if (node.accessibility) {
|
||||
this.raise(node.start, `Private elements cannot have an accessibility modifier ('${node.accessibility}')`);
|
||||
this.raise(node.start, TSErrors.PrivateElementHasAccessibility, node.accessibility);
|
||||
}
|
||||
|
||||
this.parseClassPropertyAnnotation(node);
|
||||
@@ -1740,6 +1920,11 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
||||
const typeParameters = this.tsTryParseTypeParameters();
|
||||
|
||||
if (typeParameters && isConstructor) {
|
||||
this.raise(typeParameters.start, TSErrors.ConstructorHasTypeParameters);
|
||||
}
|
||||
|
||||
if (typeParameters) method.typeParameters = typeParameters;
|
||||
super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
|
||||
}
|
||||
@@ -1817,7 +2002,7 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(jsx && jsx.error) && !this.isRelational("<")) {
|
||||
if (!jsx?.error && !this.isRelational("<")) {
|
||||
return super.parseMaybeAssign(...args);
|
||||
}
|
||||
|
||||
@@ -1831,7 +2016,7 @@ var _default = superClass => class extends superClass {
|
||||
abort();
|
||||
}
|
||||
|
||||
if (typeParameters && typeParameters.params.length !== 0) {
|
||||
if (typeParameters?.params.length !== 0) {
|
||||
this.resetStartLocationFromNode(expr, typeParameters);
|
||||
}
|
||||
|
||||
@@ -1846,7 +2031,7 @@ var _default = superClass => class extends superClass {
|
||||
if (!typeCast.error) return typeCast.node;
|
||||
}
|
||||
|
||||
if (jsx && jsx.node) {
|
||||
if (jsx?.node) {
|
||||
this.state = jsx.failState;
|
||||
return jsx.node;
|
||||
}
|
||||
@@ -1856,15 +2041,15 @@ var _default = superClass => class extends superClass {
|
||||
return arrow.node;
|
||||
}
|
||||
|
||||
if (typeCast && typeCast.node) {
|
||||
if (typeCast?.node) {
|
||||
this.state = typeCast.failState;
|
||||
return typeCast.node;
|
||||
}
|
||||
|
||||
if (jsx && jsx.thrown) throw jsx.error;
|
||||
if (jsx?.thrown) throw jsx.error;
|
||||
if (arrow.thrown) throw arrow.error;
|
||||
if (typeCast && typeCast.thrown) throw typeCast.error;
|
||||
throw jsx && jsx.error || arrow.error || typeCast && typeCast.error;
|
||||
if (typeCast?.thrown) throw typeCast.error;
|
||||
throw jsx?.error || arrow.error || typeCast?.error;
|
||||
}
|
||||
|
||||
parseMaybeUnary(refExpressionErrors) {
|
||||
@@ -1895,8 +2080,8 @@ var _default = superClass => class extends superClass {
|
||||
|
||||
parseAssignableListItemTypes(param) {
|
||||
if (this.eat(_types.types.question)) {
|
||||
if (param.type !== "Identifier") {
|
||||
this.raise(param.start, "A binding pattern parameter cannot be optional in an implementation signature.");
|
||||
if (param.type !== "Identifier" && !this.state.isDeclareContext && !this.state.inType) {
|
||||
this.raise(param.start, TSErrors.PatternIsOptional);
|
||||
}
|
||||
|
||||
param.optional = true;
|
||||
@@ -1986,7 +2171,7 @@ var _default = superClass => class extends superClass {
|
||||
const node = super.parseMaybeDefault(...args);
|
||||
|
||||
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
||||
this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, " + "e.g. instead of `age = 25: number` use `age: number = 25`");
|
||||
this.raise(node.typeAnnotation.start, TSErrors.TypeAnnotationAfterAssign);
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -2000,6 +2185,17 @@ var _default = superClass => class extends superClass {
|
||||
}
|
||||
}
|
||||
|
||||
reScan_lt_gt() {
|
||||
if (this.match(_types.types.relational)) {
|
||||
const code = this.input.charCodeAt(this.state.start);
|
||||
|
||||
if (code === 60 || code === 62) {
|
||||
this.state.pos -= 1;
|
||||
this.readToken_lt_gt(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toAssignableList(exprList) {
|
||||
for (let i = 0; i < exprList.length; i++) {
|
||||
const expr = exprList[i];
|
||||
@@ -2015,7 +2211,7 @@ var _default = superClass => class extends superClass {
|
||||
if (!this.state.maybeInArrowParameters) {
|
||||
exprList[i] = this.typeCastToParameter(expr);
|
||||
} else {
|
||||
this.raise(expr.start, "Unexpected type cast in parameter position.");
|
||||
this.raise(expr.start, TSErrors.UnexpectedTypeCastInParameter);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2031,18 +2227,6 @@ var _default = superClass => class extends superClass {
|
||||
return node.expression;
|
||||
}
|
||||
|
||||
toReferencedList(exprList, isInParens) {
|
||||
for (let i = 0; i < exprList.length; i++) {
|
||||
const expr = exprList[i];
|
||||
|
||||
if (expr && expr.type === "TSTypeCastExpression") {
|
||||
this.raise(expr.start, "Did not expect a type annotation here.");
|
||||
}
|
||||
}
|
||||
|
||||
return exprList;
|
||||
}
|
||||
|
||||
shouldParseArrow() {
|
||||
return this.match(_types.types.colon) || super.shouldParseArrow();
|
||||
}
|
||||
@@ -2071,6 +2255,29 @@ var _default = superClass => class extends superClass {
|
||||
return hasContextParam ? baseCount + 1 : baseCount;
|
||||
}
|
||||
|
||||
parseCatchClauseParam() {
|
||||
const param = super.parseCatchClauseParam();
|
||||
const type = this.tsTryParseTypeAnnotation();
|
||||
|
||||
if (type) {
|
||||
param.typeAnnotation = type;
|
||||
this.resetEndLocation(param);
|
||||
}
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
tsInDeclareContext(cb) {
|
||||
const oldIsDeclareContext = this.state.isDeclareContext;
|
||||
this.state.isDeclareContext = true;
|
||||
|
||||
try {
|
||||
return cb();
|
||||
} finally {
|
||||
this.state.isDeclareContext = oldIsDeclareContext;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
16
node_modules/@babel/parser/lib/tokenizer/context.js
generated
vendored
16
node_modules/@babel/parser/lib/tokenizer/context.js
generated
vendored
@@ -7,10 +7,12 @@ exports.types = exports.TokContext = void 0;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
var _whitespace = require("../util/whitespace");
|
||||
|
||||
class TokContext {
|
||||
constructor(token, isExpr, preserveSpace, override) {
|
||||
this.token = void 0;
|
||||
this.isExpr = void 0;
|
||||
this.preserveSpace = void 0;
|
||||
this.override = void 0;
|
||||
this.token = token;
|
||||
this.isExpr = !!isExpr;
|
||||
this.preserveSpace = !!preserveSpace;
|
||||
@@ -23,6 +25,7 @@ exports.TokContext = TokContext;
|
||||
const types = {
|
||||
braceStatement: new TokContext("{", false),
|
||||
braceExpression: new TokContext("{", true),
|
||||
recordExpression: new TokContext("#{", true),
|
||||
templateQuasi: new TokContext("${", false),
|
||||
parenStatement: new TokContext("(", false),
|
||||
parenExpression: new TokContext("(", true),
|
||||
@@ -51,7 +54,7 @@ _types.types.name.updateContext = function (prevType) {
|
||||
let allowed = false;
|
||||
|
||||
if (prevType !== _types.types.dot) {
|
||||
if (this.state.value === "of" && !this.state.exprAllowed || this.state.value === "yield" && this.scope.inGenerator) {
|
||||
if (this.state.value === "of" && !this.state.exprAllowed && prevType !== _types.types._function && prevType !== _types.types._class) {
|
||||
allowed = true;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +85,7 @@ _types.types.parenL.updateContext = function (prevType) {
|
||||
_types.types.incDec.updateContext = function () {};
|
||||
|
||||
_types.types._function.updateContext = _types.types._class.updateContext = function (prevType) {
|
||||
if (prevType.beforeExpr && prevType !== _types.types.semi && prevType !== _types.types._else && !(prevType === _types.types._return && _whitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) && !((prevType === _types.types.colon || prevType === _types.types.braceL) && this.curContext() === types.b_stat)) {
|
||||
if (prevType.beforeExpr && prevType !== _types.types.semi && prevType !== _types.types._else && !(prevType === _types.types._return && this.hasPrecedingLineBreak()) && !((prevType === _types.types.colon || prevType === _types.types.braceL) && this.curContext() === types.b_stat)) {
|
||||
this.state.context.push(types.functionExpression);
|
||||
} else {
|
||||
this.state.context.push(types.functionStatement);
|
||||
@@ -99,4 +102,9 @@ _types.types.backQuote.updateContext = function () {
|
||||
}
|
||||
|
||||
this.state.exprAllowed = false;
|
||||
};
|
||||
|
||||
_types.types.braceHashL.updateContext = function () {
|
||||
this.state.context.push(types.recordExpression);
|
||||
this.state.exprAllowed = true;
|
||||
};
|
||||
268
node_modules/@babel/parser/lib/tokenizer/index.js
generated
vendored
268
node_modules/@babel/parser/lib/tokenizer/index.js
generated
vendored
@@ -13,9 +13,9 @@ var _types2 = require("./types");
|
||||
|
||||
var _context = require("./context");
|
||||
|
||||
var _location = _interopRequireDefault(require("../parser/location"));
|
||||
var _error = _interopRequireWildcard(require("../parser/error"));
|
||||
|
||||
var _location2 = require("../util/location");
|
||||
var _location = require("../util/location");
|
||||
|
||||
var _whitespace = require("../util/whitespace");
|
||||
|
||||
@@ -48,16 +48,17 @@ class Token {
|
||||
this.value = state.value;
|
||||
this.start = state.start;
|
||||
this.end = state.end;
|
||||
this.loc = new _location2.SourceLocation(state.startLoc, state.endLoc);
|
||||
this.loc = new _location.SourceLocation(state.startLoc, state.endLoc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.Token = Token;
|
||||
|
||||
class Tokenizer extends _location.default {
|
||||
class Tokenizer extends _error.default {
|
||||
constructor(options, input) {
|
||||
super();
|
||||
this.isLookahead = void 0;
|
||||
this.tokens = [];
|
||||
this.state = new _state.default();
|
||||
this.state.init(options);
|
||||
@@ -113,12 +114,15 @@ class Tokenizer extends _location.default {
|
||||
}
|
||||
|
||||
nextTokenStart() {
|
||||
const thisTokEnd = this.state.pos;
|
||||
_whitespace.skipWhiteSpace.lastIndex = thisTokEnd;
|
||||
return this.nextTokenStartSince(this.state.pos);
|
||||
}
|
||||
|
||||
nextTokenStartSince(pos) {
|
||||
_whitespace.skipWhiteSpace.lastIndex = pos;
|
||||
|
||||
const skip = _whitespace.skipWhiteSpace.exec(this.input);
|
||||
|
||||
return thisTokEnd + skip[0].length;
|
||||
return pos + skip[0].length;
|
||||
}
|
||||
|
||||
lookaheadCharCode() {
|
||||
@@ -144,9 +148,8 @@ class Tokenizer extends _location.default {
|
||||
|
||||
nextToken() {
|
||||
const curContext = this.curContext();
|
||||
if (!curContext || !curContext.preserveSpace) this.skipSpace();
|
||||
this.state.containsOctal = false;
|
||||
this.state.octalPosition = null;
|
||||
if (!curContext?.preserveSpace) this.skipSpace();
|
||||
this.state.octalPositions = [];
|
||||
this.state.start = this.state.pos;
|
||||
this.state.startLoc = this.state.curPosition();
|
||||
|
||||
@@ -155,8 +158,10 @@ class Tokenizer extends _location.default {
|
||||
return;
|
||||
}
|
||||
|
||||
if (curContext.override) {
|
||||
curContext.override(this);
|
||||
const override = curContext?.override;
|
||||
|
||||
if (override) {
|
||||
override(this);
|
||||
} else {
|
||||
this.getTokenFromCode(this.input.codePointAt(this.state.pos));
|
||||
}
|
||||
@@ -168,7 +173,7 @@ class Tokenizer extends _location.default {
|
||||
value: text,
|
||||
start: start,
|
||||
end: end,
|
||||
loc: new _location2.SourceLocation(startLoc, endLoc)
|
||||
loc: new _location.SourceLocation(startLoc, endLoc)
|
||||
};
|
||||
if (this.options.tokens) this.pushToken(comment);
|
||||
this.state.comments.push(comment);
|
||||
@@ -179,7 +184,7 @@ class Tokenizer extends _location.default {
|
||||
const startLoc = this.state.curPosition();
|
||||
const start = this.state.pos;
|
||||
const end = this.input.indexOf("*/", this.state.pos + 2);
|
||||
if (end === -1) throw this.raise(start, "Unterminated comment");
|
||||
if (end === -1) throw this.raise(start, _error.Errors.UnterminatedComment);
|
||||
this.state.pos = end + 2;
|
||||
_whitespace.lineBreakG.lastIndex = start;
|
||||
let match;
|
||||
@@ -277,13 +282,25 @@ class Tokenizer extends _location.default {
|
||||
const next = this.input.charCodeAt(nextPos);
|
||||
|
||||
if (next >= 48 && next <= 57) {
|
||||
throw this.raise(this.state.pos, "Unexpected digit after hash token");
|
||||
throw this.raise(this.state.pos, _error.Errors.UnexpectedDigitAfterHash);
|
||||
}
|
||||
|
||||
if (this.hasPlugin("classPrivateProperties") || this.hasPlugin("classPrivateMethods") || this.getPluginOption("pipelineOperator", "proposal") === "smart") {
|
||||
this.finishOp(_types2.types.hash, 1);
|
||||
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
|
||||
this.expectPlugin("recordAndTuple");
|
||||
|
||||
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "hash") {
|
||||
throw this.raise(this.state.pos, next === 123 ? _error.Errors.RecordExpressionHashIncorrectStartSyntaxType : _error.Errors.TupleExpressionHashIncorrectStartSyntaxType);
|
||||
}
|
||||
|
||||
if (next === 123) {
|
||||
this.finishToken(_types2.types.braceHashL);
|
||||
} else {
|
||||
this.finishToken(_types2.types.bracketHashL);
|
||||
}
|
||||
|
||||
this.state.pos += 2;
|
||||
} else {
|
||||
throw this.raise(this.state.pos, "Unexpected character '#'");
|
||||
this.finishOp(_types2.types.hash, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,10 +339,10 @@ class Tokenizer extends _location.default {
|
||||
|
||||
readToken_interpreter() {
|
||||
if (this.state.pos !== 0 || this.length < 2) return false;
|
||||
let ch = this.input.charCodeAt(this.state.pos + 1);
|
||||
if (ch !== 33) return false;
|
||||
const start = this.state.pos;
|
||||
this.state.pos += 1;
|
||||
let ch = this.input.charCodeAt(this.state.pos);
|
||||
if (ch !== 33) return false;
|
||||
|
||||
while (!(0, _whitespace.isNewLine)(ch) && ++this.state.pos < this.length) {
|
||||
ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -374,6 +391,24 @@ class Tokenizer extends _location.default {
|
||||
this.finishOp(_types2.types.pipeline, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.hasPlugin("recordAndTuple") && next === 125) {
|
||||
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
||||
throw this.raise(this.state.pos, _error.Errors.RecordExpressionBarIncorrectEndSyntaxType);
|
||||
}
|
||||
|
||||
this.finishOp(_types2.types.braceBarR, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.hasPlugin("recordAndTuple") && next === 93) {
|
||||
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
||||
throw this.raise(this.state.pos, _error.Errors.TupleExpressionBarIncorrectEndSyntaxType);
|
||||
}
|
||||
|
||||
this.finishOp(_types2.types.bracketBarR, 2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (next === 61) {
|
||||
@@ -398,7 +433,7 @@ class Tokenizer extends _location.default {
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
|
||||
if (next === code) {
|
||||
if (next === 45 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 62 && (this.state.lastTokEnd === 0 || _whitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos)))) {
|
||||
if (next === 45 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 62 && (this.state.lastTokEnd === 0 || this.hasPrecedingLineBreak())) {
|
||||
this.skipLineComment(3);
|
||||
this.skipSpace();
|
||||
this.nextToken();
|
||||
@@ -467,7 +502,7 @@ class Tokenizer extends _location.default {
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
const next2 = this.input.charCodeAt(this.state.pos + 2);
|
||||
|
||||
if (next === 63 && !this.state.inType) {
|
||||
if (next === 63) {
|
||||
if (next2 === 61) {
|
||||
this.finishOp(_types2.types.assign, 3);
|
||||
} else {
|
||||
@@ -509,8 +544,18 @@ class Tokenizer extends _location.default {
|
||||
return;
|
||||
|
||||
case 91:
|
||||
++this.state.pos;
|
||||
this.finishToken(_types2.types.bracketL);
|
||||
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
||||
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
||||
throw this.raise(this.state.pos, _error.Errors.TupleExpressionBarIncorrectStartSyntaxType);
|
||||
}
|
||||
|
||||
this.finishToken(_types2.types.bracketBarL);
|
||||
this.state.pos += 2;
|
||||
} else {
|
||||
++this.state.pos;
|
||||
this.finishToken(_types2.types.bracketL);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case 93:
|
||||
@@ -519,8 +564,18 @@ class Tokenizer extends _location.default {
|
||||
return;
|
||||
|
||||
case 123:
|
||||
++this.state.pos;
|
||||
this.finishToken(_types2.types.braceL);
|
||||
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
||||
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
||||
throw this.raise(this.state.pos, _error.Errors.RecordExpressionBarIncorrectStartSyntaxType);
|
||||
}
|
||||
|
||||
this.finishToken(_types2.types.braceBarL);
|
||||
this.state.pos += 2;
|
||||
} else {
|
||||
++this.state.pos;
|
||||
this.finishToken(_types2.types.braceL);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case 125:
|
||||
@@ -642,7 +697,7 @@ class Tokenizer extends _location.default {
|
||||
|
||||
}
|
||||
|
||||
throw this.raise(this.state.pos, `Unexpected character '${String.fromCodePoint(code)}'`);
|
||||
throw this.raise(this.state.pos, _error.Errors.InvalidOrUnexpectedToken, String.fromCodePoint(code));
|
||||
}
|
||||
|
||||
finishOp(type, size) {
|
||||
@@ -657,13 +712,13 @@ class Tokenizer extends _location.default {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(start, "Unterminated regular expression");
|
||||
throw this.raise(start, _error.Errors.UnterminatedRegExp);
|
||||
}
|
||||
|
||||
const ch = this.input.charAt(this.state.pos);
|
||||
|
||||
if (_whitespace.lineBreak.test(ch)) {
|
||||
throw this.raise(start, "Unterminated regular expression");
|
||||
throw this.raise(start, _error.Errors.UnterminatedRegExp);
|
||||
}
|
||||
|
||||
if (escaped) {
|
||||
@@ -693,10 +748,10 @@ class Tokenizer extends _location.default {
|
||||
|
||||
if (VALID_REGEX_FLAGS.has(char)) {
|
||||
if (mods.indexOf(char) > -1) {
|
||||
this.raise(this.state.pos + 1, "Duplicate regular expression flag");
|
||||
this.raise(this.state.pos + 1, _error.Errors.DuplicateRegExpFlags);
|
||||
}
|
||||
} else if ((0, _identifier.isIdentifierChar)(charCode) || charCode === 92) {
|
||||
this.raise(this.state.pos + 1, "Invalid regular expression flag");
|
||||
this.raise(this.state.pos + 1, _error.Errors.MalformedRegExpFlags);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -722,24 +777,22 @@ class Tokenizer extends _location.default {
|
||||
const code = this.input.charCodeAt(this.state.pos);
|
||||
let val;
|
||||
|
||||
if (this.hasPlugin("numericSeparator")) {
|
||||
if (code === 95) {
|
||||
const prev = this.input.charCodeAt(this.state.pos - 1);
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
if (code === 95) {
|
||||
const prev = this.input.charCodeAt(this.state.pos - 1);
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
|
||||
if (allowedSiblings.indexOf(next) === -1) {
|
||||
this.raise(this.state.pos, "A numeric separator is only allowed between two digits");
|
||||
} else if (forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next)) {
|
||||
this.raise(this.state.pos, "A numeric separator is only allowed between two digits");
|
||||
}
|
||||
|
||||
if (!allowNumSeparator) {
|
||||
this.raise(this.state.pos, "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences");
|
||||
}
|
||||
|
||||
++this.state.pos;
|
||||
continue;
|
||||
if (allowedSiblings.indexOf(next) === -1) {
|
||||
this.raise(this.state.pos, _error.Errors.UnexpectedNumericSeparator);
|
||||
} else if (forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next)) {
|
||||
this.raise(this.state.pos, _error.Errors.UnexpectedNumericSeparator);
|
||||
}
|
||||
|
||||
if (!allowNumSeparator) {
|
||||
this.raise(this.state.pos, _error.Errors.NumericSeparatorInEscapeSequence);
|
||||
}
|
||||
|
||||
++this.state.pos;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code >= 97) {
|
||||
@@ -755,7 +808,7 @@ class Tokenizer extends _location.default {
|
||||
if (val >= radix) {
|
||||
if (this.options.errorRecovery && val <= 9) {
|
||||
val = 0;
|
||||
this.raise(this.state.start + i + 2, "Expected number in radix " + radix);
|
||||
this.raise(this.state.start + i + 2, _error.Errors.InvalidDigit, radix);
|
||||
} else if (forceLen) {
|
||||
val = 0;
|
||||
invalid = true;
|
||||
@@ -782,18 +835,20 @@ class Tokenizer extends _location.default {
|
||||
const val = this.readInt(radix);
|
||||
|
||||
if (val == null) {
|
||||
this.raise(this.state.start + 2, "Expected number in radix " + radix);
|
||||
this.raise(this.state.start + 2, _error.Errors.InvalidDigit, radix);
|
||||
}
|
||||
|
||||
if (this.hasPlugin("bigInt")) {
|
||||
if (this.input.charCodeAt(this.state.pos) === 110) {
|
||||
++this.state.pos;
|
||||
isBigInt = true;
|
||||
}
|
||||
const next = this.input.charCodeAt(this.state.pos);
|
||||
|
||||
if (next === 110) {
|
||||
++this.state.pos;
|
||||
isBigInt = true;
|
||||
} else if (next === 109) {
|
||||
throw this.raise(start, _error.Errors.InvalidDecimal);
|
||||
}
|
||||
|
||||
if ((0, _identifier.isIdentifierStart)(this.input.codePointAt(this.state.pos))) {
|
||||
throw this.raise(this.state.pos, "Identifier directly after number");
|
||||
throw this.raise(this.state.pos, _error.Errors.NumberIdentifier);
|
||||
}
|
||||
|
||||
if (isBigInt) {
|
||||
@@ -809,77 +864,94 @@ class Tokenizer extends _location.default {
|
||||
const start = this.state.pos;
|
||||
let isFloat = false;
|
||||
let isBigInt = false;
|
||||
let isNonOctalDecimalInt = false;
|
||||
let isDecimal = false;
|
||||
let hasExponent = false;
|
||||
let isOctal = false;
|
||||
|
||||
if (!startsWithDot && this.readInt(10) === null) {
|
||||
this.raise(start, "Invalid number");
|
||||
this.raise(start, _error.Errors.InvalidNumber);
|
||||
}
|
||||
|
||||
let octal = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
||||
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
||||
|
||||
if (hasLeadingZero) {
|
||||
const integer = this.input.slice(start, this.state.pos);
|
||||
|
||||
if (octal) {
|
||||
if (this.state.strict) {
|
||||
this.raise(start, "Legacy octal literals are not allowed in strict mode");
|
||||
this.raise(start, _error.Errors.StrictOctalLiteral);
|
||||
} else {
|
||||
const underscorePos = integer.indexOf("_");
|
||||
|
||||
if (underscorePos > 0) {
|
||||
this.raise(underscorePos + start, _error.Errors.ZeroDigitNumericSeparator);
|
||||
}
|
||||
}
|
||||
|
||||
if (/[89]/.test(this.input.slice(start, this.state.pos))) {
|
||||
octal = false;
|
||||
isNonOctalDecimalInt = true;
|
||||
}
|
||||
isOctal = hasLeadingZero && !/[89]/.test(integer);
|
||||
}
|
||||
|
||||
let next = this.input.charCodeAt(this.state.pos);
|
||||
|
||||
if (next === 46 && !octal) {
|
||||
if (next === 46 && !isOctal) {
|
||||
++this.state.pos;
|
||||
this.readInt(10);
|
||||
isFloat = true;
|
||||
next = this.input.charCodeAt(this.state.pos);
|
||||
}
|
||||
|
||||
if ((next === 69 || next === 101) && !octal) {
|
||||
if ((next === 69 || next === 101) && !isOctal) {
|
||||
next = this.input.charCodeAt(++this.state.pos);
|
||||
|
||||
if (next === 43 || next === 45) {
|
||||
++this.state.pos;
|
||||
}
|
||||
|
||||
if (this.readInt(10) === null) this.raise(start, "Invalid number");
|
||||
if (this.readInt(10) === null) {
|
||||
this.raise(start, _error.Errors.InvalidOrMissingExponent);
|
||||
}
|
||||
|
||||
isFloat = true;
|
||||
hasExponent = true;
|
||||
next = this.input.charCodeAt(this.state.pos);
|
||||
}
|
||||
|
||||
if (this.hasPlugin("numericSeparator") && (octal || isNonOctalDecimalInt)) {
|
||||
const underscorePos = this.input.slice(start, this.state.pos).indexOf("_");
|
||||
|
||||
if (underscorePos > 0) {
|
||||
this.raise(underscorePos + start, "Numeric separator can not be used after leading 0");
|
||||
if (next === 110) {
|
||||
if (isFloat || hasLeadingZero) {
|
||||
this.raise(start, _error.Errors.InvalidBigIntLiteral);
|
||||
}
|
||||
|
||||
++this.state.pos;
|
||||
isBigInt = true;
|
||||
}
|
||||
|
||||
if (this.hasPlugin("bigInt")) {
|
||||
if (next === 110) {
|
||||
if (isFloat || octal || isNonOctalDecimalInt) {
|
||||
this.raise(start, "Invalid BigIntLiteral");
|
||||
}
|
||||
if (next === 109) {
|
||||
this.expectPlugin("decimal", this.state.pos);
|
||||
|
||||
++this.state.pos;
|
||||
isBigInt = true;
|
||||
if (hasExponent || hasLeadingZero) {
|
||||
this.raise(start, _error.Errors.InvalidDecimal);
|
||||
}
|
||||
|
||||
++this.state.pos;
|
||||
isDecimal = true;
|
||||
}
|
||||
|
||||
if ((0, _identifier.isIdentifierStart)(this.input.codePointAt(this.state.pos))) {
|
||||
throw this.raise(this.state.pos, "Identifier directly after number");
|
||||
throw this.raise(this.state.pos, _error.Errors.NumberIdentifier);
|
||||
}
|
||||
|
||||
const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
|
||||
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
||||
|
||||
if (isBigInt) {
|
||||
this.finishToken(_types2.types.bigint, str);
|
||||
return;
|
||||
}
|
||||
|
||||
const val = octal ? parseInt(str, 8) : parseFloat(str);
|
||||
if (isDecimal) {
|
||||
this.finishToken(_types2.types.decimal, str);
|
||||
return;
|
||||
}
|
||||
|
||||
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
||||
this.finishToken(_types2.types.num, val);
|
||||
}
|
||||
|
||||
@@ -894,7 +966,7 @@ class Tokenizer extends _location.default {
|
||||
|
||||
if (code !== null && code > 0x10ffff) {
|
||||
if (throwOnInvalid) {
|
||||
this.raise(codePos, "Code point out of bounds");
|
||||
this.raise(codePos, _error.Errors.InvalidCodePoint);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -912,7 +984,7 @@ class Tokenizer extends _location.default {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated string constant");
|
||||
throw this.raise(this.state.start, _error.Errors.UnterminatedString);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -927,7 +999,7 @@ class Tokenizer extends _location.default {
|
||||
++this.state.curLine;
|
||||
this.state.lineStart = this.state.pos;
|
||||
} else if ((0, _whitespace.isNewLine)(ch)) {
|
||||
throw this.raise(this.state.start, "Unterminated string constant");
|
||||
throw this.raise(this.state.start, _error.Errors.UnterminatedString);
|
||||
} else {
|
||||
++this.state.pos;
|
||||
}
|
||||
@@ -944,7 +1016,7 @@ class Tokenizer extends _location.default {
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, "Unterminated template");
|
||||
throw this.raise(this.state.start, _error.Errors.UnterminatedTemplate);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
@@ -1059,12 +1131,15 @@ class Tokenizer extends _location.default {
|
||||
case 57:
|
||||
if (inTemplate) {
|
||||
return null;
|
||||
} else if (this.state.strict) {
|
||||
this.raise(this.state.pos - 1, _error.Errors.StrictNumericEscape);
|
||||
}
|
||||
|
||||
default:
|
||||
if (ch >= 48 && ch <= 55) {
|
||||
const codePos = this.state.pos - 1;
|
||||
let octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0];
|
||||
const match = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/);
|
||||
let octalStr = match[0];
|
||||
let octal = parseInt(octalStr, 8);
|
||||
|
||||
if (octal > 255) {
|
||||
@@ -1079,10 +1154,9 @@ class Tokenizer extends _location.default {
|
||||
if (inTemplate) {
|
||||
return null;
|
||||
} else if (this.state.strict) {
|
||||
this.raise(codePos, "Octal literal in strict mode");
|
||||
} else if (!this.state.containsOctal) {
|
||||
this.state.containsOctal = true;
|
||||
this.state.octalPosition = codePos;
|
||||
this.raise(codePos, _error.Errors.StrictNumericEscape);
|
||||
} else {
|
||||
this.state.octalPositions.push(codePos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,7 +1173,7 @@ class Tokenizer extends _location.default {
|
||||
|
||||
if (n === null) {
|
||||
if (throwOnInvalid) {
|
||||
this.raise(codePos, "Bad character escape sequence");
|
||||
this.raise(codePos, _error.Errors.InvalidEscapeSequence);
|
||||
} else {
|
||||
this.state.pos = codePos - 1;
|
||||
}
|
||||
@@ -1128,7 +1202,7 @@ class Tokenizer extends _location.default {
|
||||
const identifierCheck = this.state.pos === start ? _identifier.isIdentifierStart : _identifier.isIdentifierChar;
|
||||
|
||||
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
||||
this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX");
|
||||
this.raise(this.state.pos, _error.Errors.MissingUnicodeEscape);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1137,7 +1211,7 @@ class Tokenizer extends _location.default {
|
||||
|
||||
if (esc !== null) {
|
||||
if (!identifierCheck(esc)) {
|
||||
this.raise(escStart, "Invalid Unicode escape");
|
||||
this.raise(escStart, _error.Errors.EscapedCharNotAnIdentifier);
|
||||
}
|
||||
|
||||
word += String.fromCodePoint(esc);
|
||||
@@ -1162,7 +1236,7 @@ class Tokenizer extends _location.default {
|
||||
const type = _types2.keywords.get(word) || _types2.types.name;
|
||||
|
||||
if (this.state.isIterator && (!this.isIterator(word) || !this.state.inType)) {
|
||||
this.raise(this.state.pos, `Invalid identifier ${word}`);
|
||||
this.raise(this.state.pos, _error.Errors.InvalidIdentifier, word);
|
||||
}
|
||||
|
||||
this.finishToken(type, word);
|
||||
@@ -1172,7 +1246,7 @@ class Tokenizer extends _location.default {
|
||||
const kw = this.state.type.keyword;
|
||||
|
||||
if (kw && this.state.containsEsc) {
|
||||
this.raise(this.state.start, `Escape sequence in keyword ${kw}`);
|
||||
this.raise(this.state.start, _error.Errors.InvalidEscapedReservedWord, kw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1188,7 +1262,7 @@ class Tokenizer extends _location.default {
|
||||
}
|
||||
|
||||
if (prevType === _types2.types._return || prevType === _types2.types.name && this.state.exprAllowed) {
|
||||
return _whitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
|
||||
return this.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
if (prevType === _types2.types._else || prevType === _types2.types.semi || prevType === _types2.types.eof || prevType === _types2.types.parenR || prevType === _types2.types.arrow) {
|
||||
|
||||
11
node_modules/@babel/parser/lib/tokenizer/state.js
generated
vendored
11
node_modules/@babel/parser/lib/tokenizer/state.js
generated
vendored
@@ -19,11 +19,14 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
||||
|
||||
class State {
|
||||
constructor() {
|
||||
this.strict = void 0;
|
||||
this.curLine = void 0;
|
||||
this.startLoc = void 0;
|
||||
this.endLoc = void 0;
|
||||
this.errors = [];
|
||||
this.potentialArrowAt = -1;
|
||||
this.noArrowAt = [];
|
||||
this.noArrowParamsConversionAt = [];
|
||||
this.inParameters = false;
|
||||
this.maybeInArrowParameters = false;
|
||||
this.inPipeline = false;
|
||||
this.inType = false;
|
||||
@@ -31,6 +34,7 @@ class State {
|
||||
this.inPropertyName = false;
|
||||
this.hasFlowComment = false;
|
||||
this.isIterator = false;
|
||||
this.isDeclareContext = false;
|
||||
this.topicContext = {
|
||||
maxNumOfResolvableTopics: 0,
|
||||
maxTopicIndex: null
|
||||
@@ -39,8 +43,6 @@ class State {
|
||||
this.inFSharpPipelineDirectBody = false;
|
||||
this.labels = [];
|
||||
this.decoratorStack = [[]];
|
||||
this.yieldPos = -1;
|
||||
this.awaitPos = -1;
|
||||
this.comments = [];
|
||||
this.trailingComments = [];
|
||||
this.leadingComments = [];
|
||||
@@ -59,8 +61,7 @@ class State {
|
||||
this.context = [_context.types.braceStatement];
|
||||
this.exprAllowed = true;
|
||||
this.containsEsc = false;
|
||||
this.containsOctal = false;
|
||||
this.octalPosition = null;
|
||||
this.octalPositions = [];
|
||||
this.exportedIdentifiers = [];
|
||||
this.tokensLength = 0;
|
||||
}
|
||||
|
||||
31
node_modules/@babel/parser/lib/tokenizer/types.js
generated
vendored
31
node_modules/@babel/parser/lib/tokenizer/types.js
generated
vendored
@@ -13,6 +13,17 @@ const postfix = true;
|
||||
|
||||
class TokenType {
|
||||
constructor(label, conf = {}) {
|
||||
this.label = void 0;
|
||||
this.keyword = void 0;
|
||||
this.beforeExpr = void 0;
|
||||
this.startsExpr = void 0;
|
||||
this.rightAssociative = void 0;
|
||||
this.isLoop = void 0;
|
||||
this.isAssign = void 0;
|
||||
this.prefix = void 0;
|
||||
this.postfix = void 0;
|
||||
this.binop = void 0;
|
||||
this.updateContext = void 0;
|
||||
this.label = label;
|
||||
this.keyword = conf.keyword;
|
||||
this.beforeExpr = !!conf.beforeExpr;
|
||||
@@ -53,6 +64,9 @@ const types = {
|
||||
bigint: new TokenType("bigint", {
|
||||
startsExpr
|
||||
}),
|
||||
decimal: new TokenType("decimal", {
|
||||
startsExpr
|
||||
}),
|
||||
regexp: new TokenType("regexp", {
|
||||
startsExpr
|
||||
}),
|
||||
@@ -67,7 +81,16 @@ const types = {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
bracketHashL: new TokenType("#[", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
bracketBarL: new TokenType("[|", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
bracketR: new TokenType("]"),
|
||||
bracketBarR: new TokenType("|]"),
|
||||
braceL: new TokenType("{", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
@@ -76,6 +99,10 @@ const types = {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
braceHashL: new TokenType("#{", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
braceR: new TokenType("}"),
|
||||
braceBarR: new TokenType("|}"),
|
||||
parenL: new TokenType("(", {
|
||||
@@ -163,7 +190,9 @@ const types = {
|
||||
binop: 10,
|
||||
startsExpr
|
||||
}),
|
||||
star: createBinop("*", 10),
|
||||
star: new TokenType("*", {
|
||||
binop: 10
|
||||
}),
|
||||
slash: createBinop("/", 10),
|
||||
exponent: new TokenType("**", {
|
||||
beforeExpr,
|
||||
|
||||
12
node_modules/@babel/parser/lib/util/class-scope.js
generated
vendored
12
node_modules/@babel/parser/lib/util/class-scope.js
generated
vendored
@@ -7,6 +7,8 @@ exports.default = exports.ClassScope = void 0;
|
||||
|
||||
var _scopeflags = require("./scopeflags");
|
||||
|
||||
var _error = require("../parser/error");
|
||||
|
||||
class ClassScope {
|
||||
constructor() {
|
||||
this.privateNames = new Set();
|
||||
@@ -45,7 +47,7 @@ class ClassScopeHandler {
|
||||
current.undefinedPrivateNames.set(name, pos);
|
||||
}
|
||||
} else {
|
||||
this.raiseUndeclaredPrivateName(name, pos);
|
||||
this.raise(pos, _error.Errors.InvalidPrivateFieldResolution, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +72,7 @@ class ClassScopeHandler {
|
||||
}
|
||||
|
||||
if (redefined) {
|
||||
this.raise(pos, `Duplicate private name #${name}`);
|
||||
this.raise(pos, _error.Errors.PrivateNameRedeclaration, name);
|
||||
}
|
||||
|
||||
classScope.privateNames.add(name);
|
||||
@@ -88,14 +90,10 @@ class ClassScopeHandler {
|
||||
if (classScope) {
|
||||
classScope.undefinedPrivateNames.set(name, pos);
|
||||
} else {
|
||||
this.raiseUndeclaredPrivateName(name, pos);
|
||||
this.raise(pos, _error.Errors.InvalidPrivateFieldResolution, name);
|
||||
}
|
||||
}
|
||||
|
||||
raiseUndeclaredPrivateName(name, pos) {
|
||||
this.raise(pos, `Private name #${name} is not defined`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ClassScopeHandler;
|
||||
138
node_modules/@babel/parser/lib/util/expression-scope.js
generated
vendored
Normal file
138
node_modules/@babel/parser/lib/util/expression-scope.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.newParameterDeclarationScope = newParameterDeclarationScope;
|
||||
exports.newArrowHeadScope = newArrowHeadScope;
|
||||
exports.newAsyncArrowScope = newAsyncArrowScope;
|
||||
exports.newExpressionScope = newExpressionScope;
|
||||
exports.default = void 0;
|
||||
const kExpression = 0,
|
||||
kMaybeArrowParameterDeclaration = 1,
|
||||
kMaybeAsyncArrowParameterDeclaration = 2,
|
||||
kParameterDeclaration = 3;
|
||||
|
||||
class ExpressionScope {
|
||||
constructor(type = kExpression) {
|
||||
this.type = void 0;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
canBeArrowParameterDeclaration() {
|
||||
return this.type === kMaybeAsyncArrowParameterDeclaration || this.type === kMaybeArrowParameterDeclaration;
|
||||
}
|
||||
|
||||
isCertainlyParameterDeclaration() {
|
||||
return this.type === kParameterDeclaration;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ArrowHeadParsingScope extends ExpressionScope {
|
||||
constructor(type) {
|
||||
super(type);
|
||||
this.errors = new Map();
|
||||
}
|
||||
|
||||
recordDeclarationError(pos, message) {
|
||||
this.errors.set(pos, message);
|
||||
}
|
||||
|
||||
clearDeclarationError(pos) {
|
||||
this.errors.delete(pos);
|
||||
}
|
||||
|
||||
iterateErrors(iterator) {
|
||||
this.errors.forEach(iterator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ExpressionScopeHandler {
|
||||
constructor(raise) {
|
||||
this.stack = [new ExpressionScope()];
|
||||
this.raise = raise;
|
||||
}
|
||||
|
||||
enter(scope) {
|
||||
this.stack.push(scope);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.stack.pop();
|
||||
}
|
||||
|
||||
recordParameterInitializerError(pos, message) {
|
||||
const {
|
||||
stack
|
||||
} = this;
|
||||
let i = stack.length - 1;
|
||||
let scope = stack[i];
|
||||
|
||||
while (!scope.isCertainlyParameterDeclaration()) {
|
||||
if (scope.canBeArrowParameterDeclaration()) {
|
||||
scope.recordDeclarationError(pos, message);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
scope = stack[--i];
|
||||
}
|
||||
|
||||
this.raise(pos, message);
|
||||
}
|
||||
|
||||
recordAsyncArrowParametersError(pos, message) {
|
||||
const {
|
||||
stack
|
||||
} = this;
|
||||
let i = stack.length - 1;
|
||||
let scope = stack[i];
|
||||
|
||||
while (scope.canBeArrowParameterDeclaration()) {
|
||||
if (scope.type === kMaybeAsyncArrowParameterDeclaration) {
|
||||
scope.recordDeclarationError(pos, message);
|
||||
}
|
||||
|
||||
scope = stack[--i];
|
||||
}
|
||||
}
|
||||
|
||||
validateAsPattern() {
|
||||
const {
|
||||
stack
|
||||
} = this;
|
||||
const currentScope = stack[stack.length - 1];
|
||||
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
||||
currentScope.iterateErrors((message, pos) => {
|
||||
this.raise(pos, message);
|
||||
let i = stack.length - 2;
|
||||
let scope = stack[i];
|
||||
|
||||
while (scope.canBeArrowParameterDeclaration()) {
|
||||
scope.clearDeclarationError(pos);
|
||||
scope = stack[--i];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ExpressionScopeHandler;
|
||||
|
||||
function newParameterDeclarationScope() {
|
||||
return new ExpressionScope(kParameterDeclaration);
|
||||
}
|
||||
|
||||
function newArrowHeadScope() {
|
||||
return new ArrowHeadParsingScope(kMaybeArrowParameterDeclaration);
|
||||
}
|
||||
|
||||
function newAsyncArrowScope() {
|
||||
return new ArrowHeadParsingScope(kMaybeAsyncArrowParameterDeclaration);
|
||||
}
|
||||
|
||||
function newExpressionScope() {
|
||||
return new ExpressionScope();
|
||||
}
|
||||
129
node_modules/@babel/parser/lib/util/identifier.js
generated
vendored
129
node_modules/@babel/parser/lib/util/identifier.js
generated
vendored
@@ -3,97 +3,56 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isStrictReservedWord = isStrictReservedWord;
|
||||
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
||||
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
||||
exports.isKeyword = isKeyword;
|
||||
exports.isIdentifierStart = isIdentifierStart;
|
||||
exports.isIteratorStart = isIteratorStart;
|
||||
exports.isIdentifierChar = isIdentifierChar;
|
||||
exports.keywordRelationalOperator = exports.isReservedWord = void 0;
|
||||
Object.defineProperty(exports, "isIdentifierStart", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isIdentifierStart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierChar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isIdentifierChar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isStrictBindOnlyReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isStrictBindReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isStrictReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isKeyword", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isKeyword;
|
||||
}
|
||||
});
|
||||
exports.keywordRelationalOperator = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
const reservedWords = {
|
||||
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
||||
strictBind: ["eval", "arguments"]
|
||||
};
|
||||
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
||||
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
||||
|
||||
const isReservedWord = (word, inModule) => {
|
||||
return inModule && word === "await" || word === "enum";
|
||||
};
|
||||
|
||||
exports.isReservedWord = isReservedWord;
|
||||
|
||||
function isStrictReservedWord(word, inModule) {
|
||||
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
||||
}
|
||||
|
||||
function isStrictBindOnlyReservedWord(word) {
|
||||
return reservedWordsStrictBindSet.has(word);
|
||||
}
|
||||
|
||||
function isStrictBindReservedWord(word, inModule) {
|
||||
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
||||
}
|
||||
|
||||
function isKeyword(word) {
|
||||
return _types.keywords.has(word);
|
||||
}
|
||||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||
|
||||
const keywordRelationalOperator = /^in(stanceof)?$/;
|
||||
exports.keywordRelationalOperator = keywordRelationalOperator;
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 477, 28, 11, 0, 9, 21, 155, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 12, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 0, 33, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 0, 161, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 270, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 754, 9486, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541];
|
||||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 525, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 232, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 792487, 239];
|
||||
|
||||
function isInAstralSet(code, set) {
|
||||
let pos = 0x10000;
|
||||
|
||||
for (let i = 0, length = set.length; i < length; i += 2) {
|
||||
pos += set[i];
|
||||
if (pos > code) return false;
|
||||
pos += set[i + 1];
|
||||
if (pos >= code) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isIdentifierStart(code) {
|
||||
if (code < 65) return code === 36;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||||
}
|
||||
|
||||
return isInAstralSet(code, astralIdentifierStartCodes);
|
||||
}
|
||||
|
||||
function isIteratorStart(current, next) {
|
||||
return current === 64 && next === 64;
|
||||
}
|
||||
|
||||
function isIdentifierChar(code) {
|
||||
if (code < 48) return code === 36;
|
||||
if (code < 58) return true;
|
||||
if (code < 65) return false;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||||
}
|
||||
|
||||
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
||||
}
|
||||
6
node_modules/@babel/parser/lib/util/location.js
generated
vendored
6
node_modules/@babel/parser/lib/util/location.js
generated
vendored
@@ -10,6 +10,8 @@ var _whitespace = require("./whitespace");
|
||||
|
||||
class Position {
|
||||
constructor(line, col) {
|
||||
this.line = void 0;
|
||||
this.column = void 0;
|
||||
this.line = line;
|
||||
this.column = col;
|
||||
}
|
||||
@@ -20,6 +22,10 @@ exports.Position = Position;
|
||||
|
||||
class SourceLocation {
|
||||
constructor(start, end) {
|
||||
this.start = void 0;
|
||||
this.end = void 0;
|
||||
this.filename = void 0;
|
||||
this.identifierName = void 0;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
58
node_modules/@babel/parser/lib/util/production-parameter.js
generated
vendored
Normal file
58
node_modules/@babel/parser/lib/util/production-parameter.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.functionFlags = functionFlags;
|
||||
exports.default = exports.PARAM_IN = exports.PARAM_RETURN = exports.PARAM_AWAIT = exports.PARAM_YIELD = exports.PARAM = void 0;
|
||||
const PARAM = 0b0000,
|
||||
PARAM_YIELD = 0b0001,
|
||||
PARAM_AWAIT = 0b0010,
|
||||
PARAM_RETURN = 0b0100,
|
||||
PARAM_IN = 0b1000;
|
||||
exports.PARAM_IN = PARAM_IN;
|
||||
exports.PARAM_RETURN = PARAM_RETURN;
|
||||
exports.PARAM_AWAIT = PARAM_AWAIT;
|
||||
exports.PARAM_YIELD = PARAM_YIELD;
|
||||
exports.PARAM = PARAM;
|
||||
|
||||
class ProductionParameterHandler {
|
||||
constructor() {
|
||||
this.stacks = [];
|
||||
}
|
||||
|
||||
enter(flags) {
|
||||
this.stacks.push(flags);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.stacks.pop();
|
||||
}
|
||||
|
||||
currentFlags() {
|
||||
return this.stacks[this.stacks.length - 1];
|
||||
}
|
||||
|
||||
get hasAwait() {
|
||||
return (this.currentFlags() & PARAM_AWAIT) > 0;
|
||||
}
|
||||
|
||||
get hasYield() {
|
||||
return (this.currentFlags() & PARAM_YIELD) > 0;
|
||||
}
|
||||
|
||||
get hasReturn() {
|
||||
return (this.currentFlags() & PARAM_RETURN) > 0;
|
||||
}
|
||||
|
||||
get hasIn() {
|
||||
return (this.currentFlags() & PARAM_IN) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ProductionParameterHandler;
|
||||
|
||||
function functionFlags(isAsync, isGenerator) {
|
||||
return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);
|
||||
}
|
||||
23
node_modules/@babel/parser/lib/util/scope.js
generated
vendored
23
node_modules/@babel/parser/lib/util/scope.js
generated
vendored
@@ -9,12 +9,15 @@ var _scopeflags = require("./scopeflags");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
var _error = require("../parser/error");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
class Scope {
|
||||
constructor(flags) {
|
||||
this.flags = void 0;
|
||||
this.var = [];
|
||||
this.lexical = [];
|
||||
this.functions = [];
|
||||
@@ -38,24 +41,6 @@ class ScopeHandler {
|
||||
return (this.currentVarScope().flags & _scopeflags.SCOPE_FUNCTION) > 0;
|
||||
}
|
||||
|
||||
get inGenerator() {
|
||||
return (this.currentVarScope().flags & _scopeflags.SCOPE_GENERATOR) > 0;
|
||||
}
|
||||
|
||||
get inAsync() {
|
||||
for (let i = this.scopeStack.length - 1;; i--) {
|
||||
const scope = this.scopeStack[i];
|
||||
const isVarScope = scope.flags & _scopeflags.SCOPE_VAR;
|
||||
const isClassScope = scope.flags & _scopeflags.SCOPE_CLASS;
|
||||
|
||||
if (isClassScope && !isVarScope) {
|
||||
return false;
|
||||
} else if (isVarScope) {
|
||||
return (scope.flags & _scopeflags.SCOPE_ASYNC) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get allowSuper() {
|
||||
return (this.currentThisScope().flags & _scopeflags.SCOPE_SUPER) > 0;
|
||||
}
|
||||
@@ -130,7 +115,7 @@ class ScopeHandler {
|
||||
|
||||
checkRedeclarationInScope(scope, name, bindingType, pos) {
|
||||
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
||||
this.raise(pos, `Identifier '${name}' has already been declared`);
|
||||
this.raise(pos, _error.Errors.VarRedeclaration, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
58
node_modules/@babel/parser/lib/util/scopeflags.js
generated
vendored
58
node_modules/@babel/parser/lib/util/scopeflags.js
generated
vendored
@@ -3,19 +3,16 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.functionFlags = functionFlags;
|
||||
exports.CLASS_ELEMENT_OTHER = exports.CLASS_ELEMENT_INSTANCE_SETTER = exports.CLASS_ELEMENT_INSTANCE_GETTER = exports.CLASS_ELEMENT_STATIC_SETTER = exports.CLASS_ELEMENT_STATIC_GETTER = exports.CLASS_ELEMENT_KIND_ACCESSOR = exports.CLASS_ELEMENT_KIND_SETTER = exports.CLASS_ELEMENT_KIND_GETTER = exports.CLASS_ELEMENT_FLAG_STATIC = exports.BIND_TS_NAMESPACE = exports.BIND_TS_CONST_ENUM = exports.BIND_OUTSIDE = exports.BIND_NONE = exports.BIND_TS_AMBIENT = exports.BIND_TS_ENUM = exports.BIND_TS_TYPE = exports.BIND_TS_INTERFACE = exports.BIND_FUNCTION = exports.BIND_VAR = exports.BIND_LEXICAL = exports.BIND_CLASS = exports.BIND_FLAGS_TS_EXPORT_ONLY = exports.BIND_FLAGS_TS_CONST_ENUM = exports.BIND_FLAGS_TS_ENUM = exports.BIND_FLAGS_CLASS = exports.BIND_FLAGS_NONE = exports.BIND_SCOPE_OUTSIDE = exports.BIND_SCOPE_FUNCTION = exports.BIND_SCOPE_LEXICAL = exports.BIND_SCOPE_VAR = exports.BIND_KIND_TYPE = exports.BIND_KIND_VALUE = exports.SCOPE_VAR = exports.SCOPE_TS_MODULE = exports.SCOPE_CLASS = exports.SCOPE_DIRECT_SUPER = exports.SCOPE_SUPER = exports.SCOPE_SIMPLE_CATCH = exports.SCOPE_ARROW = exports.SCOPE_GENERATOR = exports.SCOPE_ASYNC = exports.SCOPE_FUNCTION = exports.SCOPE_PROGRAM = exports.SCOPE_OTHER = void 0;
|
||||
const SCOPE_OTHER = 0b0000000000,
|
||||
SCOPE_PROGRAM = 0b0000000001,
|
||||
SCOPE_FUNCTION = 0b0000000010,
|
||||
SCOPE_ASYNC = 0b0000000100,
|
||||
SCOPE_GENERATOR = 0b0000001000,
|
||||
SCOPE_ARROW = 0b0000010000,
|
||||
SCOPE_SIMPLE_CATCH = 0b0000100000,
|
||||
SCOPE_SUPER = 0b0001000000,
|
||||
SCOPE_DIRECT_SUPER = 0b0010000000,
|
||||
SCOPE_CLASS = 0b0100000000,
|
||||
SCOPE_TS_MODULE = 0b1000000000,
|
||||
exports.CLASS_ELEMENT_OTHER = exports.CLASS_ELEMENT_INSTANCE_SETTER = exports.CLASS_ELEMENT_INSTANCE_GETTER = exports.CLASS_ELEMENT_STATIC_SETTER = exports.CLASS_ELEMENT_STATIC_GETTER = exports.CLASS_ELEMENT_KIND_ACCESSOR = exports.CLASS_ELEMENT_KIND_SETTER = exports.CLASS_ELEMENT_KIND_GETTER = exports.CLASS_ELEMENT_FLAG_STATIC = exports.BIND_TS_NAMESPACE = exports.BIND_TS_CONST_ENUM = exports.BIND_OUTSIDE = exports.BIND_NONE = exports.BIND_TS_AMBIENT = exports.BIND_TS_ENUM = exports.BIND_TS_TYPE = exports.BIND_TS_INTERFACE = exports.BIND_FUNCTION = exports.BIND_VAR = exports.BIND_LEXICAL = exports.BIND_CLASS = exports.BIND_FLAGS_TS_EXPORT_ONLY = exports.BIND_FLAGS_TS_CONST_ENUM = exports.BIND_FLAGS_TS_ENUM = exports.BIND_FLAGS_CLASS = exports.BIND_FLAGS_NONE = exports.BIND_SCOPE_OUTSIDE = exports.BIND_SCOPE_FUNCTION = exports.BIND_SCOPE_LEXICAL = exports.BIND_SCOPE_VAR = exports.BIND_KIND_TYPE = exports.BIND_KIND_VALUE = exports.SCOPE_VAR = exports.SCOPE_TS_MODULE = exports.SCOPE_CLASS = exports.SCOPE_DIRECT_SUPER = exports.SCOPE_SUPER = exports.SCOPE_SIMPLE_CATCH = exports.SCOPE_ARROW = exports.SCOPE_FUNCTION = exports.SCOPE_PROGRAM = exports.SCOPE_OTHER = void 0;
|
||||
const SCOPE_OTHER = 0b00000000,
|
||||
SCOPE_PROGRAM = 0b00000001,
|
||||
SCOPE_FUNCTION = 0b00000010,
|
||||
SCOPE_ARROW = 0b00000100,
|
||||
SCOPE_SIMPLE_CATCH = 0b00001000,
|
||||
SCOPE_SUPER = 0b00010000,
|
||||
SCOPE_DIRECT_SUPER = 0b00100000,
|
||||
SCOPE_CLASS = 0b01000000,
|
||||
SCOPE_TS_MODULE = 0b10000000,
|
||||
SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE;
|
||||
exports.SCOPE_VAR = SCOPE_VAR;
|
||||
exports.SCOPE_TS_MODULE = SCOPE_TS_MODULE;
|
||||
@@ -24,27 +21,20 @@ exports.SCOPE_DIRECT_SUPER = SCOPE_DIRECT_SUPER;
|
||||
exports.SCOPE_SUPER = SCOPE_SUPER;
|
||||
exports.SCOPE_SIMPLE_CATCH = SCOPE_SIMPLE_CATCH;
|
||||
exports.SCOPE_ARROW = SCOPE_ARROW;
|
||||
exports.SCOPE_GENERATOR = SCOPE_GENERATOR;
|
||||
exports.SCOPE_ASYNC = SCOPE_ASYNC;
|
||||
exports.SCOPE_FUNCTION = SCOPE_FUNCTION;
|
||||
exports.SCOPE_PROGRAM = SCOPE_PROGRAM;
|
||||
exports.SCOPE_OTHER = SCOPE_OTHER;
|
||||
|
||||
function functionFlags(isAsync, isGenerator) {
|
||||
return SCOPE_FUNCTION | (isAsync ? SCOPE_ASYNC : 0) | (isGenerator ? SCOPE_GENERATOR : 0);
|
||||
}
|
||||
|
||||
const BIND_KIND_VALUE = 0b00000000001,
|
||||
BIND_KIND_TYPE = 0b00000000010,
|
||||
BIND_SCOPE_VAR = 0b00000000100,
|
||||
BIND_SCOPE_LEXICAL = 0b00000001000,
|
||||
BIND_SCOPE_FUNCTION = 0b00000010000,
|
||||
BIND_SCOPE_OUTSIDE = 0b00000100000,
|
||||
BIND_FLAGS_NONE = 0b00001000000,
|
||||
BIND_FLAGS_CLASS = 0b00010000000,
|
||||
BIND_FLAGS_TS_ENUM = 0b00100000000,
|
||||
BIND_FLAGS_TS_CONST_ENUM = 0b01000000000,
|
||||
BIND_FLAGS_TS_EXPORT_ONLY = 0b10000000000;
|
||||
const BIND_KIND_VALUE = 0b00000_0000_01,
|
||||
BIND_KIND_TYPE = 0b00000_0000_10,
|
||||
BIND_SCOPE_VAR = 0b00000_0001_00,
|
||||
BIND_SCOPE_LEXICAL = 0b00000_0010_00,
|
||||
BIND_SCOPE_FUNCTION = 0b00000_0100_00,
|
||||
BIND_SCOPE_OUTSIDE = 0b00000_1000_00,
|
||||
BIND_FLAGS_NONE = 0b00001_0000_00,
|
||||
BIND_FLAGS_CLASS = 0b00010_0000_00,
|
||||
BIND_FLAGS_TS_ENUM = 0b00100_0000_00,
|
||||
BIND_FLAGS_TS_CONST_ENUM = 0b01000_0000_00,
|
||||
BIND_FLAGS_TS_EXPORT_ONLY = 0b10000_0000_00;
|
||||
exports.BIND_FLAGS_TS_EXPORT_ONLY = BIND_FLAGS_TS_EXPORT_ONLY;
|
||||
exports.BIND_FLAGS_TS_CONST_ENUM = BIND_FLAGS_TS_CONST_ENUM;
|
||||
exports.BIND_FLAGS_TS_ENUM = BIND_FLAGS_TS_ENUM;
|
||||
@@ -80,9 +70,9 @@ exports.BIND_FUNCTION = BIND_FUNCTION;
|
||||
exports.BIND_VAR = BIND_VAR;
|
||||
exports.BIND_LEXICAL = BIND_LEXICAL;
|
||||
exports.BIND_CLASS = BIND_CLASS;
|
||||
const CLASS_ELEMENT_FLAG_STATIC = 0b100,
|
||||
CLASS_ELEMENT_KIND_GETTER = 0b010,
|
||||
CLASS_ELEMENT_KIND_SETTER = 0b001,
|
||||
const CLASS_ELEMENT_FLAG_STATIC = 0b1_00,
|
||||
CLASS_ELEMENT_KIND_GETTER = 0b0_10,
|
||||
CLASS_ELEMENT_KIND_SETTER = 0b0_01,
|
||||
CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
|
||||
exports.CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_ACCESSOR;
|
||||
exports.CLASS_ELEMENT_KIND_SETTER = CLASS_ELEMENT_KIND_SETTER;
|
||||
|
||||
40
node_modules/@babel/parser/package.json
generated
vendored
40
node_modules/@babel/parser/package.json
generated
vendored
@@ -1,33 +1,32 @@
|
||||
{
|
||||
"_from": "@babel/parser@^7.8.4",
|
||||
"_id": "@babel/parser@7.8.4",
|
||||
"_from": "@babel/parser@^7.12.3",
|
||||
"_id": "@babel/parser@7.12.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==",
|
||||
"_integrity": "sha512-FVM6RZQ0mn2KCf1VUED7KepYeUWoVShczewOCfm3nzoBybaih51h+sYVVGthW9M6lPByEPTQf+xm27PBdlpwmQ==",
|
||||
"_location": "/@babel/parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/parser@^7.8.4",
|
||||
"raw": "@babel/parser@^7.12.3",
|
||||
"name": "@babel/parser",
|
||||
"escapedName": "@babel%2fparser",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.8.4",
|
||||
"rawSpec": "^7.12.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.8.4"
|
||||
"fetchSpec": "^7.12.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core",
|
||||
"/@babel/template",
|
||||
"/@babel/traverse",
|
||||
"/@types/babel__core",
|
||||
"/@types/babel__template",
|
||||
"/istanbul-lib-instrument"
|
||||
"/@types/babel__template"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.4.tgz",
|
||||
"_shasum": "d1dbe64691d60358a974295fa53da074dd2ce8e8",
|
||||
"_spec": "@babel/parser@^7.8.4",
|
||||
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@babel/core",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.5.tgz",
|
||||
"_shasum": "b4af32ddd473c0bfa643bd7ff0728b8e71b81ea0",
|
||||
"_spec": "@babel/parser@^7.12.3",
|
||||
"_where": "/home/codespace/workspace/upload-google-play/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
@@ -35,14 +34,17 @@
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A JavaScript parser",
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "^7.8.3",
|
||||
"@babel/helper-fixtures": "^7.8.3",
|
||||
"charcodes": "^0.2.0",
|
||||
"unicode-12.0.0": "^0.7.9"
|
||||
"@babel/code-frame": "7.10.4",
|
||||
"@babel/helper-fixtures": "7.10.5",
|
||||
"@babel/helper-validator-identifier": "7.10.4",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
@@ -52,7 +54,6 @@
|
||||
"lib",
|
||||
"typings"
|
||||
],
|
||||
"gitHead": "5c2e6bc07fed3d28801d93168622c99ae622653a",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"keywords": [
|
||||
"babel",
|
||||
@@ -70,8 +71,9 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-parser"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-parser"
|
||||
},
|
||||
"types": "typings/babel-parser.d.ts",
|
||||
"version": "7.8.4"
|
||||
"version": "7.12.5"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user