@next-core/brick-utils 2.43.1 → 2.43.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.bundle.js +1547 -1329
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +1547 -1329
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
- package/CHANGELOG.md +0 -2158
package/dist/index.esm.js
CHANGED
|
@@ -492,7 +492,7 @@ function createProviderClass(api) {
|
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
|
|
495
|
+
/******************************************************************************
|
|
496
496
|
Copyright (c) Microsoft Corporation.
|
|
497
497
|
|
|
498
498
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -3120,10 +3120,10 @@ function createPositionWithColumnOffset(position, columnOffset) {
|
|
|
3120
3120
|
return new Position(line, column + columnOffset, index + columnOffset);
|
|
3121
3121
|
}
|
|
3122
3122
|
|
|
3123
|
-
var
|
|
3123
|
+
var ParseErrorCode = {
|
|
3124
3124
|
SyntaxError: "BABEL_PARSER_SYNTAX_ERROR",
|
|
3125
3125
|
SourceTypeModuleError: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
|
|
3126
|
-
}
|
|
3126
|
+
};
|
|
3127
3127
|
|
|
3128
3128
|
var reflect = function (keys) {
|
|
3129
3129
|
var last = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keys.length - 1;
|
|
@@ -3139,42 +3139,47 @@ var reflect = function (keys) {
|
|
|
3139
3139
|
};
|
|
3140
3140
|
};
|
|
3141
3141
|
|
|
3142
|
-
var instantiate = (constructor, properties, descriptors) => Object.keys(descriptors).map(key => [key, descriptors[key]]).filter(
|
|
3143
|
-
var [, descriptor] =
|
|
3142
|
+
var instantiate = (constructor, properties, descriptors) => Object.keys(descriptors).map(key => [key, descriptors[key]]).filter(_ref3 => {
|
|
3143
|
+
var [, descriptor] = _ref3;
|
|
3144
3144
|
return !!descriptor;
|
|
3145
|
-
}).map(
|
|
3146
|
-
var [key, descriptor] =
|
|
3145
|
+
}).map(_ref4 => {
|
|
3146
|
+
var [key, descriptor] = _ref4;
|
|
3147
3147
|
return [key, typeof descriptor === "function" ? {
|
|
3148
3148
|
value: descriptor,
|
|
3149
3149
|
enumerable: false
|
|
3150
3150
|
} : typeof descriptor.reflect === "string" ? Object.assign({}, descriptor, reflect(descriptor.reflect.split("."))) : descriptor];
|
|
3151
|
-
}).reduce((instance,
|
|
3152
|
-
var [key, descriptor] =
|
|
3151
|
+
}).reduce((instance, _ref5) => {
|
|
3152
|
+
var [key, descriptor] = _ref5;
|
|
3153
3153
|
return Object.defineProperty(instance, key, Object.assign({
|
|
3154
3154
|
configurable: true
|
|
3155
3155
|
}, descriptor));
|
|
3156
3156
|
}, Object.assign(new constructor(), properties));
|
|
3157
3157
|
|
|
3158
|
-
var ModuleErrors =
|
|
3159
|
-
ImportMetaOutsideModule:
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3158
|
+
var ModuleErrors = {
|
|
3159
|
+
ImportMetaOutsideModule: {
|
|
3160
|
+
message: "import.meta may appear only with 'sourceType: \"module\"'",
|
|
3161
|
+
code: ParseErrorCode.SourceTypeModuleError
|
|
3162
|
+
},
|
|
3163
|
+
ImportOutsideModule: {
|
|
3164
|
+
message: "'import' and 'export' may appear only with 'sourceType: \"module\"'",
|
|
3165
|
+
code: ParseErrorCode.SourceTypeModuleError
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3167
3168
|
var NodeDescriptions = {
|
|
3168
3169
|
ArrayPattern: "array destructuring pattern",
|
|
3169
3170
|
AssignmentExpression: "assignment expression",
|
|
3170
3171
|
AssignmentPattern: "assignment expression",
|
|
3171
3172
|
ArrowFunctionExpression: "arrow function expression",
|
|
3172
3173
|
ConditionalExpression: "conditional expression",
|
|
3174
|
+
CatchClause: "catch clause",
|
|
3173
3175
|
ForOfStatement: "for-of statement",
|
|
3174
3176
|
ForInStatement: "for-in statement",
|
|
3175
3177
|
ForStatement: "for-loop",
|
|
3176
3178
|
FormalParameters: "function parameter list",
|
|
3177
3179
|
Identifier: "identifier",
|
|
3180
|
+
ImportSpecifier: "import specifier",
|
|
3181
|
+
ImportDefaultSpecifier: "import default specifier",
|
|
3182
|
+
ImportNamespaceSpecifier: "import namespace specifier",
|
|
3178
3183
|
ObjectPattern: "object destructuring pattern",
|
|
3179
3184
|
ParenthesizedExpression: "parenthesized expression",
|
|
3180
3185
|
RestElement: "rest element",
|
|
@@ -3186,349 +3191,347 @@ var NodeDescriptions = {
|
|
|
3186
3191
|
YieldExpression: "yield expression"
|
|
3187
3192
|
};
|
|
3188
3193
|
|
|
3189
|
-
var toNodeDescription =
|
|
3194
|
+
var toNodeDescription = _ref6 => {
|
|
3190
3195
|
var {
|
|
3191
3196
|
type,
|
|
3192
3197
|
prefix
|
|
3193
|
-
} =
|
|
3198
|
+
} = _ref6;
|
|
3194
3199
|
return type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];
|
|
3195
3200
|
};
|
|
3196
3201
|
|
|
3197
|
-
var StandardErrors =
|
|
3198
|
-
AccessorIsGenerator:
|
|
3202
|
+
var StandardErrors = {
|
|
3203
|
+
AccessorIsGenerator: _ref7 => {
|
|
3199
3204
|
var {
|
|
3200
3205
|
kind
|
|
3201
|
-
} =
|
|
3206
|
+
} = _ref7;
|
|
3202
3207
|
return "A ".concat(kind, "ter cannot be a generator.");
|
|
3203
|
-
}
|
|
3204
|
-
ArgumentsInClass:
|
|
3205
|
-
AsyncFunctionInSingleStatementContext:
|
|
3206
|
-
AwaitBindingIdentifier:
|
|
3207
|
-
AwaitBindingIdentifierInStaticBlock:
|
|
3208
|
-
AwaitExpressionFormalParameter:
|
|
3209
|
-
AwaitNotInAsyncContext:
|
|
3210
|
-
AwaitNotInAsyncFunction:
|
|
3211
|
-
BadGetterArity:
|
|
3212
|
-
BadSetterArity:
|
|
3213
|
-
BadSetterRestParameter:
|
|
3214
|
-
ConstructorClassField:
|
|
3215
|
-
ConstructorClassPrivateField:
|
|
3216
|
-
ConstructorIsAccessor:
|
|
3217
|
-
ConstructorIsAsync:
|
|
3218
|
-
ConstructorIsGenerator:
|
|
3219
|
-
DeclarationMissingInitializer:
|
|
3208
|
+
},
|
|
3209
|
+
ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
|
|
3210
|
+
AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
|
|
3211
|
+
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
|
|
3212
|
+
AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
|
|
3213
|
+
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
3214
|
+
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
3215
|
+
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
|
|
3216
|
+
BadGetterArity: "A 'get' accesor must not have any formal parameters.",
|
|
3217
|
+
BadSetterArity: "A 'set' accesor must have exactly one formal parameter.",
|
|
3218
|
+
BadSetterRestParameter: "A 'set' accesor function argument must not be a rest parameter.",
|
|
3219
|
+
ConstructorClassField: "Classes may not have a field named 'constructor'.",
|
|
3220
|
+
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
|
|
3221
|
+
ConstructorIsAccessor: "Class constructor may not be an accessor.",
|
|
3222
|
+
ConstructorIsAsync: "Constructor can't be an async function.",
|
|
3223
|
+
ConstructorIsGenerator: "Constructor can't be a generator.",
|
|
3224
|
+
DeclarationMissingInitializer: _ref8 => {
|
|
3220
3225
|
var {
|
|
3221
3226
|
kind
|
|
3222
|
-
} =
|
|
3227
|
+
} = _ref8;
|
|
3223
3228
|
return "Missing initializer in ".concat(kind, " declaration.");
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3229
|
+
},
|
|
3230
|
+
DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
|
|
3231
|
+
DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax.",
|
|
3232
|
+
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
|
3233
|
+
DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.",
|
|
3234
|
+
DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
|
|
3235
|
+
DecoratorStaticBlock: "Decorators can't be used with a static block.",
|
|
3236
|
+
DeletePrivateField: "Deleting a private field is not allowed.",
|
|
3237
|
+
DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
|
|
3238
|
+
DuplicateConstructor: "Duplicate constructor in the same class.",
|
|
3239
|
+
DuplicateDefaultExport: "Only one default export allowed per module.",
|
|
3240
|
+
DuplicateExport: _ref9 => {
|
|
3235
3241
|
var {
|
|
3236
3242
|
exportName
|
|
3237
|
-
} =
|
|
3243
|
+
} = _ref9;
|
|
3238
3244
|
return "`".concat(exportName, "` has already been exported. Exported identifiers must be unique.");
|
|
3239
|
-
}
|
|
3240
|
-
DuplicateProto:
|
|
3241
|
-
DuplicateRegExpFlags:
|
|
3242
|
-
ElementAfterRest:
|
|
3243
|
-
EscapedCharNotAnIdentifier:
|
|
3244
|
-
ExportBindingIsString:
|
|
3245
|
+
},
|
|
3246
|
+
DuplicateProto: "Redefinition of __proto__ property.",
|
|
3247
|
+
DuplicateRegExpFlags: "Duplicate regular expression flag.",
|
|
3248
|
+
ElementAfterRest: "Rest element must be last element.",
|
|
3249
|
+
EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
|
|
3250
|
+
ExportBindingIsString: _ref10 => {
|
|
3245
3251
|
var {
|
|
3246
3252
|
localName,
|
|
3247
3253
|
exportName
|
|
3248
|
-
} =
|
|
3254
|
+
} = _ref10;
|
|
3249
3255
|
return "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '".concat(localName, "' as '").concat(exportName, "' } from 'some-module'`?");
|
|
3250
|
-
}
|
|
3251
|
-
ExportDefaultFromAsIdentifier:
|
|
3252
|
-
ForInOfLoopInitializer:
|
|
3256
|
+
},
|
|
3257
|
+
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
|
|
3258
|
+
ForInOfLoopInitializer: _ref11 => {
|
|
3253
3259
|
var {
|
|
3254
3260
|
type
|
|
3255
|
-
} =
|
|
3261
|
+
} = _ref11;
|
|
3256
3262
|
return "'".concat(type === "ForInStatement" ? "for-in" : "for-of", "' loop variable declaration may not have an initializer.");
|
|
3257
|
-
}
|
|
3258
|
-
ForOfAsync:
|
|
3259
|
-
ForOfLet:
|
|
3260
|
-
GeneratorInSingleStatementContext:
|
|
3261
|
-
IllegalBreakContinue:
|
|
3263
|
+
},
|
|
3264
|
+
ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
|
|
3265
|
+
ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
|
|
3266
|
+
GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
|
|
3267
|
+
IllegalBreakContinue: _ref12 => {
|
|
3262
3268
|
var {
|
|
3263
3269
|
type
|
|
3264
|
-
} =
|
|
3270
|
+
} = _ref12;
|
|
3265
3271
|
return "Unsyntactic ".concat(type === "BreakStatement" ? "break" : "continue", ".");
|
|
3266
|
-
}
|
|
3267
|
-
IllegalLanguageModeDirective:
|
|
3268
|
-
IllegalReturn:
|
|
3269
|
-
ImportBindingIsString:
|
|
3272
|
+
},
|
|
3273
|
+
IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
|
|
3274
|
+
IllegalReturn: "'return' outside of function.",
|
|
3275
|
+
ImportBindingIsString: _ref13 => {
|
|
3270
3276
|
var {
|
|
3271
3277
|
importName
|
|
3272
|
-
} =
|
|
3278
|
+
} = _ref13;
|
|
3273
3279
|
return "A string literal cannot be used as an imported binding.\n- Did you mean `import { \"".concat(importName, "\" as foo }`?");
|
|
3274
|
-
}
|
|
3275
|
-
ImportCallArgumentTrailingComma:
|
|
3276
|
-
ImportCallArity:
|
|
3280
|
+
},
|
|
3281
|
+
ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.",
|
|
3282
|
+
ImportCallArity: _ref14 => {
|
|
3277
3283
|
var {
|
|
3278
3284
|
maxArgumentCount
|
|
3279
|
-
} =
|
|
3285
|
+
} = _ref14;
|
|
3280
3286
|
return "`import()` requires exactly ".concat(maxArgumentCount === 1 ? "one argument" : "one or two arguments", ".");
|
|
3281
|
-
}
|
|
3282
|
-
ImportCallNotNewExpression:
|
|
3283
|
-
ImportCallSpreadArgument:
|
|
3284
|
-
ImportJSONBindingNotDefault:
|
|
3285
|
-
IncompatibleRegExpUVFlags:
|
|
3286
|
-
InvalidBigIntLiteral:
|
|
3287
|
-
InvalidCodePoint:
|
|
3288
|
-
InvalidCoverInitializedName:
|
|
3289
|
-
InvalidDecimal:
|
|
3290
|
-
InvalidDigit:
|
|
3287
|
+
},
|
|
3288
|
+
ImportCallNotNewExpression: "Cannot use new with import(...).",
|
|
3289
|
+
ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
|
|
3290
|
+
ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
|
|
3291
|
+
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
3292
|
+
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
3293
|
+
InvalidCodePoint: "Code point out of bounds.",
|
|
3294
|
+
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
3295
|
+
InvalidDecimal: "Invalid decimal.",
|
|
3296
|
+
InvalidDigit: _ref15 => {
|
|
3291
3297
|
var {
|
|
3292
3298
|
radix
|
|
3293
|
-
} =
|
|
3299
|
+
} = _ref15;
|
|
3294
3300
|
return "Expected number in radix ".concat(radix, ".");
|
|
3295
|
-
}
|
|
3296
|
-
InvalidEscapeSequence:
|
|
3297
|
-
InvalidEscapeSequenceTemplate:
|
|
3298
|
-
InvalidEscapedReservedWord:
|
|
3301
|
+
},
|
|
3302
|
+
InvalidEscapeSequence: "Bad character escape sequence.",
|
|
3303
|
+
InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
|
|
3304
|
+
InvalidEscapedReservedWord: _ref16 => {
|
|
3299
3305
|
var {
|
|
3300
3306
|
reservedWord
|
|
3301
|
-
} =
|
|
3307
|
+
} = _ref16;
|
|
3302
3308
|
return "Escape sequence in keyword ".concat(reservedWord, ".");
|
|
3303
|
-
}
|
|
3304
|
-
InvalidIdentifier:
|
|
3309
|
+
},
|
|
3310
|
+
InvalidIdentifier: _ref17 => {
|
|
3305
3311
|
var {
|
|
3306
3312
|
identifierName
|
|
3307
|
-
} =
|
|
3313
|
+
} = _ref17;
|
|
3308
3314
|
return "Invalid identifier ".concat(identifierName, ".");
|
|
3309
|
-
}
|
|
3310
|
-
InvalidLhs:
|
|
3315
|
+
},
|
|
3316
|
+
InvalidLhs: _ref18 => {
|
|
3311
3317
|
var {
|
|
3312
3318
|
ancestor
|
|
3313
|
-
} =
|
|
3319
|
+
} = _ref18;
|
|
3314
3320
|
return "Invalid left-hand side in ".concat(toNodeDescription(ancestor), ".");
|
|
3315
|
-
}
|
|
3316
|
-
InvalidLhsBinding:
|
|
3321
|
+
},
|
|
3322
|
+
InvalidLhsBinding: _ref19 => {
|
|
3317
3323
|
var {
|
|
3318
3324
|
ancestor
|
|
3319
|
-
} =
|
|
3325
|
+
} = _ref19;
|
|
3320
3326
|
return "Binding invalid left-hand side in ".concat(toNodeDescription(ancestor), ".");
|
|
3321
|
-
}
|
|
3322
|
-
InvalidNumber:
|
|
3323
|
-
InvalidOrMissingExponent:
|
|
3324
|
-
InvalidOrUnexpectedToken:
|
|
3327
|
+
},
|
|
3328
|
+
InvalidNumber: "Invalid number.",
|
|
3329
|
+
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
|
|
3330
|
+
InvalidOrUnexpectedToken: _ref20 => {
|
|
3325
3331
|
var {
|
|
3326
3332
|
unexpected
|
|
3327
|
-
} =
|
|
3333
|
+
} = _ref20;
|
|
3328
3334
|
return "Unexpected character '".concat(unexpected, "'.");
|
|
3329
|
-
}
|
|
3330
|
-
InvalidParenthesizedAssignment:
|
|
3331
|
-
InvalidPrivateFieldResolution:
|
|
3335
|
+
},
|
|
3336
|
+
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
|
|
3337
|
+
InvalidPrivateFieldResolution: _ref21 => {
|
|
3332
3338
|
var {
|
|
3333
3339
|
identifierName
|
|
3334
|
-
} =
|
|
3340
|
+
} = _ref21;
|
|
3335
3341
|
return "Private name #".concat(identifierName, " is not defined.");
|
|
3336
|
-
}
|
|
3337
|
-
InvalidPropertyBindingPattern:
|
|
3338
|
-
InvalidRecordProperty:
|
|
3339
|
-
InvalidRestAssignmentPattern:
|
|
3340
|
-
LabelRedeclaration:
|
|
3342
|
+
},
|
|
3343
|
+
InvalidPropertyBindingPattern: "Binding member expression.",
|
|
3344
|
+
InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions.",
|
|
3345
|
+
InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
|
|
3346
|
+
LabelRedeclaration: _ref22 => {
|
|
3341
3347
|
var {
|
|
3342
3348
|
labelName
|
|
3343
|
-
} =
|
|
3349
|
+
} = _ref22;
|
|
3344
3350
|
return "Label '".concat(labelName, "' is already declared.");
|
|
3345
|
-
}
|
|
3346
|
-
LetInLexicalBinding:
|
|
3347
|
-
LineTerminatorBeforeArrow:
|
|
3348
|
-
MalformedRegExpFlags:
|
|
3349
|
-
MissingClassName:
|
|
3350
|
-
MissingEqInAssignment:
|
|
3351
|
-
MissingSemicolon:
|
|
3352
|
-
MissingPlugin:
|
|
3351
|
+
},
|
|
3352
|
+
LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations.",
|
|
3353
|
+
LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
|
|
3354
|
+
MalformedRegExpFlags: "Invalid regular expression flag.",
|
|
3355
|
+
MissingClassName: "A class name is required.",
|
|
3356
|
+
MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
|
|
3357
|
+
MissingSemicolon: "Missing semicolon.",
|
|
3358
|
+
MissingPlugin: _ref23 => {
|
|
3353
3359
|
var {
|
|
3354
3360
|
missingPlugin
|
|
3355
|
-
} =
|
|
3361
|
+
} = _ref23;
|
|
3356
3362
|
return "This experimental syntax requires enabling the parser plugin: ".concat(missingPlugin.map(name => JSON.stringify(name)).join(", "), ".");
|
|
3357
|
-
}
|
|
3358
|
-
MissingOneOfPlugins:
|
|
3363
|
+
},
|
|
3364
|
+
MissingOneOfPlugins: _ref24 => {
|
|
3359
3365
|
var {
|
|
3360
3366
|
missingPlugin
|
|
3361
|
-
} =
|
|
3367
|
+
} = _ref24;
|
|
3362
3368
|
return "This experimental syntax requires enabling one of the following parser plugin(s): ".concat(missingPlugin.map(name => JSON.stringify(name)).join(", "), ".");
|
|
3363
|
-
}
|
|
3364
|
-
MissingUnicodeEscape:
|
|
3365
|
-
MixingCoalesceWithLogical:
|
|
3366
|
-
ModuleAttributeDifferentFromType:
|
|
3367
|
-
ModuleAttributeInvalidValue:
|
|
3368
|
-
ModuleAttributesWithDuplicateKeys:
|
|
3369
|
+
},
|
|
3370
|
+
MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
|
|
3371
|
+
MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
|
|
3372
|
+
ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`.",
|
|
3373
|
+
ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
|
|
3374
|
+
ModuleAttributesWithDuplicateKeys: _ref25 => {
|
|
3369
3375
|
var {
|
|
3370
3376
|
key
|
|
3371
|
-
} =
|
|
3377
|
+
} = _ref25;
|
|
3372
3378
|
return "Duplicate key \"".concat(key, "\" is not allowed in module attributes.");
|
|
3373
|
-
}
|
|
3374
|
-
ModuleExportNameHasLoneSurrogate:
|
|
3379
|
+
},
|
|
3380
|
+
ModuleExportNameHasLoneSurrogate: _ref26 => {
|
|
3375
3381
|
var {
|
|
3376
3382
|
surrogateCharCode
|
|
3377
|
-
} =
|
|
3383
|
+
} = _ref26;
|
|
3378
3384
|
return "An export name cannot include a lone surrogate, found '\\u".concat(surrogateCharCode.toString(16), "'.");
|
|
3379
|
-
}
|
|
3380
|
-
ModuleExportUndefined:
|
|
3385
|
+
},
|
|
3386
|
+
ModuleExportUndefined: _ref27 => {
|
|
3381
3387
|
var {
|
|
3382
3388
|
localName
|
|
3383
|
-
} =
|
|
3389
|
+
} = _ref27;
|
|
3384
3390
|
return "Export '".concat(localName, "' is not defined.");
|
|
3385
|
-
}
|
|
3386
|
-
MultipleDefaultsInSwitch:
|
|
3387
|
-
NewlineAfterThrow:
|
|
3388
|
-
NoCatchOrFinally:
|
|
3389
|
-
NumberIdentifier:
|
|
3390
|
-
NumericSeparatorInEscapeSequence:
|
|
3391
|
-
ObsoleteAwaitStar:
|
|
3392
|
-
OptionalChainingNoNew:
|
|
3393
|
-
OptionalChainingNoTemplate:
|
|
3394
|
-
OverrideOnConstructor:
|
|
3395
|
-
ParamDupe:
|
|
3396
|
-
PatternHasAccessor:
|
|
3397
|
-
PatternHasMethod:
|
|
3398
|
-
PrivateInExpectedIn:
|
|
3391
|
+
},
|
|
3392
|
+
MultipleDefaultsInSwitch: "Multiple default clauses.",
|
|
3393
|
+
NewlineAfterThrow: "Illegal newline after throw.",
|
|
3394
|
+
NoCatchOrFinally: "Missing catch or finally clause.",
|
|
3395
|
+
NumberIdentifier: "Identifier directly after number.",
|
|
3396
|
+
NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
|
|
3397
|
+
ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
|
|
3398
|
+
OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
|
|
3399
|
+
OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
|
|
3400
|
+
OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
|
|
3401
|
+
ParamDupe: "Argument name clash.",
|
|
3402
|
+
PatternHasAccessor: "Object pattern can't contain getter or setter.",
|
|
3403
|
+
PatternHasMethod: "Object pattern can't contain methods.",
|
|
3404
|
+
PrivateInExpectedIn: _ref28 => {
|
|
3399
3405
|
var {
|
|
3400
3406
|
identifierName
|
|
3401
|
-
} =
|
|
3407
|
+
} = _ref28;
|
|
3402
3408
|
return "Private names are only allowed in property accesses (`obj.#".concat(identifierName, "`) or in `in` expressions (`#").concat(identifierName, " in obj`).");
|
|
3403
|
-
}
|
|
3404
|
-
PrivateNameRedeclaration:
|
|
3409
|
+
},
|
|
3410
|
+
PrivateNameRedeclaration: _ref29 => {
|
|
3405
3411
|
var {
|
|
3406
3412
|
identifierName
|
|
3407
|
-
} =
|
|
3413
|
+
} = _ref29;
|
|
3408
3414
|
return "Duplicate private name #".concat(identifierName, ".");
|
|
3409
|
-
}
|
|
3410
|
-
RecordExpressionBarIncorrectEndSyntaxType:
|
|
3411
|
-
RecordExpressionBarIncorrectStartSyntaxType:
|
|
3412
|
-
RecordExpressionHashIncorrectStartSyntaxType:
|
|
3413
|
-
RecordNoProto:
|
|
3414
|
-
RestTrailingComma:
|
|
3415
|
-
SloppyFunction:
|
|
3416
|
-
StaticPrototype:
|
|
3417
|
-
SuperNotAllowed:
|
|
3418
|
-
SuperPrivateField:
|
|
3419
|
-
TrailingDecorator:
|
|
3420
|
-
TupleExpressionBarIncorrectEndSyntaxType:
|
|
3421
|
-
TupleExpressionBarIncorrectStartSyntaxType:
|
|
3422
|
-
TupleExpressionHashIncorrectStartSyntaxType:
|
|
3423
|
-
UnexpectedArgumentPlaceholder:
|
|
3424
|
-
UnexpectedAwaitAfterPipelineBody:
|
|
3425
|
-
UnexpectedDigitAfterHash:
|
|
3426
|
-
UnexpectedImportExport:
|
|
3427
|
-
UnexpectedKeyword:
|
|
3415
|
+
},
|
|
3416
|
+
RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3417
|
+
RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3418
|
+
RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
|
|
3419
|
+
RecordNoProto: "'__proto__' is not allowed in Record expressions.",
|
|
3420
|
+
RestTrailingComma: "Unexpected trailing comma after rest element.",
|
|
3421
|
+
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.",
|
|
3422
|
+
StaticPrototype: "Classes may not have static property named prototype.",
|
|
3423
|
+
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?",
|
|
3424
|
+
SuperPrivateField: "Private fields can't be accessed on super.",
|
|
3425
|
+
TrailingDecorator: "Decorators must be attached to a class element.",
|
|
3426
|
+
TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3427
|
+
TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3428
|
+
TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
|
|
3429
|
+
UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
|
|
3430
|
+
UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',
|
|
3431
|
+
UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
|
|
3432
|
+
UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
|
|
3433
|
+
UnexpectedKeyword: _ref30 => {
|
|
3428
3434
|
var {
|
|
3429
3435
|
keyword
|
|
3430
|
-
} =
|
|
3436
|
+
} = _ref30;
|
|
3431
3437
|
return "Unexpected keyword '".concat(keyword, "'.");
|
|
3432
|
-
}
|
|
3433
|
-
UnexpectedLeadingDecorator:
|
|
3434
|
-
UnexpectedLexicalDeclaration:
|
|
3435
|
-
UnexpectedNewTarget:
|
|
3436
|
-
UnexpectedNumericSeparator:
|
|
3437
|
-
UnexpectedPrivateField:
|
|
3438
|
-
UnexpectedReservedWord:
|
|
3438
|
+
},
|
|
3439
|
+
UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
|
|
3440
|
+
UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
|
|
3441
|
+
UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
|
|
3442
|
+
UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
|
|
3443
|
+
UnexpectedPrivateField: "Unexpected private name.",
|
|
3444
|
+
UnexpectedReservedWord: _ref31 => {
|
|
3439
3445
|
var {
|
|
3440
3446
|
reservedWord
|
|
3441
|
-
} =
|
|
3447
|
+
} = _ref31;
|
|
3442
3448
|
return "Unexpected reserved word '".concat(reservedWord, "'.");
|
|
3443
|
-
}
|
|
3444
|
-
UnexpectedSuper:
|
|
3445
|
-
UnexpectedToken:
|
|
3449
|
+
},
|
|
3450
|
+
UnexpectedSuper: "'super' is only allowed in object methods and classes.",
|
|
3451
|
+
UnexpectedToken: _ref32 => {
|
|
3446
3452
|
var {
|
|
3447
3453
|
expected,
|
|
3448
3454
|
unexpected
|
|
3449
|
-
} =
|
|
3455
|
+
} = _ref32;
|
|
3450
3456
|
return "Unexpected token".concat(unexpected ? " '".concat(unexpected, "'.") : "").concat(expected ? ", expected \"".concat(expected, "\"") : "");
|
|
3451
|
-
}
|
|
3452
|
-
UnexpectedTokenUnaryExponentiation:
|
|
3453
|
-
UnsupportedBind:
|
|
3454
|
-
UnsupportedDecoratorExport:
|
|
3455
|
-
UnsupportedDefaultExport:
|
|
3456
|
-
UnsupportedImport:
|
|
3457
|
-
UnsupportedMetaProperty:
|
|
3457
|
+
},
|
|
3458
|
+
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
|
3459
|
+
UnsupportedBind: "Binding should be performed on object property.",
|
|
3460
|
+
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
3461
|
+
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
3462
|
+
UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
|
|
3463
|
+
UnsupportedMetaProperty: _ref33 => {
|
|
3458
3464
|
var {
|
|
3459
3465
|
target,
|
|
3460
3466
|
onlyValidPropertyName
|
|
3461
|
-
} =
|
|
3467
|
+
} = _ref33;
|
|
3462
3468
|
return "The only valid meta property for ".concat(target, " is ").concat(target, ".").concat(onlyValidPropertyName, ".");
|
|
3463
|
-
}
|
|
3464
|
-
UnsupportedParameterDecorator:
|
|
3465
|
-
UnsupportedPropertyDecorator:
|
|
3466
|
-
UnsupportedSuper:
|
|
3467
|
-
UnterminatedComment:
|
|
3468
|
-
UnterminatedRegExp:
|
|
3469
|
-
UnterminatedString:
|
|
3470
|
-
UnterminatedTemplate:
|
|
3471
|
-
VarRedeclaration:
|
|
3469
|
+
},
|
|
3470
|
+
UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
|
|
3471
|
+
UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
|
|
3472
|
+
UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
|
|
3473
|
+
UnterminatedComment: "Unterminated comment.",
|
|
3474
|
+
UnterminatedRegExp: "Unterminated regular expression.",
|
|
3475
|
+
UnterminatedString: "Unterminated string constant.",
|
|
3476
|
+
UnterminatedTemplate: "Unterminated template.",
|
|
3477
|
+
VarRedeclaration: _ref34 => {
|
|
3472
3478
|
var {
|
|
3473
3479
|
identifierName
|
|
3474
|
-
} =
|
|
3480
|
+
} = _ref34;
|
|
3475
3481
|
return "Identifier '".concat(identifierName, "' has already been declared.");
|
|
3476
|
-
}
|
|
3477
|
-
YieldBindingIdentifier:
|
|
3478
|
-
YieldInParameter:
|
|
3479
|
-
ZeroDigitNumericSeparator:
|
|
3480
|
-
}
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
StrictEvalArguments: _(_ref34 => {
|
|
3482
|
+
},
|
|
3483
|
+
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
|
|
3484
|
+
YieldInParameter: "Yield expression is not allowed in formal parameters.",
|
|
3485
|
+
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
|
|
3486
|
+
};
|
|
3487
|
+
var StrictModeErrors = {
|
|
3488
|
+
StrictDelete: "Deleting local variable in strict mode.",
|
|
3489
|
+
StrictEvalArguments: _ref35 => {
|
|
3485
3490
|
var {
|
|
3486
3491
|
referenceName
|
|
3487
|
-
} =
|
|
3492
|
+
} = _ref35;
|
|
3488
3493
|
return "Assigning to '".concat(referenceName, "' in strict mode.");
|
|
3489
|
-
}
|
|
3490
|
-
StrictEvalArgumentsBinding:
|
|
3494
|
+
},
|
|
3495
|
+
StrictEvalArgumentsBinding: _ref36 => {
|
|
3491
3496
|
var {
|
|
3492
3497
|
bindingName
|
|
3493
|
-
} =
|
|
3498
|
+
} = _ref36;
|
|
3494
3499
|
return "Binding '".concat(bindingName, "' in strict mode.");
|
|
3495
|
-
}
|
|
3496
|
-
StrictFunction:
|
|
3497
|
-
StrictNumericEscape:
|
|
3498
|
-
StrictOctalLiteral:
|
|
3499
|
-
StrictWith:
|
|
3500
|
-
}
|
|
3501
|
-
|
|
3500
|
+
},
|
|
3501
|
+
StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
|
|
3502
|
+
StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
|
|
3503
|
+
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
|
|
3504
|
+
StrictWith: "'with' in strict mode."
|
|
3505
|
+
};
|
|
3502
3506
|
var UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
PipeTopicUnconfiguredToken: _(_ref36 => {
|
|
3507
|
+
var PipelineOperatorErrors = {
|
|
3508
|
+
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
|
|
3509
|
+
PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
|
|
3510
|
+
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
|
3511
|
+
PipeTopicUnconfiguredToken: _ref37 => {
|
|
3509
3512
|
var {
|
|
3510
3513
|
token
|
|
3511
|
-
} =
|
|
3514
|
+
} = _ref37;
|
|
3512
3515
|
return "Invalid topic token ".concat(token, ". In order to use ").concat(token, " as a topic reference, the pipelineOperator plugin must be configured with { \"proposal\": \"hack\", \"topicToken\": \"").concat(token, "\" }.");
|
|
3513
|
-
}
|
|
3514
|
-
PipeTopicUnused:
|
|
3515
|
-
PipeUnparenthesizedBody:
|
|
3516
|
+
},
|
|
3517
|
+
PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
|
|
3518
|
+
PipeUnparenthesizedBody: _ref38 => {
|
|
3516
3519
|
var {
|
|
3517
3520
|
type
|
|
3518
|
-
} =
|
|
3521
|
+
} = _ref38;
|
|
3519
3522
|
return "Hack-style pipe body cannot be an unparenthesized ".concat(toNodeDescription({
|
|
3520
3523
|
type
|
|
3521
3524
|
}), "; please wrap it in parentheses.");
|
|
3522
|
-
}
|
|
3523
|
-
PipelineBodyNoArrow:
|
|
3524
|
-
PipelineBodySequenceExpression:
|
|
3525
|
-
PipelineHeadSequenceExpression:
|
|
3526
|
-
PipelineTopicUnused:
|
|
3527
|
-
PrimaryTopicNotAllowed:
|
|
3528
|
-
PrimaryTopicRequiresSmartPipeline:
|
|
3529
|
-
}
|
|
3530
|
-
|
|
3531
|
-
|
|
3525
|
+
},
|
|
3526
|
+
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
|
|
3527
|
+
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
|
|
3528
|
+
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
|
|
3529
|
+
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
|
|
3530
|
+
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
3531
|
+
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
3532
|
+
};
|
|
3533
|
+
var _excluded$1 = ["toMessage"],
|
|
3534
|
+
_excluded2$1 = ["message"];
|
|
3532
3535
|
|
|
3533
3536
|
function toParseErrorConstructor(_ref) {
|
|
3534
3537
|
var {
|
|
@@ -3536,11 +3539,11 @@ function toParseErrorConstructor(_ref) {
|
|
|
3536
3539
|
} = _ref,
|
|
3537
3540
|
properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
3538
3541
|
|
|
3539
|
-
return function constructor(
|
|
3542
|
+
return function constructor(_ref39) {
|
|
3540
3543
|
var {
|
|
3541
3544
|
loc,
|
|
3542
3545
|
details
|
|
3543
|
-
} =
|
|
3546
|
+
} = _ref39;
|
|
3544
3547
|
return instantiate(SyntaxError, Object.assign({}, properties, {
|
|
3545
3548
|
loc
|
|
3546
3549
|
}), {
|
|
@@ -3581,27 +3584,38 @@ function toParseErrorConstructor(_ref) {
|
|
|
3581
3584
|
};
|
|
3582
3585
|
}
|
|
3583
3586
|
|
|
3584
|
-
function toParseErrorCredentials(toMessageOrMessage, credentials) {
|
|
3585
|
-
return Object.assign({
|
|
3586
|
-
toMessage: typeof toMessageOrMessage === "string" ? () => toMessageOrMessage : toMessageOrMessage
|
|
3587
|
-
}, credentials);
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3590
3587
|
function ParseErrorEnum(argument, syntaxPlugin) {
|
|
3591
3588
|
if (Array.isArray(argument)) {
|
|
3592
|
-
return
|
|
3589
|
+
return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]);
|
|
3593
3590
|
}
|
|
3594
3591
|
|
|
3595
|
-
var partialCredentials = argument(toParseErrorCredentials);
|
|
3596
3592
|
var ParseErrorConstructors = {};
|
|
3597
3593
|
|
|
3598
|
-
|
|
3594
|
+
var _loop = function (reasonCode) {
|
|
3595
|
+
var template = argument[reasonCode];
|
|
3596
|
+
|
|
3597
|
+
var _ref2 = typeof template === "string" ? {
|
|
3598
|
+
message: () => template
|
|
3599
|
+
} : typeof template === "function" ? {
|
|
3600
|
+
message: template
|
|
3601
|
+
} : template,
|
|
3602
|
+
{
|
|
3603
|
+
message
|
|
3604
|
+
} = _ref2,
|
|
3605
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
|
|
3606
|
+
|
|
3607
|
+
var toMessage = typeof message === "string" ? () => message : message;
|
|
3599
3608
|
ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
|
|
3600
|
-
code:
|
|
3601
|
-
reasonCode
|
|
3609
|
+
code: ParseErrorCode.SyntaxError,
|
|
3610
|
+
reasonCode,
|
|
3611
|
+
toMessage
|
|
3602
3612
|
}, syntaxPlugin ? {
|
|
3603
3613
|
syntaxPlugin
|
|
3604
|
-
} : {},
|
|
3614
|
+
} : {}, rest));
|
|
3615
|
+
};
|
|
3616
|
+
|
|
3617
|
+
for (var reasonCode of Object.keys(argument)) {
|
|
3618
|
+
_loop(reasonCode);
|
|
3605
3619
|
}
|
|
3606
3620
|
|
|
3607
3621
|
return ParseErrorConstructors;
|
|
@@ -3623,7 +3637,7 @@ function toESTreeLocation(node) {
|
|
|
3623
3637
|
return node;
|
|
3624
3638
|
}
|
|
3625
3639
|
|
|
3626
|
-
var estree = superClass => class extends superClass {
|
|
3640
|
+
var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
3627
3641
|
parse() {
|
|
3628
3642
|
var file = toESTreeLocation(super.parse());
|
|
3629
3643
|
|
|
@@ -3634,11 +3648,11 @@ var estree = superClass => class extends superClass {
|
|
|
3634
3648
|
return file;
|
|
3635
3649
|
}
|
|
3636
3650
|
|
|
3637
|
-
parseRegExpLiteral(
|
|
3651
|
+
parseRegExpLiteral(_ref40) {
|
|
3638
3652
|
var {
|
|
3639
3653
|
pattern,
|
|
3640
3654
|
flags
|
|
3641
|
-
} =
|
|
3655
|
+
} = _ref40;
|
|
3642
3656
|
var regex = null;
|
|
3643
3657
|
|
|
3644
3658
|
try {
|
|
@@ -3695,14 +3709,17 @@ var estree = superClass => class extends superClass {
|
|
|
3695
3709
|
}
|
|
3696
3710
|
|
|
3697
3711
|
directiveToStmt(directive) {
|
|
3698
|
-
var
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
expression.
|
|
3702
|
-
expression.
|
|
3703
|
-
stmt
|
|
3704
|
-
stmt.
|
|
3705
|
-
|
|
3712
|
+
var expression = directive.value;
|
|
3713
|
+
delete directive.value;
|
|
3714
|
+
expression.type = "Literal";
|
|
3715
|
+
expression.raw = expression.extra.raw;
|
|
3716
|
+
expression.value = expression.extra.expressionValue;
|
|
3717
|
+
var stmt = directive;
|
|
3718
|
+
stmt.type = "ExpressionStatement";
|
|
3719
|
+
stmt.expression = expression;
|
|
3720
|
+
stmt.directive = expression.extra.rawValue;
|
|
3721
|
+
delete expression.extra;
|
|
3722
|
+
return stmt;
|
|
3706
3723
|
}
|
|
3707
3724
|
|
|
3708
3725
|
initFunction(node, isAsync) {
|
|
@@ -3728,12 +3745,8 @@ var estree = superClass => class extends superClass {
|
|
|
3728
3745
|
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized);
|
|
3729
3746
|
}
|
|
3730
3747
|
|
|
3731
|
-
parseBlockBody(node) {
|
|
3732
|
-
|
|
3733
|
-
args[_key - 1] = arguments[_key];
|
|
3734
|
-
}
|
|
3735
|
-
|
|
3736
|
-
super.parseBlockBody(node, ...args);
|
|
3748
|
+
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
|
|
3749
|
+
super.parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse);
|
|
3737
3750
|
var directiveStatements = node.directives.map(d => this.directiveToStmt(d));
|
|
3738
3751
|
node.body = directiveStatements.concat(node.body);
|
|
3739
3752
|
delete node.directives;
|
|
@@ -3813,8 +3826,7 @@ var estree = superClass => class extends superClass {
|
|
|
3813
3826
|
node.computed = false;
|
|
3814
3827
|
}
|
|
3815
3828
|
|
|
3816
|
-
|
|
3817
|
-
return this.finishNode(node, type);
|
|
3829
|
+
return this.finishNode(node, "MethodDefinition");
|
|
3818
3830
|
}
|
|
3819
3831
|
|
|
3820
3832
|
parseClassProperty() {
|
|
@@ -3845,7 +3857,11 @@ var estree = superClass => class extends superClass {
|
|
|
3845
3857
|
|
|
3846
3858
|
if (node) {
|
|
3847
3859
|
node.type = "Property";
|
|
3848
|
-
|
|
3860
|
+
|
|
3861
|
+
if (node.kind === "method") {
|
|
3862
|
+
node.kind = "init";
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3849
3865
|
node.shorthand = false;
|
|
3850
3866
|
}
|
|
3851
3867
|
|
|
@@ -3863,12 +3879,8 @@ var estree = superClass => class extends superClass {
|
|
|
3863
3879
|
return node;
|
|
3864
3880
|
}
|
|
3865
3881
|
|
|
3866
|
-
isValidLVal(type) {
|
|
3867
|
-
|
|
3868
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
3869
|
-
}
|
|
3870
|
-
|
|
3871
|
-
return type === "Property" ? "value" : super.isValidLVal(type, ...rest);
|
|
3882
|
+
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
3883
|
+
return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding);
|
|
3872
3884
|
}
|
|
3873
3885
|
|
|
3874
3886
|
isAssignable(node, isBinding) {
|
|
@@ -3898,7 +3910,7 @@ var estree = superClass => class extends superClass {
|
|
|
3898
3910
|
}
|
|
3899
3911
|
}
|
|
3900
3912
|
|
|
3901
|
-
toAssignableObjectExpressionProp(prop) {
|
|
3913
|
+
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
3902
3914
|
if (prop.kind === "get" || prop.kind === "set") {
|
|
3903
3915
|
this.raise(Errors.PatternHasAccessor, {
|
|
3904
3916
|
at: prop.key
|
|
@@ -3908,12 +3920,12 @@ var estree = superClass => class extends superClass {
|
|
|
3908
3920
|
at: prop.key
|
|
3909
3921
|
});
|
|
3910
3922
|
} else {
|
|
3911
|
-
super.toAssignableObjectExpressionProp(
|
|
3923
|
+
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
3912
3924
|
}
|
|
3913
3925
|
}
|
|
3914
3926
|
|
|
3915
|
-
finishCallExpression(
|
|
3916
|
-
super.finishCallExpression(
|
|
3927
|
+
finishCallExpression(unfinished, optional) {
|
|
3928
|
+
var node = super.finishCallExpression(unfinished, optional);
|
|
3917
3929
|
|
|
3918
3930
|
if (node.callee.type === "Import") {
|
|
3919
3931
|
node.type = "ImportExpression";
|
|
@@ -3940,8 +3952,8 @@ var estree = superClass => class extends superClass {
|
|
|
3940
3952
|
super.toReferencedArguments(node);
|
|
3941
3953
|
}
|
|
3942
3954
|
|
|
3943
|
-
parseExport(
|
|
3944
|
-
super.parseExport(
|
|
3955
|
+
parseExport(unfinished) {
|
|
3956
|
+
var node = super.parseExport(unfinished);
|
|
3945
3957
|
|
|
3946
3958
|
switch (node.type) {
|
|
3947
3959
|
case "ExportAllDeclaration":
|
|
@@ -4616,12 +4628,12 @@ function getExportedToken(token) {
|
|
|
4616
4628
|
};
|
|
4617
4629
|
}
|
|
4618
4630
|
var 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\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\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-\u1711\u171f-\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-\u1b4c\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-\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-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\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-\uab69\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";
|
|
4619
|
-
var 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\u0898-\u089f\u08ca-\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\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\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\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\
|
|
4631
|
+
var 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\u0898-\u089f\u08ca-\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\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\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\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\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-\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\ua82c\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";
|
|
4620
4632
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
4621
4633
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
4622
4634
|
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
4623
|
-
var 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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24,
|
|
4624
|
-
var 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, 370, 1,
|
|
4635
|
+
var 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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 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, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 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, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 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, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 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, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
|
|
4636
|
+
var 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, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 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, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 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, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
4625
4637
|
|
|
4626
4638
|
function isInAstralSet(code, set) {
|
|
4627
4639
|
var pos = 0x10000;
|
|
@@ -4719,12 +4731,13 @@ var BIND_KIND_VALUE = 0b000000000001,
|
|
|
4719
4731
|
BIND_SCOPE_VAR = 0b000000000100,
|
|
4720
4732
|
BIND_SCOPE_LEXICAL = 0b000000001000,
|
|
4721
4733
|
BIND_SCOPE_FUNCTION = 0b000000010000,
|
|
4722
|
-
BIND_FLAGS_NONE =
|
|
4723
|
-
BIND_FLAGS_CLASS =
|
|
4724
|
-
BIND_FLAGS_TS_ENUM =
|
|
4725
|
-
BIND_FLAGS_TS_CONST_ENUM =
|
|
4726
|
-
BIND_FLAGS_TS_EXPORT_ONLY =
|
|
4727
|
-
BIND_FLAGS_FLOW_DECLARE_FN =
|
|
4734
|
+
BIND_FLAGS_NONE = 0b0000001000000,
|
|
4735
|
+
BIND_FLAGS_CLASS = 0b0000010000000,
|
|
4736
|
+
BIND_FLAGS_TS_ENUM = 0b0000100000000,
|
|
4737
|
+
BIND_FLAGS_TS_CONST_ENUM = 0b0001000000000,
|
|
4738
|
+
BIND_FLAGS_TS_EXPORT_ONLY = 0b0010000000000,
|
|
4739
|
+
BIND_FLAGS_FLOW_DECLARE_FN = 0b0100000000000,
|
|
4740
|
+
BIND_FLAGS_TS_IMPORT = 0b1000000000000;
|
|
4728
4741
|
var BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS,
|
|
4729
4742
|
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
|
|
4730
4743
|
BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
|
|
@@ -4737,6 +4750,7 @@ var BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FL
|
|
|
4737
4750
|
BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE,
|
|
4738
4751
|
BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,
|
|
4739
4752
|
BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
|
|
4753
|
+
BIND_TS_TYPE_IMPORT = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_TS_IMPORT,
|
|
4740
4754
|
BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;
|
|
4741
4755
|
var CLASS_ELEMENT_FLAG_STATIC = 0b100,
|
|
4742
4756
|
CLASS_ELEMENT_KIND_GETTER = 0b010,
|
|
@@ -4748,59 +4762,285 @@ var CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG
|
|
|
4748
4762
|
CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER,
|
|
4749
4763
|
CLASS_ELEMENT_OTHER = 0;
|
|
4750
4764
|
|
|
4751
|
-
class
|
|
4752
|
-
constructor() {
|
|
4753
|
-
this.
|
|
4754
|
-
this.
|
|
4765
|
+
class Scope {
|
|
4766
|
+
constructor(flags) {
|
|
4767
|
+
this.var = new Set();
|
|
4768
|
+
this.lexical = new Set();
|
|
4769
|
+
this.functions = new Set();
|
|
4770
|
+
this.flags = flags;
|
|
4755
4771
|
}
|
|
4756
4772
|
|
|
4757
|
-
|
|
4758
|
-
if (typeof pluginConfig === "string") {
|
|
4759
|
-
return this.plugins.has(pluginConfig);
|
|
4760
|
-
} else {
|
|
4761
|
-
var [pluginName, pluginOptions] = pluginConfig;
|
|
4773
|
+
}
|
|
4762
4774
|
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4775
|
+
class ScopeHandler {
|
|
4776
|
+
constructor(parser, inModule) {
|
|
4777
|
+
this.parser = void 0;
|
|
4778
|
+
this.scopeStack = [];
|
|
4779
|
+
this.inModule = void 0;
|
|
4780
|
+
this.undefinedExports = new Map();
|
|
4781
|
+
this.parser = parser;
|
|
4782
|
+
this.inModule = inModule;
|
|
4783
|
+
}
|
|
4766
4784
|
|
|
4767
|
-
|
|
4785
|
+
get inFunction() {
|
|
4786
|
+
return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
4787
|
+
}
|
|
4768
4788
|
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
}
|
|
4773
|
-
}
|
|
4789
|
+
get allowSuper() {
|
|
4790
|
+
return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;
|
|
4791
|
+
}
|
|
4774
4792
|
|
|
4775
|
-
|
|
4776
|
-
|
|
4793
|
+
get allowDirectSuper() {
|
|
4794
|
+
return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;
|
|
4777
4795
|
}
|
|
4778
4796
|
|
|
4779
|
-
|
|
4780
|
-
|
|
4797
|
+
get inClass() {
|
|
4798
|
+
return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;
|
|
4799
|
+
}
|
|
4781
4800
|
|
|
4782
|
-
|
|
4801
|
+
get inClassAndNotInNonArrowFunction() {
|
|
4802
|
+
var flags = this.currentThisScopeFlags();
|
|
4803
|
+
return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
|
|
4783
4804
|
}
|
|
4784
4805
|
|
|
4785
|
-
|
|
4806
|
+
get inStaticBlock() {
|
|
4807
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4808
|
+
var {
|
|
4809
|
+
flags
|
|
4810
|
+
} = this.scopeStack[i];
|
|
4786
4811
|
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4812
|
+
if (flags & SCOPE_STATIC_BLOCK) {
|
|
4813
|
+
return true;
|
|
4814
|
+
}
|
|
4815
|
+
|
|
4816
|
+
if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
|
|
4817
|
+
return false;
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4792
4820
|
}
|
|
4793
|
-
}
|
|
4794
4821
|
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
node.leadingComments = comments;
|
|
4798
|
-
} else {
|
|
4799
|
-
node.leadingComments.unshift(...comments);
|
|
4822
|
+
get inNonArrowFunction() {
|
|
4823
|
+
return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
4800
4824
|
}
|
|
4801
|
-
}
|
|
4802
4825
|
|
|
4803
|
-
|
|
4826
|
+
get treatFunctionsAsVar() {
|
|
4827
|
+
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
4828
|
+
}
|
|
4829
|
+
|
|
4830
|
+
createScope(flags) {
|
|
4831
|
+
return new Scope(flags);
|
|
4832
|
+
}
|
|
4833
|
+
|
|
4834
|
+
enter(flags) {
|
|
4835
|
+
this.scopeStack.push(this.createScope(flags));
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4838
|
+
exit() {
|
|
4839
|
+
var scope = this.scopeStack.pop();
|
|
4840
|
+
return scope.flags;
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
treatFunctionsAsVarInScope(scope) {
|
|
4844
|
+
return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
|
|
4845
|
+
}
|
|
4846
|
+
|
|
4847
|
+
declareName(name, bindingType, loc) {
|
|
4848
|
+
var scope = this.currentScope();
|
|
4849
|
+
|
|
4850
|
+
if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {
|
|
4851
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4852
|
+
|
|
4853
|
+
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
4854
|
+
scope.functions.add(name);
|
|
4855
|
+
} else {
|
|
4856
|
+
scope.lexical.add(name);
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4859
|
+
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
4860
|
+
this.maybeExportDefined(scope, name);
|
|
4861
|
+
}
|
|
4862
|
+
} else if (bindingType & BIND_SCOPE_VAR) {
|
|
4863
|
+
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
4864
|
+
scope = this.scopeStack[i];
|
|
4865
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4866
|
+
scope.var.add(name);
|
|
4867
|
+
this.maybeExportDefined(scope, name);
|
|
4868
|
+
if (scope.flags & SCOPE_VAR) break;
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
|
|
4872
|
+
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
4873
|
+
this.undefinedExports.delete(name);
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4876
|
+
|
|
4877
|
+
maybeExportDefined(scope, name) {
|
|
4878
|
+
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
4879
|
+
this.undefinedExports.delete(name);
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
4884
|
+
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
4885
|
+
this.parser.raise(Errors.VarRedeclaration, {
|
|
4886
|
+
at: loc,
|
|
4887
|
+
identifierName: name
|
|
4888
|
+
});
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4892
|
+
isRedeclaredInScope(scope, name, bindingType) {
|
|
4893
|
+
if (!(bindingType & BIND_KIND_VALUE)) return false;
|
|
4894
|
+
|
|
4895
|
+
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
4896
|
+
return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
|
|
4897
|
+
}
|
|
4898
|
+
|
|
4899
|
+
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
4900
|
+
return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
|
|
4901
|
+
}
|
|
4902
|
+
|
|
4903
|
+
return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
|
|
4904
|
+
}
|
|
4905
|
+
|
|
4906
|
+
checkLocalExport(id) {
|
|
4907
|
+
var {
|
|
4908
|
+
name
|
|
4909
|
+
} = id;
|
|
4910
|
+
var topLevelScope = this.scopeStack[0];
|
|
4911
|
+
|
|
4912
|
+
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
|
|
4913
|
+
this.undefinedExports.set(name, id.loc.start);
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4917
|
+
currentScope() {
|
|
4918
|
+
return this.scopeStack[this.scopeStack.length - 1];
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4921
|
+
currentVarScopeFlags() {
|
|
4922
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4923
|
+
var {
|
|
4924
|
+
flags
|
|
4925
|
+
} = this.scopeStack[i];
|
|
4926
|
+
|
|
4927
|
+
if (flags & SCOPE_VAR) {
|
|
4928
|
+
return flags;
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4932
|
+
|
|
4933
|
+
currentThisScopeFlags() {
|
|
4934
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4935
|
+
var {
|
|
4936
|
+
flags
|
|
4937
|
+
} = this.scopeStack[i];
|
|
4938
|
+
|
|
4939
|
+
if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {
|
|
4940
|
+
return flags;
|
|
4941
|
+
}
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4944
|
+
|
|
4945
|
+
}
|
|
4946
|
+
|
|
4947
|
+
class FlowScope extends Scope {
|
|
4948
|
+
constructor() {
|
|
4949
|
+
super(...arguments);
|
|
4950
|
+
this.declareFunctions = new Set();
|
|
4951
|
+
}
|
|
4952
|
+
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
class FlowScopeHandler extends ScopeHandler {
|
|
4956
|
+
createScope(flags) {
|
|
4957
|
+
return new FlowScope(flags);
|
|
4958
|
+
}
|
|
4959
|
+
|
|
4960
|
+
declareName(name, bindingType, loc) {
|
|
4961
|
+
var scope = this.currentScope();
|
|
4962
|
+
|
|
4963
|
+
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
4964
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4965
|
+
this.maybeExportDefined(scope, name);
|
|
4966
|
+
scope.declareFunctions.add(name);
|
|
4967
|
+
return;
|
|
4968
|
+
}
|
|
4969
|
+
|
|
4970
|
+
super.declareName(name, bindingType, loc);
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
isRedeclaredInScope(scope, name, bindingType) {
|
|
4974
|
+
if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
|
|
4975
|
+
|
|
4976
|
+
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
4977
|
+
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
|
|
4978
|
+
}
|
|
4979
|
+
|
|
4980
|
+
return false;
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4983
|
+
checkLocalExport(id) {
|
|
4984
|
+
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
|
|
4985
|
+
super.checkLocalExport(id);
|
|
4986
|
+
}
|
|
4987
|
+
}
|
|
4988
|
+
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
class BaseParser {
|
|
4992
|
+
constructor() {
|
|
4993
|
+
this.sawUnambiguousESM = false;
|
|
4994
|
+
this.ambiguousScriptDifferentAst = false;
|
|
4995
|
+
}
|
|
4996
|
+
|
|
4997
|
+
hasPlugin(pluginConfig) {
|
|
4998
|
+
if (typeof pluginConfig === "string") {
|
|
4999
|
+
return this.plugins.has(pluginConfig);
|
|
5000
|
+
} else {
|
|
5001
|
+
var [pluginName, pluginOptions] = pluginConfig;
|
|
5002
|
+
|
|
5003
|
+
if (!this.hasPlugin(pluginName)) {
|
|
5004
|
+
return false;
|
|
5005
|
+
}
|
|
5006
|
+
|
|
5007
|
+
var actualOptions = this.plugins.get(pluginName);
|
|
5008
|
+
|
|
5009
|
+
for (var key of Object.keys(pluginOptions)) {
|
|
5010
|
+
if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
|
|
5011
|
+
return false;
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
|
|
5015
|
+
return true;
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
|
|
5019
|
+
getPluginOption(plugin, name) {
|
|
5020
|
+
var _this$plugins$get;
|
|
5021
|
+
|
|
5022
|
+
return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
|
|
5023
|
+
}
|
|
5024
|
+
|
|
5025
|
+
}
|
|
5026
|
+
|
|
5027
|
+
function setTrailingComments(node, comments) {
|
|
5028
|
+
if (node.trailingComments === undefined) {
|
|
5029
|
+
node.trailingComments = comments;
|
|
5030
|
+
} else {
|
|
5031
|
+
node.trailingComments.unshift(...comments);
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
|
|
5035
|
+
function setLeadingComments(node, comments) {
|
|
5036
|
+
if (node.leadingComments === undefined) {
|
|
5037
|
+
node.leadingComments = comments;
|
|
5038
|
+
} else {
|
|
5039
|
+
node.leadingComments.unshift(...comments);
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
|
|
5043
|
+
function setInnerComments(node, comments) {
|
|
4804
5044
|
if (node.innerComments === undefined) {
|
|
4805
5045
|
node.innerComments = comments;
|
|
4806
5046
|
} else {
|
|
@@ -5069,65 +5309,394 @@ class State {
|
|
|
5069
5309
|
this.context = [types.brace];
|
|
5070
5310
|
this.canStartJSXElement = true;
|
|
5071
5311
|
this.containsEsc = false;
|
|
5312
|
+
this.firstInvalidTemplateEscapePos = null;
|
|
5072
5313
|
this.strictErrors = new Map();
|
|
5073
5314
|
this.tokensLength = 0;
|
|
5074
5315
|
}
|
|
5075
5316
|
|
|
5076
|
-
init(
|
|
5077
|
-
var {
|
|
5078
|
-
strictMode,
|
|
5079
|
-
sourceType,
|
|
5080
|
-
startLine,
|
|
5081
|
-
startColumn
|
|
5082
|
-
} =
|
|
5083
|
-
this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
|
|
5084
|
-
this.curLine = startLine;
|
|
5085
|
-
this.lineStart = -startColumn;
|
|
5086
|
-
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
5317
|
+
init(_ref41) {
|
|
5318
|
+
var {
|
|
5319
|
+
strictMode,
|
|
5320
|
+
sourceType,
|
|
5321
|
+
startLine,
|
|
5322
|
+
startColumn
|
|
5323
|
+
} = _ref41;
|
|
5324
|
+
this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
|
|
5325
|
+
this.curLine = startLine;
|
|
5326
|
+
this.lineStart = -startColumn;
|
|
5327
|
+
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5330
|
+
curPosition() {
|
|
5331
|
+
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
|
|
5332
|
+
}
|
|
5333
|
+
|
|
5334
|
+
clone(skipArrays) {
|
|
5335
|
+
var state = new State();
|
|
5336
|
+
var keys = Object.keys(this);
|
|
5337
|
+
|
|
5338
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
|
5339
|
+
var key = keys[i];
|
|
5340
|
+
var val = this[key];
|
|
5341
|
+
|
|
5342
|
+
if (!skipArrays && Array.isArray(val)) {
|
|
5343
|
+
val = val.slice();
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
state[key] = val;
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5349
|
+
return state;
|
|
5350
|
+
}
|
|
5351
|
+
|
|
5352
|
+
}
|
|
5353
|
+
|
|
5354
|
+
var _isDigit = function isDigit(code) {
|
|
5355
|
+
return code >= 48 && code <= 57;
|
|
5356
|
+
};
|
|
5357
|
+
|
|
5358
|
+
var forbiddenNumericSeparatorSiblings = {
|
|
5359
|
+
decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
|
|
5360
|
+
hex: new Set([46, 88, 95, 120])
|
|
5361
|
+
};
|
|
5362
|
+
var isAllowedNumericSeparatorSibling = {
|
|
5363
|
+
bin: ch => ch === 48 || ch === 49,
|
|
5364
|
+
oct: ch => ch >= 48 && ch <= 55,
|
|
5365
|
+
dec: ch => ch >= 48 && ch <= 57,
|
|
5366
|
+
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
5367
|
+
};
|
|
5368
|
+
|
|
5369
|
+
function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
5370
|
+
var initialPos = pos;
|
|
5371
|
+
var initialLineStart = lineStart;
|
|
5372
|
+
var initialCurLine = curLine;
|
|
5373
|
+
var out = "";
|
|
5374
|
+
var firstInvalidLoc = null;
|
|
5375
|
+
var chunkStart = pos;
|
|
5376
|
+
var {
|
|
5377
|
+
length
|
|
5378
|
+
} = input;
|
|
5379
|
+
|
|
5380
|
+
for (;;) {
|
|
5381
|
+
if (pos >= length) {
|
|
5382
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
5383
|
+
out += input.slice(chunkStart, pos);
|
|
5384
|
+
break;
|
|
5385
|
+
}
|
|
5386
|
+
|
|
5387
|
+
var ch = input.charCodeAt(pos);
|
|
5388
|
+
|
|
5389
|
+
if (isStringEnd(type, ch, input, pos)) {
|
|
5390
|
+
out += input.slice(chunkStart, pos);
|
|
5391
|
+
break;
|
|
5392
|
+
}
|
|
5393
|
+
|
|
5394
|
+
if (ch === 92) {
|
|
5395
|
+
out += input.slice(chunkStart, pos);
|
|
5396
|
+
var res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
|
|
5397
|
+
|
|
5398
|
+
if (res.ch === null && !firstInvalidLoc) {
|
|
5399
|
+
firstInvalidLoc = {
|
|
5400
|
+
pos,
|
|
5401
|
+
lineStart,
|
|
5402
|
+
curLine
|
|
5403
|
+
};
|
|
5404
|
+
} else {
|
|
5405
|
+
out += res.ch;
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5408
|
+
({
|
|
5409
|
+
pos,
|
|
5410
|
+
lineStart,
|
|
5411
|
+
curLine
|
|
5412
|
+
} = res);
|
|
5413
|
+
chunkStart = pos;
|
|
5414
|
+
} else if (ch === 8232 || ch === 8233) {
|
|
5415
|
+
++pos;
|
|
5416
|
+
++curLine;
|
|
5417
|
+
lineStart = pos;
|
|
5418
|
+
} else if (ch === 10 || ch === 13) {
|
|
5419
|
+
if (type === "template") {
|
|
5420
|
+
out += input.slice(chunkStart, pos) + "\n";
|
|
5421
|
+
++pos;
|
|
5422
|
+
|
|
5423
|
+
if (ch === 13 && input.charCodeAt(pos) === 10) {
|
|
5424
|
+
++pos;
|
|
5425
|
+
}
|
|
5426
|
+
|
|
5427
|
+
++curLine;
|
|
5428
|
+
chunkStart = lineStart = pos;
|
|
5429
|
+
} else {
|
|
5430
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
5431
|
+
}
|
|
5432
|
+
} else {
|
|
5433
|
+
++pos;
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5437
|
+
return {
|
|
5438
|
+
pos,
|
|
5439
|
+
str: out,
|
|
5440
|
+
firstInvalidLoc,
|
|
5441
|
+
lineStart,
|
|
5442
|
+
curLine,
|
|
5443
|
+
containsInvalid: !!firstInvalidLoc
|
|
5444
|
+
};
|
|
5445
|
+
}
|
|
5446
|
+
|
|
5447
|
+
function isStringEnd(type, ch, input, pos) {
|
|
5448
|
+
if (type === "template") {
|
|
5449
|
+
return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
|
|
5450
|
+
}
|
|
5451
|
+
|
|
5452
|
+
return ch === (type === "double" ? 34 : 39);
|
|
5453
|
+
}
|
|
5454
|
+
|
|
5455
|
+
function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
5456
|
+
var throwOnInvalid = !inTemplate;
|
|
5457
|
+
pos++;
|
|
5458
|
+
|
|
5459
|
+
var res = ch => ({
|
|
5460
|
+
pos,
|
|
5461
|
+
ch,
|
|
5462
|
+
lineStart,
|
|
5463
|
+
curLine
|
|
5464
|
+
});
|
|
5465
|
+
|
|
5466
|
+
var ch = input.charCodeAt(pos++);
|
|
5467
|
+
|
|
5468
|
+
switch (ch) {
|
|
5469
|
+
case 110:
|
|
5470
|
+
return res("\n");
|
|
5471
|
+
|
|
5472
|
+
case 114:
|
|
5473
|
+
return res("\r");
|
|
5474
|
+
|
|
5475
|
+
case 120:
|
|
5476
|
+
{
|
|
5477
|
+
var code;
|
|
5478
|
+
({
|
|
5479
|
+
code,
|
|
5480
|
+
pos
|
|
5481
|
+
} = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
5482
|
+
return res(code === null ? null : String.fromCharCode(code));
|
|
5483
|
+
}
|
|
5484
|
+
|
|
5485
|
+
case 117:
|
|
5486
|
+
{
|
|
5487
|
+
var _code;
|
|
5488
|
+
|
|
5489
|
+
({
|
|
5490
|
+
code: _code,
|
|
5491
|
+
pos
|
|
5492
|
+
} = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
5493
|
+
return res(_code === null ? null : String.fromCodePoint(_code));
|
|
5494
|
+
}
|
|
5495
|
+
|
|
5496
|
+
case 116:
|
|
5497
|
+
return res("\t");
|
|
5498
|
+
|
|
5499
|
+
case 98:
|
|
5500
|
+
return res("\b");
|
|
5501
|
+
|
|
5502
|
+
case 118:
|
|
5503
|
+
return res("\u000b");
|
|
5504
|
+
|
|
5505
|
+
case 102:
|
|
5506
|
+
return res("\f");
|
|
5507
|
+
|
|
5508
|
+
case 13:
|
|
5509
|
+
if (input.charCodeAt(pos) === 10) {
|
|
5510
|
+
++pos;
|
|
5511
|
+
}
|
|
5512
|
+
|
|
5513
|
+
case 10:
|
|
5514
|
+
lineStart = pos;
|
|
5515
|
+
++curLine;
|
|
5516
|
+
|
|
5517
|
+
case 8232:
|
|
5518
|
+
case 8233:
|
|
5519
|
+
return res("");
|
|
5520
|
+
|
|
5521
|
+
case 56:
|
|
5522
|
+
case 57:
|
|
5523
|
+
if (inTemplate) {
|
|
5524
|
+
return res(null);
|
|
5525
|
+
} else {
|
|
5526
|
+
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
5527
|
+
}
|
|
5528
|
+
|
|
5529
|
+
default:
|
|
5530
|
+
if (ch >= 48 && ch <= 55) {
|
|
5531
|
+
var startPos = pos - 1;
|
|
5532
|
+
var match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
|
|
5533
|
+
var octalStr = match[0];
|
|
5534
|
+
var octal = parseInt(octalStr, 8);
|
|
5535
|
+
|
|
5536
|
+
if (octal > 255) {
|
|
5537
|
+
octalStr = octalStr.slice(0, -1);
|
|
5538
|
+
octal = parseInt(octalStr, 8);
|
|
5539
|
+
}
|
|
5540
|
+
|
|
5541
|
+
pos += octalStr.length - 1;
|
|
5542
|
+
var next = input.charCodeAt(pos);
|
|
5543
|
+
|
|
5544
|
+
if (octalStr !== "0" || next === 56 || next === 57) {
|
|
5545
|
+
if (inTemplate) {
|
|
5546
|
+
return res(null);
|
|
5547
|
+
} else {
|
|
5548
|
+
errors.strictNumericEscape(startPos, lineStart, curLine);
|
|
5549
|
+
}
|
|
5550
|
+
}
|
|
5551
|
+
|
|
5552
|
+
return res(String.fromCharCode(octal));
|
|
5553
|
+
}
|
|
5554
|
+
|
|
5555
|
+
return res(String.fromCharCode(ch));
|
|
5556
|
+
}
|
|
5557
|
+
}
|
|
5558
|
+
|
|
5559
|
+
function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
5560
|
+
var initialPos = pos;
|
|
5561
|
+
var n;
|
|
5562
|
+
({
|
|
5563
|
+
n,
|
|
5564
|
+
pos
|
|
5565
|
+
} = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
5566
|
+
|
|
5567
|
+
if (n === null) {
|
|
5568
|
+
if (throwOnInvalid) {
|
|
5569
|
+
errors.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
5570
|
+
} else {
|
|
5571
|
+
pos = initialPos - 1;
|
|
5572
|
+
}
|
|
5573
|
+
}
|
|
5574
|
+
|
|
5575
|
+
return {
|
|
5576
|
+
code: n,
|
|
5577
|
+
pos
|
|
5578
|
+
};
|
|
5579
|
+
}
|
|
5580
|
+
|
|
5581
|
+
function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
5582
|
+
var start = pos;
|
|
5583
|
+
var forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
5584
|
+
var isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
5585
|
+
var invalid = false;
|
|
5586
|
+
var total = 0;
|
|
5587
|
+
|
|
5588
|
+
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
5589
|
+
var code = input.charCodeAt(pos);
|
|
5590
|
+
var val = void 0;
|
|
5591
|
+
|
|
5592
|
+
if (code === 95 && allowNumSeparator !== "bail") {
|
|
5593
|
+
var prev = input.charCodeAt(pos - 1);
|
|
5594
|
+
var next = input.charCodeAt(pos + 1);
|
|
5595
|
+
|
|
5596
|
+
if (!allowNumSeparator) {
|
|
5597
|
+
if (bailOnError) return {
|
|
5598
|
+
n: null,
|
|
5599
|
+
pos
|
|
5600
|
+
};
|
|
5601
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
5602
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
|
|
5603
|
+
if (bailOnError) return {
|
|
5604
|
+
n: null,
|
|
5605
|
+
pos
|
|
5606
|
+
};
|
|
5607
|
+
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
5608
|
+
}
|
|
5609
|
+
|
|
5610
|
+
++pos;
|
|
5611
|
+
continue;
|
|
5612
|
+
}
|
|
5613
|
+
|
|
5614
|
+
if (code >= 97) {
|
|
5615
|
+
val = code - 97 + 10;
|
|
5616
|
+
} else if (code >= 65) {
|
|
5617
|
+
val = code - 65 + 10;
|
|
5618
|
+
} else if (_isDigit(code)) {
|
|
5619
|
+
val = code - 48;
|
|
5620
|
+
} else {
|
|
5621
|
+
val = Infinity;
|
|
5622
|
+
}
|
|
5623
|
+
|
|
5624
|
+
if (val >= radix) {
|
|
5625
|
+
if (val <= 9 && bailOnError) {
|
|
5626
|
+
return {
|
|
5627
|
+
n: null,
|
|
5628
|
+
pos
|
|
5629
|
+
};
|
|
5630
|
+
} else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
|
|
5631
|
+
val = 0;
|
|
5632
|
+
} else if (forceLen) {
|
|
5633
|
+
val = 0;
|
|
5634
|
+
invalid = true;
|
|
5635
|
+
} else {
|
|
5636
|
+
break;
|
|
5637
|
+
}
|
|
5638
|
+
}
|
|
5639
|
+
|
|
5640
|
+
++pos;
|
|
5641
|
+
total = total * radix + val;
|
|
5087
5642
|
}
|
|
5088
5643
|
|
|
5089
|
-
|
|
5090
|
-
return
|
|
5644
|
+
if (pos === start || len != null && pos - start !== len || invalid) {
|
|
5645
|
+
return {
|
|
5646
|
+
n: null,
|
|
5647
|
+
pos
|
|
5648
|
+
};
|
|
5091
5649
|
}
|
|
5092
5650
|
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5651
|
+
return {
|
|
5652
|
+
n: total,
|
|
5653
|
+
pos
|
|
5654
|
+
};
|
|
5655
|
+
}
|
|
5096
5656
|
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5657
|
+
function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
5658
|
+
var ch = input.charCodeAt(pos);
|
|
5659
|
+
var code;
|
|
5100
5660
|
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5661
|
+
if (ch === 123) {
|
|
5662
|
+
++pos;
|
|
5663
|
+
({
|
|
5664
|
+
code,
|
|
5665
|
+
pos
|
|
5666
|
+
} = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
5667
|
+
++pos;
|
|
5104
5668
|
|
|
5105
|
-
|
|
5669
|
+
if (code !== null && code > 0x10ffff) {
|
|
5670
|
+
if (throwOnInvalid) {
|
|
5671
|
+
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
5672
|
+
} else {
|
|
5673
|
+
return {
|
|
5674
|
+
code: null,
|
|
5675
|
+
pos
|
|
5676
|
+
};
|
|
5677
|
+
}
|
|
5106
5678
|
}
|
|
5107
|
-
|
|
5108
|
-
|
|
5679
|
+
} else {
|
|
5680
|
+
({
|
|
5681
|
+
code,
|
|
5682
|
+
pos
|
|
5683
|
+
} = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
5109
5684
|
}
|
|
5110
5685
|
|
|
5686
|
+
return {
|
|
5687
|
+
code,
|
|
5688
|
+
pos
|
|
5689
|
+
};
|
|
5111
5690
|
}
|
|
5112
5691
|
|
|
5113
5692
|
var _excluded$2 = ["at"],
|
|
5114
5693
|
_excluded2 = ["at"];
|
|
5115
5694
|
|
|
5116
|
-
|
|
5117
|
-
return
|
|
5118
|
-
}
|
|
5695
|
+
function buildPosition(pos, lineStart, curLine) {
|
|
5696
|
+
return new Position(curLine, pos - lineStart, pos);
|
|
5697
|
+
}
|
|
5119
5698
|
|
|
5120
5699
|
var VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
5121
|
-
var forbiddenNumericSeparatorSiblings = {
|
|
5122
|
-
decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
|
|
5123
|
-
hex: new Set([46, 88, 95, 120])
|
|
5124
|
-
};
|
|
5125
|
-
var isAllowedNumericSeparatorSibling = {
|
|
5126
|
-
bin: ch => ch === 48 || ch === 49,
|
|
5127
|
-
oct: ch => ch >= 48 && ch <= 55,
|
|
5128
|
-
dec: ch => ch >= 48 && ch <= 57,
|
|
5129
|
-
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
5130
|
-
};
|
|
5131
5700
|
|
|
5132
5701
|
class Token {
|
|
5133
5702
|
constructor(state) {
|
|
@@ -5145,6 +5714,42 @@ class Tokenizer extends CommentsParser {
|
|
|
5145
5714
|
super();
|
|
5146
5715
|
this.isLookahead = void 0;
|
|
5147
5716
|
this.tokens = [];
|
|
5717
|
+
this.errorHandlers_readInt = {
|
|
5718
|
+
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
5719
|
+
if (!this.options.errorRecovery) return false;
|
|
5720
|
+
this.raise(Errors.InvalidDigit, {
|
|
5721
|
+
at: buildPosition(pos, lineStart, curLine),
|
|
5722
|
+
radix
|
|
5723
|
+
});
|
|
5724
|
+
return true;
|
|
5725
|
+
},
|
|
5726
|
+
numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),
|
|
5727
|
+
unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator)
|
|
5728
|
+
};
|
|
5729
|
+
this.errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, {
|
|
5730
|
+
invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence),
|
|
5731
|
+
invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint)
|
|
5732
|
+
});
|
|
5733
|
+
this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
5734
|
+
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
5735
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
|
|
5736
|
+
at: buildPosition(pos, lineStart, curLine)
|
|
5737
|
+
});
|
|
5738
|
+
},
|
|
5739
|
+
unterminated: (pos, lineStart, curLine) => {
|
|
5740
|
+
throw this.raise(Errors.UnterminatedString, {
|
|
5741
|
+
at: buildPosition(pos - 1, lineStart, curLine)
|
|
5742
|
+
});
|
|
5743
|
+
}
|
|
5744
|
+
});
|
|
5745
|
+
this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
5746
|
+
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
5747
|
+
unterminated: (pos, lineStart, curLine) => {
|
|
5748
|
+
throw this.raise(Errors.UnterminatedTemplate, {
|
|
5749
|
+
at: buildPosition(pos, lineStart, curLine)
|
|
5750
|
+
});
|
|
5751
|
+
}
|
|
5752
|
+
});
|
|
5148
5753
|
this.state = new State();
|
|
5149
5754
|
this.state.init(options);
|
|
5150
5755
|
this.input = input;
|
|
@@ -5243,8 +5848,8 @@ class Tokenizer extends CommentsParser {
|
|
|
5243
5848
|
this.state.strict = strict;
|
|
5244
5849
|
|
|
5245
5850
|
if (strict) {
|
|
5246
|
-
this.state.strictErrors.forEach(
|
|
5247
|
-
var [toParseError, at] =
|
|
5851
|
+
this.state.strictErrors.forEach(_ref42 => {
|
|
5852
|
+
var [toParseError, at] = _ref42;
|
|
5248
5853
|
return this.raise(toParseError, {
|
|
5249
5854
|
at
|
|
5250
5855
|
});
|
|
@@ -5425,7 +6030,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5425
6030
|
|
|
5426
6031
|
if (comments.length > 0) {
|
|
5427
6032
|
var end = this.state.pos;
|
|
5428
|
-
var
|
|
6033
|
+
var commentWhitespace = {
|
|
5429
6034
|
start: spaceStart,
|
|
5430
6035
|
end,
|
|
5431
6036
|
comments,
|
|
@@ -5433,7 +6038,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5433
6038
|
trailingNode: null,
|
|
5434
6039
|
containingNode: null
|
|
5435
6040
|
};
|
|
5436
|
-
this.state.commentStack.push(
|
|
6041
|
+
this.state.commentStack.push(commentWhitespace);
|
|
5437
6042
|
}
|
|
5438
6043
|
}
|
|
5439
6044
|
|
|
@@ -5471,7 +6076,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5471
6076
|
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
|
|
5472
6077
|
this.expectPlugin("recordAndTuple");
|
|
5473
6078
|
|
|
5474
|
-
if (this.getPluginOption("recordAndTuple", "syntaxType")
|
|
6079
|
+
if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
|
|
5475
6080
|
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
|
|
5476
6081
|
at: this.state.curPosition()
|
|
5477
6082
|
});
|
|
@@ -6029,70 +6634,15 @@ class Tokenizer extends CommentsParser {
|
|
|
6029
6634
|
});
|
|
6030
6635
|
}
|
|
6031
6636
|
|
|
6032
|
-
readInt(radix, len
|
|
6637
|
+
readInt(radix, len) {
|
|
6638
|
+
var forceLen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6033
6639
|
var allowNumSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
6034
|
-
var
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
6041
|
-
var code = this.input.charCodeAt(this.state.pos);
|
|
6042
|
-
var val = void 0;
|
|
6043
|
-
|
|
6044
|
-
if (code === 95 && allowNumSeparator !== "bail") {
|
|
6045
|
-
var prev = this.input.charCodeAt(this.state.pos - 1);
|
|
6046
|
-
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
6047
|
-
|
|
6048
|
-
if (!allowNumSeparator) {
|
|
6049
|
-
this.raise(Errors.NumericSeparatorInEscapeSequence, {
|
|
6050
|
-
at: this.state.curPosition()
|
|
6051
|
-
});
|
|
6052
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
|
|
6053
|
-
this.raise(Errors.UnexpectedNumericSeparator, {
|
|
6054
|
-
at: this.state.curPosition()
|
|
6055
|
-
});
|
|
6056
|
-
}
|
|
6057
|
-
|
|
6058
|
-
++this.state.pos;
|
|
6059
|
-
continue;
|
|
6060
|
-
}
|
|
6061
|
-
|
|
6062
|
-
if (code >= 97) {
|
|
6063
|
-
val = code - 97 + 10;
|
|
6064
|
-
} else if (code >= 65) {
|
|
6065
|
-
val = code - 65 + 10;
|
|
6066
|
-
} else if (_isDigit(code)) {
|
|
6067
|
-
val = code - 48;
|
|
6068
|
-
} else {
|
|
6069
|
-
val = Infinity;
|
|
6070
|
-
}
|
|
6071
|
-
|
|
6072
|
-
if (val >= radix) {
|
|
6073
|
-
if (this.options.errorRecovery && val <= 9) {
|
|
6074
|
-
val = 0;
|
|
6075
|
-
this.raise(Errors.InvalidDigit, {
|
|
6076
|
-
at: this.state.curPosition(),
|
|
6077
|
-
radix
|
|
6078
|
-
});
|
|
6079
|
-
} else if (forceLen) {
|
|
6080
|
-
val = 0;
|
|
6081
|
-
invalid = true;
|
|
6082
|
-
} else {
|
|
6083
|
-
break;
|
|
6084
|
-
}
|
|
6085
|
-
}
|
|
6086
|
-
|
|
6087
|
-
++this.state.pos;
|
|
6088
|
-
total = total * radix + val;
|
|
6089
|
-
}
|
|
6090
|
-
|
|
6091
|
-
if (this.state.pos === start || len != null && this.state.pos - start !== len || invalid) {
|
|
6092
|
-
return null;
|
|
6093
|
-
}
|
|
6094
|
-
|
|
6095
|
-
return total;
|
|
6640
|
+
var {
|
|
6641
|
+
n,
|
|
6642
|
+
pos
|
|
6643
|
+
} = readInt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt, false);
|
|
6644
|
+
this.state.pos = pos;
|
|
6645
|
+
return n;
|
|
6096
6646
|
}
|
|
6097
6647
|
|
|
6098
6648
|
readRadixNumber(radix) {
|
|
@@ -6244,63 +6794,25 @@ class Tokenizer extends CommentsParser {
|
|
|
6244
6794
|
}
|
|
6245
6795
|
|
|
6246
6796
|
readCodePoint(throwOnInvalid) {
|
|
6247
|
-
var
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, true, throwOnInvalid);
|
|
6253
|
-
++this.state.pos;
|
|
6254
|
-
|
|
6255
|
-
if (code !== null && code > 0x10ffff) {
|
|
6256
|
-
if (throwOnInvalid) {
|
|
6257
|
-
this.raise(Errors.InvalidCodePoint, {
|
|
6258
|
-
at: this.state.curPosition()
|
|
6259
|
-
});
|
|
6260
|
-
} else {
|
|
6261
|
-
return null;
|
|
6262
|
-
}
|
|
6263
|
-
}
|
|
6264
|
-
} else {
|
|
6265
|
-
code = this.readHexChar(4, false, throwOnInvalid);
|
|
6266
|
-
}
|
|
6267
|
-
|
|
6797
|
+
var {
|
|
6798
|
+
code,
|
|
6799
|
+
pos
|
|
6800
|
+
} = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
|
|
6801
|
+
this.state.pos = pos;
|
|
6268
6802
|
return code;
|
|
6269
6803
|
}
|
|
6270
6804
|
|
|
6271
6805
|
readString(quote) {
|
|
6272
|
-
var
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
var ch = this.input.charCodeAt(this.state.pos);
|
|
6283
|
-
if (ch === quote) break;
|
|
6284
|
-
|
|
6285
|
-
if (ch === 92) {
|
|
6286
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6287
|
-
out += this.readEscapedChar(false);
|
|
6288
|
-
chunkStart = this.state.pos;
|
|
6289
|
-
} else if (ch === 8232 || ch === 8233) {
|
|
6290
|
-
++this.state.pos;
|
|
6291
|
-
++this.state.curLine;
|
|
6292
|
-
this.state.lineStart = this.state.pos;
|
|
6293
|
-
} else if (isNewLine(ch)) {
|
|
6294
|
-
throw this.raise(Errors.UnterminatedString, {
|
|
6295
|
-
at: this.state.startLoc
|
|
6296
|
-
});
|
|
6297
|
-
} else {
|
|
6298
|
-
++this.state.pos;
|
|
6299
|
-
}
|
|
6300
|
-
}
|
|
6301
|
-
|
|
6302
|
-
out += this.input.slice(chunkStart, this.state.pos++);
|
|
6303
|
-
this.finishToken(129, out);
|
|
6806
|
+
var {
|
|
6807
|
+
str,
|
|
6808
|
+
pos,
|
|
6809
|
+
curLine,
|
|
6810
|
+
lineStart
|
|
6811
|
+
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
6812
|
+
this.state.pos = pos + 1;
|
|
6813
|
+
this.state.lineStart = lineStart;
|
|
6814
|
+
this.state.curLine = curLine;
|
|
6815
|
+
this.finishToken(129, str);
|
|
6304
6816
|
}
|
|
6305
6817
|
|
|
6306
6818
|
readTemplateContinuation() {
|
|
@@ -6313,195 +6825,43 @@ class Tokenizer extends CommentsParser {
|
|
|
6313
6825
|
}
|
|
6314
6826
|
|
|
6315
6827
|
readTemplateToken() {
|
|
6316
|
-
var
|
|
6317
|
-
chunkStart = this.state.pos,
|
|
6318
|
-
containsInvalid = false;
|
|
6319
|
-
++this.state.pos;
|
|
6320
|
-
|
|
6321
|
-
for (;;) {
|
|
6322
|
-
if (this.state.pos >= this.length) {
|
|
6323
|
-
throw this.raise(Errors.UnterminatedTemplate, {
|
|
6324
|
-
at: createPositionWithColumnOffset(this.state.startLoc, 1)
|
|
6325
|
-
});
|
|
6326
|
-
}
|
|
6327
|
-
|
|
6328
|
-
var ch = this.input.charCodeAt(this.state.pos);
|
|
6329
|
-
|
|
6330
|
-
if (ch === 96) {
|
|
6331
|
-
++this.state.pos;
|
|
6332
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6333
|
-
this.finishToken(24, containsInvalid ? null : out);
|
|
6334
|
-
return;
|
|
6335
|
-
}
|
|
6336
|
-
|
|
6337
|
-
if (ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
|
|
6338
|
-
this.state.pos += 2;
|
|
6339
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6340
|
-
this.finishToken(25, containsInvalid ? null : out);
|
|
6341
|
-
return;
|
|
6342
|
-
}
|
|
6343
|
-
|
|
6344
|
-
if (ch === 92) {
|
|
6345
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6346
|
-
var escaped = this.readEscapedChar(true);
|
|
6347
|
-
|
|
6348
|
-
if (escaped === null) {
|
|
6349
|
-
containsInvalid = true;
|
|
6350
|
-
} else {
|
|
6351
|
-
out += escaped;
|
|
6352
|
-
}
|
|
6353
|
-
|
|
6354
|
-
chunkStart = this.state.pos;
|
|
6355
|
-
} else if (isNewLine(ch)) {
|
|
6356
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6357
|
-
++this.state.pos;
|
|
6358
|
-
|
|
6359
|
-
switch (ch) {
|
|
6360
|
-
case 13:
|
|
6361
|
-
if (this.input.charCodeAt(this.state.pos) === 10) {
|
|
6362
|
-
++this.state.pos;
|
|
6363
|
-
}
|
|
6364
|
-
|
|
6365
|
-
case 10:
|
|
6366
|
-
out += "\n";
|
|
6367
|
-
break;
|
|
6368
|
-
|
|
6369
|
-
default:
|
|
6370
|
-
out += String.fromCharCode(ch);
|
|
6371
|
-
break;
|
|
6372
|
-
}
|
|
6373
|
-
|
|
6374
|
-
++this.state.curLine;
|
|
6375
|
-
this.state.lineStart = this.state.pos;
|
|
6376
|
-
chunkStart = this.state.pos;
|
|
6377
|
-
} else {
|
|
6378
|
-
++this.state.pos;
|
|
6379
|
-
}
|
|
6380
|
-
}
|
|
6381
|
-
}
|
|
6382
|
-
|
|
6383
|
-
recordStrictModeErrors(toParseError, _ref42) {
|
|
6828
|
+
var opening = this.input[this.state.pos];
|
|
6384
6829
|
var {
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
case 110:
|
|
6405
|
-
return "\n";
|
|
6406
|
-
|
|
6407
|
-
case 114:
|
|
6408
|
-
return "\r";
|
|
6409
|
-
|
|
6410
|
-
case 120:
|
|
6411
|
-
{
|
|
6412
|
-
var code = this.readHexChar(2, false, throwOnInvalid);
|
|
6413
|
-
return code === null ? null : String.fromCharCode(code);
|
|
6414
|
-
}
|
|
6415
|
-
|
|
6416
|
-
case 117:
|
|
6417
|
-
{
|
|
6418
|
-
var _code = this.readCodePoint(throwOnInvalid);
|
|
6419
|
-
|
|
6420
|
-
return _code === null ? null : String.fromCodePoint(_code);
|
|
6421
|
-
}
|
|
6422
|
-
|
|
6423
|
-
case 116:
|
|
6424
|
-
return "\t";
|
|
6425
|
-
|
|
6426
|
-
case 98:
|
|
6427
|
-
return "\b";
|
|
6428
|
-
|
|
6429
|
-
case 118:
|
|
6430
|
-
return "\u000b";
|
|
6431
|
-
|
|
6432
|
-
case 102:
|
|
6433
|
-
return "\f";
|
|
6434
|
-
|
|
6435
|
-
case 13:
|
|
6436
|
-
if (this.input.charCodeAt(this.state.pos) === 10) {
|
|
6437
|
-
++this.state.pos;
|
|
6438
|
-
}
|
|
6439
|
-
|
|
6440
|
-
case 10:
|
|
6441
|
-
this.state.lineStart = this.state.pos;
|
|
6442
|
-
++this.state.curLine;
|
|
6443
|
-
|
|
6444
|
-
case 8232:
|
|
6445
|
-
case 8233:
|
|
6446
|
-
return "";
|
|
6447
|
-
|
|
6448
|
-
case 56:
|
|
6449
|
-
case 57:
|
|
6450
|
-
if (inTemplate) {
|
|
6451
|
-
return null;
|
|
6452
|
-
} else {
|
|
6453
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
|
|
6454
|
-
at: createPositionWithColumnOffset(this.state.curPosition(), -1)
|
|
6455
|
-
});
|
|
6456
|
-
}
|
|
6457
|
-
|
|
6458
|
-
default:
|
|
6459
|
-
if (ch >= 48 && ch <= 55) {
|
|
6460
|
-
var codePos = createPositionWithColumnOffset(this.state.curPosition(), -1);
|
|
6461
|
-
var match = this.input.slice(this.state.pos - 1, this.state.pos + 2).match(/^[0-7]+/);
|
|
6462
|
-
var octalStr = match[0];
|
|
6463
|
-
var octal = parseInt(octalStr, 8);
|
|
6464
|
-
|
|
6465
|
-
if (octal > 255) {
|
|
6466
|
-
octalStr = octalStr.slice(0, -1);
|
|
6467
|
-
octal = parseInt(octalStr, 8);
|
|
6468
|
-
}
|
|
6469
|
-
|
|
6470
|
-
this.state.pos += octalStr.length - 1;
|
|
6471
|
-
var next = this.input.charCodeAt(this.state.pos);
|
|
6472
|
-
|
|
6473
|
-
if (octalStr !== "0" || next === 56 || next === 57) {
|
|
6474
|
-
if (inTemplate) {
|
|
6475
|
-
return null;
|
|
6476
|
-
} else {
|
|
6477
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
|
|
6478
|
-
at: codePos
|
|
6479
|
-
});
|
|
6480
|
-
}
|
|
6481
|
-
}
|
|
6482
|
-
|
|
6483
|
-
return String.fromCharCode(octal);
|
|
6484
|
-
}
|
|
6485
|
-
|
|
6486
|
-
return String.fromCharCode(ch);
|
|
6830
|
+
str,
|
|
6831
|
+
firstInvalidLoc,
|
|
6832
|
+
pos,
|
|
6833
|
+
curLine,
|
|
6834
|
+
lineStart
|
|
6835
|
+
} = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
6836
|
+
this.state.pos = pos + 1;
|
|
6837
|
+
this.state.lineStart = lineStart;
|
|
6838
|
+
this.state.curLine = curLine;
|
|
6839
|
+
|
|
6840
|
+
if (firstInvalidLoc) {
|
|
6841
|
+
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
|
|
6842
|
+
}
|
|
6843
|
+
|
|
6844
|
+
if (this.input.codePointAt(pos) === 96) {
|
|
6845
|
+
this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
|
|
6846
|
+
} else {
|
|
6847
|
+
this.state.pos++;
|
|
6848
|
+
this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
|
|
6487
6849
|
}
|
|
6488
6850
|
}
|
|
6489
6851
|
|
|
6490
|
-
|
|
6491
|
-
var
|
|
6492
|
-
|
|
6852
|
+
recordStrictModeErrors(toParseError, _ref43) {
|
|
6853
|
+
var {
|
|
6854
|
+
at
|
|
6855
|
+
} = _ref43;
|
|
6856
|
+
var index = at.index;
|
|
6493
6857
|
|
|
6494
|
-
if (
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
this.state.pos = codeLoc.index - 1;
|
|
6501
|
-
}
|
|
6858
|
+
if (this.state.strict && !this.state.strictErrors.has(index)) {
|
|
6859
|
+
this.raise(toParseError, {
|
|
6860
|
+
at
|
|
6861
|
+
});
|
|
6862
|
+
} else {
|
|
6863
|
+
this.state.strictErrors.set(index, [toParseError, at]);
|
|
6502
6864
|
}
|
|
6503
|
-
|
|
6504
|
-
return n;
|
|
6505
6865
|
}
|
|
6506
6866
|
|
|
6507
6867
|
readWord1(firstCode) {
|
|
@@ -6650,229 +7010,12 @@ class Tokenizer extends CommentsParser {
|
|
|
6650
7010
|
}
|
|
6651
7011
|
}
|
|
6652
7012
|
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
this.var = new Set();
|
|
6658
|
-
this.lexical = new Set();
|
|
6659
|
-
this.functions = new Set();
|
|
6660
|
-
this.flags = flags;
|
|
6661
|
-
}
|
|
6662
|
-
|
|
6663
|
-
}
|
|
6664
|
-
|
|
6665
|
-
class ScopeHandler {
|
|
6666
|
-
constructor(parser, inModule) {
|
|
6667
|
-
this.parser = void 0;
|
|
6668
|
-
this.scopeStack = [];
|
|
6669
|
-
this.inModule = void 0;
|
|
6670
|
-
this.undefinedExports = new Map();
|
|
6671
|
-
this.parser = parser;
|
|
6672
|
-
this.inModule = inModule;
|
|
6673
|
-
}
|
|
6674
|
-
|
|
6675
|
-
get inFunction() {
|
|
6676
|
-
return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
6677
|
-
}
|
|
6678
|
-
|
|
6679
|
-
get allowSuper() {
|
|
6680
|
-
return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;
|
|
6681
|
-
}
|
|
6682
|
-
|
|
6683
|
-
get allowDirectSuper() {
|
|
6684
|
-
return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;
|
|
6685
|
-
}
|
|
6686
|
-
|
|
6687
|
-
get inClass() {
|
|
6688
|
-
return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;
|
|
6689
|
-
}
|
|
6690
|
-
|
|
6691
|
-
get inClassAndNotInNonArrowFunction() {
|
|
6692
|
-
var flags = this.currentThisScopeFlags();
|
|
6693
|
-
return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
|
|
6694
|
-
}
|
|
6695
|
-
|
|
6696
|
-
get inStaticBlock() {
|
|
6697
|
-
for (var i = this.scopeStack.length - 1;; i--) {
|
|
6698
|
-
var {
|
|
6699
|
-
flags
|
|
6700
|
-
} = this.scopeStack[i];
|
|
6701
|
-
|
|
6702
|
-
if (flags & SCOPE_STATIC_BLOCK) {
|
|
6703
|
-
return true;
|
|
6704
|
-
}
|
|
6705
|
-
|
|
6706
|
-
if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
|
|
6707
|
-
return false;
|
|
6708
|
-
}
|
|
6709
|
-
}
|
|
6710
|
-
}
|
|
6711
|
-
|
|
6712
|
-
get inNonArrowFunction() {
|
|
6713
|
-
return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
6714
|
-
}
|
|
6715
|
-
|
|
6716
|
-
get treatFunctionsAsVar() {
|
|
6717
|
-
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
6718
|
-
}
|
|
6719
|
-
|
|
6720
|
-
createScope(flags) {
|
|
6721
|
-
return new Scope(flags);
|
|
6722
|
-
}
|
|
6723
|
-
|
|
6724
|
-
enter(flags) {
|
|
6725
|
-
this.scopeStack.push(this.createScope(flags));
|
|
6726
|
-
}
|
|
6727
|
-
|
|
6728
|
-
exit() {
|
|
6729
|
-
this.scopeStack.pop();
|
|
6730
|
-
}
|
|
6731
|
-
|
|
6732
|
-
treatFunctionsAsVarInScope(scope) {
|
|
6733
|
-
return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
|
|
6734
|
-
}
|
|
6735
|
-
|
|
6736
|
-
declareName(name, bindingType, loc) {
|
|
6737
|
-
var scope = this.currentScope();
|
|
6738
|
-
|
|
6739
|
-
if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {
|
|
6740
|
-
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
6741
|
-
|
|
6742
|
-
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
6743
|
-
scope.functions.add(name);
|
|
6744
|
-
} else {
|
|
6745
|
-
scope.lexical.add(name);
|
|
6746
|
-
}
|
|
6747
|
-
|
|
6748
|
-
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
6749
|
-
this.maybeExportDefined(scope, name);
|
|
6750
|
-
}
|
|
6751
|
-
} else if (bindingType & BIND_SCOPE_VAR) {
|
|
6752
|
-
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
6753
|
-
scope = this.scopeStack[i];
|
|
6754
|
-
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
6755
|
-
scope.var.add(name);
|
|
6756
|
-
this.maybeExportDefined(scope, name);
|
|
6757
|
-
if (scope.flags & SCOPE_VAR) break;
|
|
6758
|
-
}
|
|
6759
|
-
}
|
|
6760
|
-
|
|
6761
|
-
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
6762
|
-
this.undefinedExports.delete(name);
|
|
6763
|
-
}
|
|
6764
|
-
}
|
|
6765
|
-
|
|
6766
|
-
maybeExportDefined(scope, name) {
|
|
6767
|
-
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
6768
|
-
this.undefinedExports.delete(name);
|
|
6769
|
-
}
|
|
6770
|
-
}
|
|
6771
|
-
|
|
6772
|
-
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
6773
|
-
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
6774
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
6775
|
-
at: loc,
|
|
6776
|
-
identifierName: name
|
|
7013
|
+
errorBuilder(error) {
|
|
7014
|
+
return (pos, lineStart, curLine) => {
|
|
7015
|
+
this.raise(error, {
|
|
7016
|
+
at: buildPosition(pos, lineStart, curLine)
|
|
6777
7017
|
});
|
|
6778
|
-
}
|
|
6779
|
-
}
|
|
6780
|
-
|
|
6781
|
-
isRedeclaredInScope(scope, name, bindingType) {
|
|
6782
|
-
if (!(bindingType & BIND_KIND_VALUE)) return false;
|
|
6783
|
-
|
|
6784
|
-
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
6785
|
-
return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
|
|
6786
|
-
}
|
|
6787
|
-
|
|
6788
|
-
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
6789
|
-
return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
|
|
6790
|
-
}
|
|
6791
|
-
|
|
6792
|
-
return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
|
|
6793
|
-
}
|
|
6794
|
-
|
|
6795
|
-
checkLocalExport(id) {
|
|
6796
|
-
var {
|
|
6797
|
-
name
|
|
6798
|
-
} = id;
|
|
6799
|
-
var topLevelScope = this.scopeStack[0];
|
|
6800
|
-
|
|
6801
|
-
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
|
|
6802
|
-
this.undefinedExports.set(name, id.loc.start);
|
|
6803
|
-
}
|
|
6804
|
-
}
|
|
6805
|
-
|
|
6806
|
-
currentScope() {
|
|
6807
|
-
return this.scopeStack[this.scopeStack.length - 1];
|
|
6808
|
-
}
|
|
6809
|
-
|
|
6810
|
-
currentVarScopeFlags() {
|
|
6811
|
-
for (var i = this.scopeStack.length - 1;; i--) {
|
|
6812
|
-
var {
|
|
6813
|
-
flags
|
|
6814
|
-
} = this.scopeStack[i];
|
|
6815
|
-
|
|
6816
|
-
if (flags & SCOPE_VAR) {
|
|
6817
|
-
return flags;
|
|
6818
|
-
}
|
|
6819
|
-
}
|
|
6820
|
-
}
|
|
6821
|
-
|
|
6822
|
-
currentThisScopeFlags() {
|
|
6823
|
-
for (var i = this.scopeStack.length - 1;; i--) {
|
|
6824
|
-
var {
|
|
6825
|
-
flags
|
|
6826
|
-
} = this.scopeStack[i];
|
|
6827
|
-
|
|
6828
|
-
if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {
|
|
6829
|
-
return flags;
|
|
6830
|
-
}
|
|
6831
|
-
}
|
|
6832
|
-
}
|
|
6833
|
-
|
|
6834
|
-
}
|
|
6835
|
-
|
|
6836
|
-
class FlowScope extends Scope {
|
|
6837
|
-
constructor() {
|
|
6838
|
-
super(...arguments);
|
|
6839
|
-
this.declareFunctions = new Set();
|
|
6840
|
-
}
|
|
6841
|
-
|
|
6842
|
-
}
|
|
6843
|
-
|
|
6844
|
-
class FlowScopeHandler extends ScopeHandler {
|
|
6845
|
-
createScope(flags) {
|
|
6846
|
-
return new FlowScope(flags);
|
|
6847
|
-
}
|
|
6848
|
-
|
|
6849
|
-
declareName(name, bindingType, loc) {
|
|
6850
|
-
var scope = this.currentScope();
|
|
6851
|
-
|
|
6852
|
-
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
6853
|
-
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
6854
|
-
this.maybeExportDefined(scope, name);
|
|
6855
|
-
scope.declareFunctions.add(name);
|
|
6856
|
-
return;
|
|
6857
|
-
}
|
|
6858
|
-
|
|
6859
|
-
super.declareName(...arguments);
|
|
6860
|
-
}
|
|
6861
|
-
|
|
6862
|
-
isRedeclaredInScope(scope, name, bindingType) {
|
|
6863
|
-
if (super.isRedeclaredInScope(...arguments)) return true;
|
|
6864
|
-
|
|
6865
|
-
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
6866
|
-
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
|
|
6867
|
-
}
|
|
6868
|
-
|
|
6869
|
-
return false;
|
|
6870
|
-
}
|
|
6871
|
-
|
|
6872
|
-
checkLocalExport(id) {
|
|
6873
|
-
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
|
|
6874
|
-
super.checkLocalExport(id);
|
|
6875
|
-
}
|
|
7018
|
+
};
|
|
6876
7019
|
}
|
|
6877
7020
|
|
|
6878
7021
|
}
|
|
@@ -7001,10 +7144,10 @@ class ArrowHeadParsingScope extends ExpressionScope {
|
|
|
7001
7144
|
this.declarationErrors = new Map();
|
|
7002
7145
|
}
|
|
7003
7146
|
|
|
7004
|
-
recordDeclarationError(ParsingErrorClass,
|
|
7147
|
+
recordDeclarationError(ParsingErrorClass, _ref44) {
|
|
7005
7148
|
var {
|
|
7006
7149
|
at
|
|
7007
|
-
} =
|
|
7150
|
+
} = _ref44;
|
|
7008
7151
|
var index = at.index;
|
|
7009
7152
|
this.declarationErrors.set(index, [ParsingErrorClass, at]);
|
|
7010
7153
|
}
|
|
@@ -7034,10 +7177,10 @@ class ExpressionScopeHandler {
|
|
|
7034
7177
|
this.stack.pop();
|
|
7035
7178
|
}
|
|
7036
7179
|
|
|
7037
|
-
recordParameterInitializerError(toParseError,
|
|
7180
|
+
recordParameterInitializerError(toParseError, _ref45) {
|
|
7038
7181
|
var {
|
|
7039
7182
|
at: node
|
|
7040
|
-
} =
|
|
7183
|
+
} = _ref45;
|
|
7041
7184
|
var origin = {
|
|
7042
7185
|
at: node.loc.start
|
|
7043
7186
|
};
|
|
@@ -7060,10 +7203,10 @@ class ExpressionScopeHandler {
|
|
|
7060
7203
|
this.parser.raise(toParseError, origin);
|
|
7061
7204
|
}
|
|
7062
7205
|
|
|
7063
|
-
recordArrowParemeterBindingError(error,
|
|
7206
|
+
recordArrowParemeterBindingError(error, _ref46) {
|
|
7064
7207
|
var {
|
|
7065
7208
|
at: node
|
|
7066
|
-
} =
|
|
7209
|
+
} = _ref46;
|
|
7067
7210
|
var {
|
|
7068
7211
|
stack
|
|
7069
7212
|
} = this;
|
|
@@ -7081,10 +7224,10 @@ class ExpressionScopeHandler {
|
|
|
7081
7224
|
}
|
|
7082
7225
|
}
|
|
7083
7226
|
|
|
7084
|
-
recordAsyncArrowParametersError(
|
|
7227
|
+
recordAsyncArrowParametersError(_ref47) {
|
|
7085
7228
|
var {
|
|
7086
7229
|
at
|
|
7087
|
-
} =
|
|
7230
|
+
} = _ref47;
|
|
7088
7231
|
var {
|
|
7089
7232
|
stack
|
|
7090
7233
|
} = this;
|
|
@@ -7108,8 +7251,8 @@ class ExpressionScopeHandler {
|
|
|
7108
7251
|
} = this;
|
|
7109
7252
|
var currentScope = stack[stack.length - 1];
|
|
7110
7253
|
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
7111
|
-
currentScope.iterateErrors(
|
|
7112
|
-
var [toParseError, loc] =
|
|
7254
|
+
currentScope.iterateErrors(_ref48 => {
|
|
7255
|
+
var [toParseError, loc] = _ref48;
|
|
7113
7256
|
this.parser.raise(toParseError, {
|
|
7114
7257
|
at: loc
|
|
7115
7258
|
});
|
|
@@ -7474,7 +7617,7 @@ class Node {
|
|
|
7474
7617
|
var NodePrototype = Node.prototype;
|
|
7475
7618
|
{
|
|
7476
7619
|
NodePrototype.__clone = function () {
|
|
7477
|
-
var newNode = new Node();
|
|
7620
|
+
var newNode = new Node(undefined, this.start, this.loc.start);
|
|
7478
7621
|
var keys = Object.keys(this);
|
|
7479
7622
|
|
|
7480
7623
|
for (var i = 0, length = keys.length; i < length; i++) {
|
|
@@ -7596,138 +7739,140 @@ class NodeUtils extends UtilParser {
|
|
|
7596
7739
|
}
|
|
7597
7740
|
|
|
7598
7741
|
var reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
|
|
7599
|
-
var FlowErrors = ParseErrorEnum(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flow"])))(
|
|
7600
|
-
AmbiguousConditionalArrow:
|
|
7601
|
-
AmbiguousDeclareModuleKind:
|
|
7602
|
-
AssignReservedType:
|
|
7742
|
+
var FlowErrors = ParseErrorEnum(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flow"])))({
|
|
7743
|
+
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
7744
|
+
AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
|
|
7745
|
+
AssignReservedType: _ref49 => {
|
|
7603
7746
|
var {
|
|
7604
7747
|
reservedType
|
|
7605
|
-
} =
|
|
7748
|
+
} = _ref49;
|
|
7606
7749
|
return "Cannot overwrite reserved type ".concat(reservedType, ".");
|
|
7607
|
-
}
|
|
7608
|
-
DeclareClassElement:
|
|
7609
|
-
DeclareClassFieldInitializer:
|
|
7610
|
-
DuplicateDeclareModuleExports:
|
|
7611
|
-
EnumBooleanMemberNotInitialized:
|
|
7750
|
+
},
|
|
7751
|
+
DeclareClassElement: "The `declare` modifier can only appear on class fields.",
|
|
7752
|
+
DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
|
|
7753
|
+
DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
|
|
7754
|
+
EnumBooleanMemberNotInitialized: _ref50 => {
|
|
7612
7755
|
var {
|
|
7613
7756
|
memberName,
|
|
7614
7757
|
enumName
|
|
7615
|
-
} =
|
|
7758
|
+
} = _ref50;
|
|
7616
7759
|
return "Boolean enum members need to be initialized. Use either `".concat(memberName, " = true,` or `").concat(memberName, " = false,` in enum `").concat(enumName, "`.");
|
|
7617
|
-
}
|
|
7618
|
-
EnumDuplicateMemberName:
|
|
7760
|
+
},
|
|
7761
|
+
EnumDuplicateMemberName: _ref51 => {
|
|
7619
7762
|
var {
|
|
7620
7763
|
memberName,
|
|
7621
7764
|
enumName
|
|
7622
|
-
} =
|
|
7765
|
+
} = _ref51;
|
|
7623
7766
|
return "Enum member names need to be unique, but the name `".concat(memberName, "` has already been used before in enum `").concat(enumName, "`.");
|
|
7624
|
-
}
|
|
7625
|
-
EnumInconsistentMemberValues:
|
|
7767
|
+
},
|
|
7768
|
+
EnumInconsistentMemberValues: _ref52 => {
|
|
7626
7769
|
var {
|
|
7627
7770
|
enumName
|
|
7628
|
-
} =
|
|
7771
|
+
} = _ref52;
|
|
7629
7772
|
return "Enum `".concat(enumName, "` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.");
|
|
7630
|
-
}
|
|
7631
|
-
EnumInvalidExplicitType:
|
|
7773
|
+
},
|
|
7774
|
+
EnumInvalidExplicitType: _ref53 => {
|
|
7632
7775
|
var {
|
|
7633
7776
|
invalidEnumType,
|
|
7634
7777
|
enumName
|
|
7635
|
-
} =
|
|
7778
|
+
} = _ref53;
|
|
7636
7779
|
return "Enum type `".concat(invalidEnumType, "` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `").concat(enumName, "`.");
|
|
7637
|
-
}
|
|
7638
|
-
EnumInvalidExplicitTypeUnknownSupplied:
|
|
7780
|
+
},
|
|
7781
|
+
EnumInvalidExplicitTypeUnknownSupplied: _ref54 => {
|
|
7639
7782
|
var {
|
|
7640
7783
|
enumName
|
|
7641
|
-
} =
|
|
7784
|
+
} = _ref54;
|
|
7642
7785
|
return "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `".concat(enumName, "`.");
|
|
7643
|
-
}
|
|
7644
|
-
EnumInvalidMemberInitializerPrimaryType:
|
|
7786
|
+
},
|
|
7787
|
+
EnumInvalidMemberInitializerPrimaryType: _ref55 => {
|
|
7645
7788
|
var {
|
|
7646
7789
|
enumName,
|
|
7647
7790
|
memberName,
|
|
7648
7791
|
explicitType
|
|
7649
|
-
} =
|
|
7792
|
+
} = _ref55;
|
|
7650
7793
|
return "Enum `".concat(enumName, "` has type `").concat(explicitType, "`, so the initializer of `").concat(memberName, "` needs to be a ").concat(explicitType, " literal.");
|
|
7651
|
-
}
|
|
7652
|
-
EnumInvalidMemberInitializerSymbolType:
|
|
7794
|
+
},
|
|
7795
|
+
EnumInvalidMemberInitializerSymbolType: _ref56 => {
|
|
7653
7796
|
var {
|
|
7654
7797
|
enumName,
|
|
7655
7798
|
memberName
|
|
7656
|
-
} =
|
|
7799
|
+
} = _ref56;
|
|
7657
7800
|
return "Symbol enum members cannot be initialized. Use `".concat(memberName, ",` in enum `").concat(enumName, "`.");
|
|
7658
|
-
}
|
|
7659
|
-
EnumInvalidMemberInitializerUnknownType:
|
|
7801
|
+
},
|
|
7802
|
+
EnumInvalidMemberInitializerUnknownType: _ref57 => {
|
|
7660
7803
|
var {
|
|
7661
7804
|
enumName,
|
|
7662
7805
|
memberName
|
|
7663
|
-
} =
|
|
7806
|
+
} = _ref57;
|
|
7664
7807
|
return "The enum member initializer for `".concat(memberName, "` needs to be a literal (either a boolean, number, or string) in enum `").concat(enumName, "`.");
|
|
7665
|
-
}
|
|
7666
|
-
EnumInvalidMemberName:
|
|
7808
|
+
},
|
|
7809
|
+
EnumInvalidMemberName: _ref58 => {
|
|
7667
7810
|
var {
|
|
7668
7811
|
enumName,
|
|
7669
7812
|
memberName,
|
|
7670
7813
|
suggestion
|
|
7671
|
-
} =
|
|
7814
|
+
} = _ref58;
|
|
7672
7815
|
return "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `".concat(memberName, "`, consider using `").concat(suggestion, "`, in enum `").concat(enumName, "`.");
|
|
7673
|
-
}
|
|
7674
|
-
EnumNumberMemberNotInitialized:
|
|
7816
|
+
},
|
|
7817
|
+
EnumNumberMemberNotInitialized: _ref59 => {
|
|
7675
7818
|
var {
|
|
7676
7819
|
enumName,
|
|
7677
7820
|
memberName
|
|
7678
|
-
} =
|
|
7821
|
+
} = _ref59;
|
|
7679
7822
|
return "Number enum members need to be initialized, e.g. `".concat(memberName, " = 1` in enum `").concat(enumName, "`.");
|
|
7680
|
-
}
|
|
7681
|
-
EnumStringMemberInconsistentlyInitailized:
|
|
7823
|
+
},
|
|
7824
|
+
EnumStringMemberInconsistentlyInitailized: _ref60 => {
|
|
7682
7825
|
var {
|
|
7683
7826
|
enumName
|
|
7684
|
-
} =
|
|
7827
|
+
} = _ref60;
|
|
7685
7828
|
return "String enum members need to consistently either all use initializers, or use no initializers, in enum `".concat(enumName, "`.");
|
|
7686
|
-
}
|
|
7687
|
-
GetterMayNotHaveThisParam:
|
|
7688
|
-
ImportTypeShorthandOnlyInPureImport:
|
|
7689
|
-
InexactInsideExact:
|
|
7690
|
-
InexactInsideNonObject:
|
|
7691
|
-
InexactVariance:
|
|
7692
|
-
InvalidNonTypeImportInDeclareModule:
|
|
7693
|
-
MissingTypeParamDefault:
|
|
7694
|
-
NestedDeclareModule:
|
|
7695
|
-
NestedFlowComment:
|
|
7696
|
-
PatternIsOptional:
|
|
7829
|
+
},
|
|
7830
|
+
GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
|
|
7831
|
+
ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
|
|
7832
|
+
InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
|
|
7833
|
+
InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
|
|
7834
|
+
InexactVariance: "Explicit inexact syntax cannot have variance.",
|
|
7835
|
+
InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
|
|
7836
|
+
MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
|
|
7837
|
+
NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
|
|
7838
|
+
NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
|
|
7839
|
+
PatternIsOptional: Object.assign({
|
|
7840
|
+
message: "A binding pattern parameter cannot be optional in an implementation signature."
|
|
7841
|
+
}, {
|
|
7697
7842
|
reasonCode: "OptionalBindingPattern"
|
|
7698
7843
|
}),
|
|
7699
|
-
SetterMayNotHaveThisParam:
|
|
7700
|
-
SpreadVariance:
|
|
7701
|
-
ThisParamAnnotationRequired:
|
|
7702
|
-
ThisParamBannedInConstructor:
|
|
7703
|
-
ThisParamMayNotBeOptional:
|
|
7704
|
-
ThisParamMustBeFirst:
|
|
7705
|
-
ThisParamNoDefault:
|
|
7706
|
-
TypeBeforeInitializer:
|
|
7707
|
-
TypeCastInPattern:
|
|
7708
|
-
UnexpectedExplicitInexactInObject:
|
|
7709
|
-
UnexpectedReservedType:
|
|
7844
|
+
SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
|
|
7845
|
+
SpreadVariance: "Spread properties cannot have variance.",
|
|
7846
|
+
ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
|
|
7847
|
+
ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
|
|
7848
|
+
ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
|
|
7849
|
+
ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
|
|
7850
|
+
ThisParamNoDefault: "The `this` parameter may not have a default value.",
|
|
7851
|
+
TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
7852
|
+
TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
|
|
7853
|
+
UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
|
|
7854
|
+
UnexpectedReservedType: _ref61 => {
|
|
7710
7855
|
var {
|
|
7711
7856
|
reservedType
|
|
7712
|
-
} =
|
|
7857
|
+
} = _ref61;
|
|
7713
7858
|
return "Unexpected reserved type ".concat(reservedType, ".");
|
|
7714
|
-
}
|
|
7715
|
-
UnexpectedReservedUnderscore:
|
|
7716
|
-
UnexpectedSpaceBetweenModuloChecks:
|
|
7717
|
-
UnexpectedSpreadType:
|
|
7718
|
-
UnexpectedSubtractionOperand:
|
|
7719
|
-
UnexpectedTokenAfterTypeParameter:
|
|
7720
|
-
UnexpectedTypeParameterBeforeAsyncArrowFunction:
|
|
7721
|
-
UnsupportedDeclareExportKind:
|
|
7859
|
+
},
|
|
7860
|
+
UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
|
|
7861
|
+
UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
|
|
7862
|
+
UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
|
|
7863
|
+
UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".',
|
|
7864
|
+
UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
|
|
7865
|
+
UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
|
|
7866
|
+
UnsupportedDeclareExportKind: _ref62 => {
|
|
7722
7867
|
var {
|
|
7723
7868
|
unsupportedExportKind,
|
|
7724
7869
|
suggestion
|
|
7725
|
-
} =
|
|
7870
|
+
} = _ref62;
|
|
7726
7871
|
return "`declare export ".concat(unsupportedExportKind, "` is not supported. Use `").concat(suggestion, "` instead.");
|
|
7727
|
-
}
|
|
7728
|
-
UnsupportedStatementInDeclareModule:
|
|
7729
|
-
UnterminatedFlowComment:
|
|
7730
|
-
})
|
|
7872
|
+
},
|
|
7873
|
+
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
|
|
7874
|
+
UnterminatedFlowComment: "Unterminated flow-comment."
|
|
7875
|
+
});
|
|
7731
7876
|
|
|
7732
7877
|
function isEsModuleType(bodyElement) {
|
|
7733
7878
|
return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
|
|
@@ -7761,7 +7906,7 @@ function partition(list, test) {
|
|
|
7761
7906
|
|
|
7762
7907
|
var FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
|
|
7763
7908
|
|
|
7764
|
-
var flow = superClass => class extends superClass {
|
|
7909
|
+
var flow = superClass => class FlowParserMixin extends superClass {
|
|
7765
7910
|
constructor() {
|
|
7766
7911
|
super(...arguments);
|
|
7767
7912
|
this.flowPragma = undefined;
|
|
@@ -7826,7 +7971,7 @@ var flow = superClass => class extends superClass {
|
|
|
7826
7971
|
}
|
|
7827
7972
|
|
|
7828
7973
|
if (this.eat(10)) {
|
|
7829
|
-
node.value =
|
|
7974
|
+
node.value = super.parseExpression();
|
|
7830
7975
|
this.expect(11);
|
|
7831
7976
|
return this.finishNode(node, "DeclaredPredicate");
|
|
7832
7977
|
} else {
|
|
@@ -7933,7 +8078,7 @@ var flow = superClass => class extends superClass {
|
|
|
7933
8078
|
this.scope.enter(SCOPE_OTHER);
|
|
7934
8079
|
|
|
7935
8080
|
if (this.match(129)) {
|
|
7936
|
-
node.id =
|
|
8081
|
+
node.id = super.parseExprAtom();
|
|
7937
8082
|
} else {
|
|
7938
8083
|
node.id = this.parseIdentifier();
|
|
7939
8084
|
}
|
|
@@ -7954,7 +8099,7 @@ var flow = superClass => class extends superClass {
|
|
|
7954
8099
|
});
|
|
7955
8100
|
}
|
|
7956
8101
|
|
|
7957
|
-
|
|
8102
|
+
super.parseImport(_bodyNode);
|
|
7958
8103
|
} else {
|
|
7959
8104
|
this.expectContextual(121, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
7960
8105
|
_bodyNode = this.flowParseDeclare(_bodyNode, true);
|
|
@@ -8052,16 +8197,16 @@ var flow = superClass => class extends superClass {
|
|
|
8052
8197
|
|
|
8053
8198
|
flowParseDeclareTypeAlias(node) {
|
|
8054
8199
|
this.next();
|
|
8055
|
-
this.flowParseTypeAlias(node);
|
|
8056
|
-
|
|
8057
|
-
return
|
|
8200
|
+
var finished = this.flowParseTypeAlias(node);
|
|
8201
|
+
finished.type = "DeclareTypeAlias";
|
|
8202
|
+
return finished;
|
|
8058
8203
|
}
|
|
8059
8204
|
|
|
8060
8205
|
flowParseDeclareOpaqueType(node) {
|
|
8061
8206
|
this.next();
|
|
8062
|
-
this.flowParseOpaqueType(node, true);
|
|
8063
|
-
|
|
8064
|
-
return
|
|
8207
|
+
var finished = this.flowParseOpaqueType(node, true);
|
|
8208
|
+
finished.type = "DeclareOpaqueType";
|
|
8209
|
+
return finished;
|
|
8065
8210
|
}
|
|
8066
8211
|
|
|
8067
8212
|
flowParseDeclareInterface(node) {
|
|
@@ -8318,7 +8463,7 @@ var flow = superClass => class extends superClass {
|
|
|
8318
8463
|
}
|
|
8319
8464
|
|
|
8320
8465
|
flowParseObjectPropertyKey() {
|
|
8321
|
-
return this.match(130) || this.match(129) ?
|
|
8466
|
+
return this.match(130) || this.match(129) ? super.parseExprAtom() : this.parseIdentifier(true);
|
|
8322
8467
|
}
|
|
8323
8468
|
|
|
8324
8469
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
@@ -8406,14 +8551,14 @@ var flow = superClass => class extends superClass {
|
|
|
8406
8551
|
return this.finishNode(node, "ObjectTypeCallProperty");
|
|
8407
8552
|
}
|
|
8408
8553
|
|
|
8409
|
-
flowParseObjectType(
|
|
8554
|
+
flowParseObjectType(_ref63) {
|
|
8410
8555
|
var {
|
|
8411
8556
|
allowStatic,
|
|
8412
8557
|
allowExact,
|
|
8413
8558
|
allowSpread,
|
|
8414
8559
|
allowProto,
|
|
8415
8560
|
allowInexact
|
|
8416
|
-
} =
|
|
8561
|
+
} = _ref63;
|
|
8417
8562
|
var oldInType = this.state.inType;
|
|
8418
8563
|
this.state.inType = true;
|
|
8419
8564
|
var nodeStart = this.startNode();
|
|
@@ -9103,7 +9248,7 @@ var flow = superClass => class extends superClass {
|
|
|
9103
9248
|
}
|
|
9104
9249
|
|
|
9105
9250
|
this.next();
|
|
9106
|
-
this.finishNode(variance, "Variance");
|
|
9251
|
+
return this.finishNode(variance, "Variance");
|
|
9107
9252
|
}
|
|
9108
9253
|
|
|
9109
9254
|
return variance;
|
|
@@ -9128,7 +9273,7 @@ var flow = superClass => class extends superClass {
|
|
|
9128
9273
|
node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
|
|
9129
9274
|
}
|
|
9130
9275
|
|
|
9131
|
-
super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
9276
|
+
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
9132
9277
|
}
|
|
9133
9278
|
|
|
9134
9279
|
parseStatement(context, topLevel) {
|
|
@@ -9383,7 +9528,7 @@ var flow = superClass => class extends superClass {
|
|
|
9383
9528
|
|
|
9384
9529
|
if (this.match(5)) {
|
|
9385
9530
|
node.specifiers = this.parseExportSpecifiers(true);
|
|
9386
|
-
|
|
9531
|
+
super.parseExportFrom(node);
|
|
9387
9532
|
return null;
|
|
9388
9533
|
} else {
|
|
9389
9534
|
return this.flowParseTypeAlias(declarationNode);
|
|
@@ -9415,7 +9560,7 @@ var flow = superClass => class extends superClass {
|
|
|
9415
9560
|
}
|
|
9416
9561
|
|
|
9417
9562
|
eatExportStar(node) {
|
|
9418
|
-
if (super.eatExportStar(
|
|
9563
|
+
if (super.eatExportStar(node)) return true;
|
|
9419
9564
|
|
|
9420
9565
|
if (this.isContextual(126) && this.lookahead().type === 55) {
|
|
9421
9566
|
node.exportKind = "type";
|
|
@@ -9454,7 +9599,7 @@ var flow = superClass => class extends superClass {
|
|
|
9454
9599
|
} = this.state;
|
|
9455
9600
|
|
|
9456
9601
|
if (this.isContextual(121)) {
|
|
9457
|
-
if (
|
|
9602
|
+
if (super.parseClassMemberFromModifier(classBody, member)) {
|
|
9458
9603
|
return;
|
|
9459
9604
|
}
|
|
9460
9605
|
|
|
@@ -9530,7 +9675,7 @@ var flow = superClass => class extends superClass {
|
|
|
9530
9675
|
node.left = this.typeCastToParameter(node.left);
|
|
9531
9676
|
}
|
|
9532
9677
|
|
|
9533
|
-
super.toAssignable(
|
|
9678
|
+
super.toAssignable(node, isLHS);
|
|
9534
9679
|
}
|
|
9535
9680
|
|
|
9536
9681
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
@@ -9571,12 +9716,8 @@ var flow = superClass => class extends superClass {
|
|
|
9571
9716
|
return node;
|
|
9572
9717
|
}
|
|
9573
9718
|
|
|
9574
|
-
isValidLVal(type) {
|
|
9575
|
-
|
|
9576
|
-
rest[_key3 - 1] = arguments[_key3];
|
|
9577
|
-
}
|
|
9578
|
-
|
|
9579
|
-
return type === "TypeCastExpression" || super.isValidLVal(type, ...rest);
|
|
9719
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
9720
|
+
return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
|
|
9580
9721
|
}
|
|
9581
9722
|
|
|
9582
9723
|
parseClassProperty(node) {
|
|
@@ -9716,11 +9857,13 @@ var flow = superClass => class extends superClass {
|
|
|
9716
9857
|
if (!this.match(10)) this.unexpected();
|
|
9717
9858
|
}
|
|
9718
9859
|
|
|
9719
|
-
super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
9860
|
+
var result = super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
9720
9861
|
|
|
9721
9862
|
if (typeParameters) {
|
|
9722
|
-
(
|
|
9863
|
+
(result.value || result).typeParameters = typeParameters;
|
|
9723
9864
|
}
|
|
9865
|
+
|
|
9866
|
+
return result;
|
|
9724
9867
|
}
|
|
9725
9868
|
|
|
9726
9869
|
parseAssignableListItemTypes(param) {
|
|
@@ -9812,7 +9955,7 @@ var flow = superClass => class extends superClass {
|
|
|
9812
9955
|
return super.maybeParseDefaultImportSpecifier(node);
|
|
9813
9956
|
}
|
|
9814
9957
|
|
|
9815
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
9958
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
9816
9959
|
var firstIdent = specifier.imported;
|
|
9817
9960
|
var specifierTypeKind = null;
|
|
9818
9961
|
|
|
@@ -10035,6 +10178,8 @@ var flow = superClass => class extends superClass {
|
|
|
10035
10178
|
}
|
|
10036
10179
|
|
|
10037
10180
|
checkParams(node, allowDuplicates, isArrowFunction) {
|
|
10181
|
+
var strictModeChanged = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
10182
|
+
|
|
10038
10183
|
if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
10039
10184
|
return;
|
|
10040
10185
|
}
|
|
@@ -10047,7 +10192,7 @@ var flow = superClass => class extends superClass {
|
|
|
10047
10192
|
}
|
|
10048
10193
|
}
|
|
10049
10194
|
|
|
10050
|
-
return super.checkParams(
|
|
10195
|
+
return super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
|
|
10051
10196
|
}
|
|
10052
10197
|
|
|
10053
10198
|
parseParenAndDistinguishExpression(canBeArrow) {
|
|
@@ -10059,7 +10204,7 @@ var flow = superClass => class extends superClass {
|
|
|
10059
10204
|
this.next();
|
|
10060
10205
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10061
10206
|
node.callee = base;
|
|
10062
|
-
node.arguments =
|
|
10207
|
+
node.arguments = super.parseCallExpressionArguments(11, false);
|
|
10063
10208
|
base = this.finishNode(node, "CallExpression");
|
|
10064
10209
|
} else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
|
|
10065
10210
|
var state = this.state.clone();
|
|
@@ -10108,8 +10253,12 @@ var flow = superClass => class extends superClass {
|
|
|
10108
10253
|
var result = this.tryParse(() => {
|
|
10109
10254
|
_node4.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
|
|
10110
10255
|
this.expect(10);
|
|
10111
|
-
_node4.arguments =
|
|
10112
|
-
|
|
10256
|
+
_node4.arguments = super.parseCallExpressionArguments(11, false);
|
|
10257
|
+
|
|
10258
|
+
if (subscriptState.optionalChainMember) {
|
|
10259
|
+
_node4.optional = false;
|
|
10260
|
+
}
|
|
10261
|
+
|
|
10113
10262
|
return this.finishCallExpression(_node4, subscriptState.optionalChainMember);
|
|
10114
10263
|
});
|
|
10115
10264
|
|
|
@@ -10137,7 +10286,7 @@ var flow = superClass => class extends superClass {
|
|
|
10137
10286
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10138
10287
|
this.parseFunctionParams(node);
|
|
10139
10288
|
if (!this.parseArrow(node)) return;
|
|
10140
|
-
return
|
|
10289
|
+
return super.parseArrowExpression(node, undefined, true);
|
|
10141
10290
|
}
|
|
10142
10291
|
|
|
10143
10292
|
readToken_mult_modulo(code) {
|
|
@@ -10185,8 +10334,13 @@ var flow = superClass => class extends superClass {
|
|
|
10185
10334
|
}
|
|
10186
10335
|
|
|
10187
10336
|
this.hasFlowCommentCompletion();
|
|
10188
|
-
|
|
10189
|
-
|
|
10337
|
+
var commentSkip = this.skipFlowComment();
|
|
10338
|
+
|
|
10339
|
+
if (commentSkip) {
|
|
10340
|
+
this.state.pos += commentSkip;
|
|
10341
|
+
this.state.hasFlowComment = true;
|
|
10342
|
+
}
|
|
10343
|
+
|
|
10190
10344
|
return;
|
|
10191
10345
|
}
|
|
10192
10346
|
|
|
@@ -10244,11 +10398,11 @@ var flow = superClass => class extends superClass {
|
|
|
10244
10398
|
}
|
|
10245
10399
|
}
|
|
10246
10400
|
|
|
10247
|
-
flowEnumErrorBooleanMemberNotInitialized(loc,
|
|
10401
|
+
flowEnumErrorBooleanMemberNotInitialized(loc, _ref64) {
|
|
10248
10402
|
var {
|
|
10249
10403
|
enumName,
|
|
10250
10404
|
memberName
|
|
10251
|
-
} =
|
|
10405
|
+
} = _ref64;
|
|
10252
10406
|
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
|
|
10253
10407
|
at: loc,
|
|
10254
10408
|
memberName,
|
|
@@ -10262,11 +10416,11 @@ var flow = superClass => class extends superClass {
|
|
|
10262
10416
|
}, enumContext));
|
|
10263
10417
|
}
|
|
10264
10418
|
|
|
10265
|
-
flowEnumErrorNumberMemberNotInitialized(loc,
|
|
10419
|
+
flowEnumErrorNumberMemberNotInitialized(loc, _ref65) {
|
|
10266
10420
|
var {
|
|
10267
10421
|
enumName,
|
|
10268
10422
|
memberName
|
|
10269
|
-
} =
|
|
10423
|
+
} = _ref65;
|
|
10270
10424
|
this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
|
|
10271
10425
|
at: loc,
|
|
10272
10426
|
enumName,
|
|
@@ -10274,10 +10428,10 @@ var flow = superClass => class extends superClass {
|
|
|
10274
10428
|
});
|
|
10275
10429
|
}
|
|
10276
10430
|
|
|
10277
|
-
flowEnumErrorStringMemberInconsistentlyInitailized(node,
|
|
10431
|
+
flowEnumErrorStringMemberInconsistentlyInitailized(node, _ref66) {
|
|
10278
10432
|
var {
|
|
10279
10433
|
enumName
|
|
10280
|
-
} =
|
|
10434
|
+
} = _ref66;
|
|
10281
10435
|
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitailized, {
|
|
10282
10436
|
at: node,
|
|
10283
10437
|
enumName
|
|
@@ -10380,11 +10534,11 @@ var flow = superClass => class extends superClass {
|
|
|
10380
10534
|
}
|
|
10381
10535
|
}
|
|
10382
10536
|
|
|
10383
|
-
flowEnumMembers(
|
|
10537
|
+
flowEnumMembers(_ref67) {
|
|
10384
10538
|
var {
|
|
10385
10539
|
enumName,
|
|
10386
10540
|
explicitType
|
|
10387
|
-
} =
|
|
10541
|
+
} = _ref67;
|
|
10388
10542
|
var seenNames = new Set();
|
|
10389
10543
|
var members = {
|
|
10390
10544
|
booleanMembers: [],
|
|
@@ -10494,10 +10648,10 @@ var flow = superClass => class extends superClass {
|
|
|
10494
10648
|
};
|
|
10495
10649
|
}
|
|
10496
10650
|
|
|
10497
|
-
flowEnumStringMembers(initializedMembers, defaultedMembers,
|
|
10651
|
+
flowEnumStringMembers(initializedMembers, defaultedMembers, _ref68) {
|
|
10498
10652
|
var {
|
|
10499
10653
|
enumName
|
|
10500
|
-
} =
|
|
10654
|
+
} = _ref68;
|
|
10501
10655
|
|
|
10502
10656
|
if (initializedMembers.length === 0) {
|
|
10503
10657
|
return defaultedMembers;
|
|
@@ -10522,10 +10676,10 @@ var flow = superClass => class extends superClass {
|
|
|
10522
10676
|
}
|
|
10523
10677
|
}
|
|
10524
10678
|
|
|
10525
|
-
flowEnumParseExplicitType(
|
|
10679
|
+
flowEnumParseExplicitType(_ref69) {
|
|
10526
10680
|
var {
|
|
10527
10681
|
enumName
|
|
10528
|
-
} =
|
|
10682
|
+
} = _ref69;
|
|
10529
10683
|
if (!this.eatContextual(101)) return null;
|
|
10530
10684
|
|
|
10531
10685
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
@@ -10928,27 +11082,27 @@ var entities = {
|
|
|
10928
11082
|
hearts: "\u2665",
|
|
10929
11083
|
diams: "\u2666"
|
|
10930
11084
|
};
|
|
10931
|
-
var JsxErrors = ParseErrorEnum(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["jsx"])))(
|
|
10932
|
-
AttributeIsEmpty:
|
|
10933
|
-
MissingClosingTagElement:
|
|
11085
|
+
var JsxErrors = ParseErrorEnum(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["jsx"])))({
|
|
11086
|
+
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
|
|
11087
|
+
MissingClosingTagElement: _ref70 => {
|
|
10934
11088
|
var {
|
|
10935
11089
|
openingTagName
|
|
10936
|
-
} =
|
|
11090
|
+
} = _ref70;
|
|
10937
11091
|
return "Expected corresponding JSX closing tag for <".concat(openingTagName, ">.");
|
|
10938
|
-
}
|
|
10939
|
-
MissingClosingTagFragment:
|
|
10940
|
-
UnexpectedSequenceExpression:
|
|
10941
|
-
UnexpectedToken:
|
|
11092
|
+
},
|
|
11093
|
+
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
|
|
11094
|
+
UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
|
|
11095
|
+
UnexpectedToken: _ref71 => {
|
|
10942
11096
|
var {
|
|
10943
11097
|
unexpected,
|
|
10944
11098
|
HTMLEntity
|
|
10945
|
-
} =
|
|
11099
|
+
} = _ref71;
|
|
10946
11100
|
return "Unexpected token `".concat(unexpected, "`. Did you mean `").concat(HTMLEntity, "` or `{'").concat(unexpected, "'}`?");
|
|
10947
|
-
}
|
|
10948
|
-
UnsupportedJsxValue:
|
|
10949
|
-
UnterminatedJsxContent:
|
|
10950
|
-
UnwrappedAdjacentJSXElements:
|
|
10951
|
-
})
|
|
11101
|
+
},
|
|
11102
|
+
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
|
|
11103
|
+
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
11104
|
+
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
11105
|
+
});
|
|
10952
11106
|
|
|
10953
11107
|
function isFragment(object) {
|
|
10954
11108
|
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
|
|
@@ -10970,7 +11124,7 @@ function getQualifiedJSXName(object) {
|
|
|
10970
11124
|
throw new Error("Node had unexpected type: " + object.type);
|
|
10971
11125
|
}
|
|
10972
11126
|
|
|
10973
|
-
var jsx = superClass => class extends superClass {
|
|
11127
|
+
var jsx = superClass => class JSXParserMixin extends superClass {
|
|
10974
11128
|
jsxReadToken() {
|
|
10975
11129
|
var out = "";
|
|
10976
11130
|
var chunkStart = this.state.pos;
|
|
@@ -11202,7 +11356,7 @@ var jsx = superClass => class extends superClass {
|
|
|
11202
11356
|
jsxParseSpreadChild(node) {
|
|
11203
11357
|
this.next();
|
|
11204
11358
|
node.expression = this.parseExpression();
|
|
11205
|
-
this.setContext(types.
|
|
11359
|
+
this.setContext(types.j_expr);
|
|
11206
11360
|
this.state.canStartJSXElement = true;
|
|
11207
11361
|
this.expect(8);
|
|
11208
11362
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -11465,11 +11619,63 @@ class TypeScriptScope extends Scope {
|
|
|
11465
11619
|
}
|
|
11466
11620
|
|
|
11467
11621
|
class TypeScriptScopeHandler extends ScopeHandler {
|
|
11622
|
+
constructor() {
|
|
11623
|
+
super(...arguments);
|
|
11624
|
+
this.importsStack = [];
|
|
11625
|
+
}
|
|
11626
|
+
|
|
11468
11627
|
createScope(flags) {
|
|
11628
|
+
this.importsStack.push(new Set());
|
|
11469
11629
|
return new TypeScriptScope(flags);
|
|
11470
11630
|
}
|
|
11471
11631
|
|
|
11632
|
+
enter(flags) {
|
|
11633
|
+
if (flags == SCOPE_TS_MODULE) {
|
|
11634
|
+
this.importsStack.push(new Set());
|
|
11635
|
+
}
|
|
11636
|
+
|
|
11637
|
+
super.enter(flags);
|
|
11638
|
+
}
|
|
11639
|
+
|
|
11640
|
+
exit() {
|
|
11641
|
+
var flags = super.exit();
|
|
11642
|
+
|
|
11643
|
+
if (flags == SCOPE_TS_MODULE) {
|
|
11644
|
+
this.importsStack.pop();
|
|
11645
|
+
}
|
|
11646
|
+
|
|
11647
|
+
return flags;
|
|
11648
|
+
}
|
|
11649
|
+
|
|
11650
|
+
hasImport(name, allowShadow) {
|
|
11651
|
+
var len = this.importsStack.length;
|
|
11652
|
+
|
|
11653
|
+
if (this.importsStack[len - 1].has(name)) {
|
|
11654
|
+
return true;
|
|
11655
|
+
}
|
|
11656
|
+
|
|
11657
|
+
if (!allowShadow && len > 1) {
|
|
11658
|
+
for (var i = 0; i < len - 1; i++) {
|
|
11659
|
+
if (this.importsStack[i].has(name)) return true;
|
|
11660
|
+
}
|
|
11661
|
+
}
|
|
11662
|
+
|
|
11663
|
+
return false;
|
|
11664
|
+
}
|
|
11665
|
+
|
|
11472
11666
|
declareName(name, bindingType, loc) {
|
|
11667
|
+
if (bindingType & BIND_FLAGS_TS_IMPORT) {
|
|
11668
|
+
if (this.hasImport(name, true)) {
|
|
11669
|
+
this.parser.raise(Errors.VarRedeclaration, {
|
|
11670
|
+
at: loc,
|
|
11671
|
+
identifierName: name
|
|
11672
|
+
});
|
|
11673
|
+
}
|
|
11674
|
+
|
|
11675
|
+
this.importsStack[this.importsStack.length - 1].add(name);
|
|
11676
|
+
return;
|
|
11677
|
+
}
|
|
11678
|
+
|
|
11473
11679
|
var scope = this.currentScope();
|
|
11474
11680
|
|
|
11475
11681
|
if (bindingType & BIND_FLAGS_TS_EXPORT_ONLY) {
|
|
@@ -11478,7 +11684,7 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
11478
11684
|
return;
|
|
11479
11685
|
}
|
|
11480
11686
|
|
|
11481
|
-
super.declareName(
|
|
11687
|
+
super.declareName(name, bindingType, loc);
|
|
11482
11688
|
|
|
11483
11689
|
if (bindingType & BIND_KIND_TYPE) {
|
|
11484
11690
|
if (!(bindingType & BIND_KIND_VALUE)) {
|
|
@@ -11517,18 +11723,22 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
11517
11723
|
return true;
|
|
11518
11724
|
}
|
|
11519
11725
|
|
|
11520
|
-
return super.isRedeclaredInScope(
|
|
11726
|
+
return super.isRedeclaredInScope(scope, name, bindingType);
|
|
11521
11727
|
}
|
|
11522
11728
|
|
|
11523
11729
|
checkLocalExport(id) {
|
|
11524
|
-
var topLevelScope = this.scopeStack[0];
|
|
11525
11730
|
var {
|
|
11526
11731
|
name
|
|
11527
11732
|
} = id;
|
|
11733
|
+
if (this.hasImport(name)) return;
|
|
11734
|
+
var len = this.scopeStack.length;
|
|
11528
11735
|
|
|
11529
|
-
|
|
11530
|
-
|
|
11736
|
+
for (var i = len - 1; i >= 0; i--) {
|
|
11737
|
+
var scope = this.scopeStack[i];
|
|
11738
|
+
if (scope.types.has(name) || scope.exportOnlyBindings.has(name)) return;
|
|
11531
11739
|
}
|
|
11740
|
+
|
|
11741
|
+
super.checkLocalExport(id);
|
|
11532
11742
|
}
|
|
11533
11743
|
|
|
11534
11744
|
}
|
|
@@ -11549,145 +11759,145 @@ function assert(x) {
|
|
|
11549
11759
|
}
|
|
11550
11760
|
}
|
|
11551
11761
|
|
|
11552
|
-
var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["typescript"])))(
|
|
11553
|
-
AbstractMethodHasImplementation:
|
|
11762
|
+
var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["typescript"])))({
|
|
11763
|
+
AbstractMethodHasImplementation: _ref72 => {
|
|
11554
11764
|
var {
|
|
11555
11765
|
methodName
|
|
11556
|
-
} =
|
|
11766
|
+
} = _ref72;
|
|
11557
11767
|
return "Method '".concat(methodName, "' cannot have an implementation because it is marked abstract.");
|
|
11558
|
-
}
|
|
11559
|
-
AbstractPropertyHasInitializer:
|
|
11768
|
+
},
|
|
11769
|
+
AbstractPropertyHasInitializer: _ref73 => {
|
|
11560
11770
|
var {
|
|
11561
11771
|
propertyName
|
|
11562
|
-
} =
|
|
11772
|
+
} = _ref73;
|
|
11563
11773
|
return "Property '".concat(propertyName, "' cannot have an initializer because it is marked abstract.");
|
|
11564
|
-
}
|
|
11565
|
-
AccesorCannotDeclareThisParameter:
|
|
11566
|
-
AccesorCannotHaveTypeParameters:
|
|
11567
|
-
CannotFindName:
|
|
11774
|
+
},
|
|
11775
|
+
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
|
11776
|
+
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
|
11777
|
+
CannotFindName: _ref74 => {
|
|
11568
11778
|
var {
|
|
11569
11779
|
name
|
|
11570
|
-
} =
|
|
11780
|
+
} = _ref74;
|
|
11571
11781
|
return "Cannot find name '".concat(name, "'.");
|
|
11572
|
-
}
|
|
11573
|
-
ClassMethodHasDeclare:
|
|
11574
|
-
ClassMethodHasReadonly:
|
|
11575
|
-
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference:
|
|
11576
|
-
ConstructorHasTypeParameters:
|
|
11577
|
-
DeclareAccessor:
|
|
11782
|
+
},
|
|
11783
|
+
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
|
11784
|
+
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
|
11785
|
+
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
|
11786
|
+
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
|
|
11787
|
+
DeclareAccessor: _ref75 => {
|
|
11578
11788
|
var {
|
|
11579
11789
|
kind
|
|
11580
|
-
} =
|
|
11790
|
+
} = _ref75;
|
|
11581
11791
|
return "'declare' is not allowed in ".concat(kind, "ters.");
|
|
11582
|
-
}
|
|
11583
|
-
DeclareClassFieldHasInitializer:
|
|
11584
|
-
DeclareFunctionHasImplementation:
|
|
11585
|
-
DuplicateAccessibilityModifier:
|
|
11792
|
+
},
|
|
11793
|
+
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
11794
|
+
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
11795
|
+
DuplicateAccessibilityModifier: _ref76 => {
|
|
11586
11796
|
return "Accessibility modifier already seen.";
|
|
11587
|
-
}
|
|
11588
|
-
DuplicateModifier:
|
|
11797
|
+
},
|
|
11798
|
+
DuplicateModifier: _ref77 => {
|
|
11589
11799
|
var {
|
|
11590
11800
|
modifier
|
|
11591
|
-
} =
|
|
11801
|
+
} = _ref77;
|
|
11592
11802
|
return "Duplicate modifier: '".concat(modifier, "'.");
|
|
11593
|
-
}
|
|
11594
|
-
EmptyHeritageClauseType:
|
|
11803
|
+
},
|
|
11804
|
+
EmptyHeritageClauseType: _ref78 => {
|
|
11595
11805
|
var {
|
|
11596
11806
|
token
|
|
11597
|
-
} =
|
|
11807
|
+
} = _ref78;
|
|
11598
11808
|
return "'".concat(token, "' list cannot be empty.");
|
|
11599
|
-
}
|
|
11600
|
-
EmptyTypeArguments:
|
|
11601
|
-
EmptyTypeParameters:
|
|
11602
|
-
ExpectedAmbientAfterExportDeclare:
|
|
11603
|
-
ImportAliasHasImportType:
|
|
11604
|
-
IncompatibleModifiers:
|
|
11809
|
+
},
|
|
11810
|
+
EmptyTypeArguments: "Type argument list cannot be empty.",
|
|
11811
|
+
EmptyTypeParameters: "Type parameter list cannot be empty.",
|
|
11812
|
+
ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
|
|
11813
|
+
ImportAliasHasImportType: "An import alias can not use 'import type'.",
|
|
11814
|
+
IncompatibleModifiers: _ref79 => {
|
|
11605
11815
|
var {
|
|
11606
11816
|
modifiers
|
|
11607
|
-
} =
|
|
11817
|
+
} = _ref79;
|
|
11608
11818
|
return "'".concat(modifiers[0], "' modifier cannot be used with '").concat(modifiers[1], "' modifier.");
|
|
11609
|
-
}
|
|
11610
|
-
IndexSignatureHasAbstract:
|
|
11611
|
-
IndexSignatureHasAccessibility:
|
|
11819
|
+
},
|
|
11820
|
+
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
|
|
11821
|
+
IndexSignatureHasAccessibility: _ref80 => {
|
|
11612
11822
|
var {
|
|
11613
11823
|
modifier
|
|
11614
|
-
} =
|
|
11824
|
+
} = _ref80;
|
|
11615
11825
|
return "Index signatures cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11616
|
-
}
|
|
11617
|
-
IndexSignatureHasDeclare:
|
|
11618
|
-
IndexSignatureHasOverride:
|
|
11619
|
-
IndexSignatureHasStatic:
|
|
11620
|
-
InitializerNotAllowedInAmbientContext:
|
|
11621
|
-
InvalidModifierOnTypeMember:
|
|
11826
|
+
},
|
|
11827
|
+
IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
|
|
11828
|
+
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
|
|
11829
|
+
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
|
|
11830
|
+
InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
|
|
11831
|
+
InvalidModifierOnTypeMember: _ref81 => {
|
|
11622
11832
|
var {
|
|
11623
11833
|
modifier
|
|
11624
|
-
} =
|
|
11834
|
+
} = _ref81;
|
|
11625
11835
|
return "'".concat(modifier, "' modifier cannot appear on a type member.");
|
|
11626
|
-
}
|
|
11627
|
-
InvalidModifierOnTypeParameter:
|
|
11836
|
+
},
|
|
11837
|
+
InvalidModifierOnTypeParameter: _ref82 => {
|
|
11628
11838
|
var {
|
|
11629
11839
|
modifier
|
|
11630
|
-
} =
|
|
11840
|
+
} = _ref82;
|
|
11631
11841
|
return "'".concat(modifier, "' modifier cannot appear on a type parameter.");
|
|
11632
|
-
}
|
|
11633
|
-
InvalidModifierOnTypeParameterPositions:
|
|
11842
|
+
},
|
|
11843
|
+
InvalidModifierOnTypeParameterPositions: _ref83 => {
|
|
11634
11844
|
var {
|
|
11635
11845
|
modifier
|
|
11636
|
-
} =
|
|
11846
|
+
} = _ref83;
|
|
11637
11847
|
return "'".concat(modifier, "' modifier can only appear on a type parameter of a class, interface or type alias.");
|
|
11638
|
-
}
|
|
11639
|
-
InvalidModifiersOrder:
|
|
11848
|
+
},
|
|
11849
|
+
InvalidModifiersOrder: _ref84 => {
|
|
11640
11850
|
var {
|
|
11641
11851
|
orderedModifiers
|
|
11642
|
-
} =
|
|
11852
|
+
} = _ref84;
|
|
11643
11853
|
return "'".concat(orderedModifiers[0], "' modifier must precede '").concat(orderedModifiers[1], "' modifier.");
|
|
11644
|
-
}
|
|
11645
|
-
InvalidPropertyAccessAfterInstantiationExpression:
|
|
11646
|
-
InvalidTupleMemberLabel:
|
|
11647
|
-
MissingInterfaceName:
|
|
11648
|
-
MixedLabeledAndUnlabeledElements:
|
|
11649
|
-
NonAbstractClassHasAbstractMethod:
|
|
11650
|
-
NonClassMethodPropertyHasAbstractModifer:
|
|
11651
|
-
OptionalTypeBeforeRequired:
|
|
11652
|
-
OverrideNotInSubClass:
|
|
11653
|
-
PatternIsOptional:
|
|
11654
|
-
PrivateElementHasAbstract:
|
|
11655
|
-
PrivateElementHasAccessibility:
|
|
11854
|
+
},
|
|
11855
|
+
InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
|
|
11856
|
+
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
|
11857
|
+
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
|
|
11858
|
+
MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
|
|
11859
|
+
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
|
|
11860
|
+
NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
|
|
11861
|
+
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
|
11862
|
+
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
|
|
11863
|
+
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
|
11864
|
+
PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
|
|
11865
|
+
PrivateElementHasAccessibility: _ref85 => {
|
|
11656
11866
|
var {
|
|
11657
11867
|
modifier
|
|
11658
|
-
} =
|
|
11868
|
+
} = _ref85;
|
|
11659
11869
|
return "Private elements cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11660
|
-
}
|
|
11661
|
-
ReadonlyForMethodSignature:
|
|
11662
|
-
ReservedArrowTypeParam:
|
|
11663
|
-
ReservedTypeAssertion:
|
|
11664
|
-
SetAccesorCannotHaveOptionalParameter:
|
|
11665
|
-
SetAccesorCannotHaveRestParameter:
|
|
11666
|
-
SetAccesorCannotHaveReturnType:
|
|
11667
|
-
SingleTypeParameterWithoutTrailingComma:
|
|
11870
|
+
},
|
|
11871
|
+
ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
|
|
11872
|
+
ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
|
|
11873
|
+
ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
|
|
11874
|
+
SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
|
|
11875
|
+
SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
|
|
11876
|
+
SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
|
|
11877
|
+
SingleTypeParameterWithoutTrailingComma: _ref86 => {
|
|
11668
11878
|
var {
|
|
11669
11879
|
typeParameterName
|
|
11670
|
-
} =
|
|
11880
|
+
} = _ref86;
|
|
11671
11881
|
return "Single type parameter ".concat(typeParameterName, " should have a trailing comma. Example usage: <").concat(typeParameterName, ",>.");
|
|
11672
|
-
}
|
|
11673
|
-
StaticBlockCannotHaveModifier:
|
|
11674
|
-
TypeAnnotationAfterAssign:
|
|
11675
|
-
TypeImportCannotSpecifyDefaultAndNamed:
|
|
11676
|
-
TypeModifierIsUsedInTypeExports:
|
|
11677
|
-
TypeModifierIsUsedInTypeImports:
|
|
11678
|
-
UnexpectedParameterModifier:
|
|
11679
|
-
UnexpectedReadonly:
|
|
11680
|
-
UnexpectedTypeAnnotation:
|
|
11681
|
-
UnexpectedTypeCastInParameter:
|
|
11682
|
-
UnsupportedImportTypeArgument:
|
|
11683
|
-
UnsupportedParameterPropertyKind:
|
|
11684
|
-
UnsupportedSignatureParameterKind:
|
|
11882
|
+
},
|
|
11883
|
+
StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
|
|
11884
|
+
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
11885
|
+
TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
|
|
11886
|
+
TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
|
|
11887
|
+
TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
|
|
11888
|
+
UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
|
|
11889
|
+
UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
|
|
11890
|
+
UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
|
|
11891
|
+
UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
|
|
11892
|
+
UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
|
|
11893
|
+
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
|
11894
|
+
UnsupportedSignatureParameterKind: _ref87 => {
|
|
11685
11895
|
var {
|
|
11686
11896
|
type
|
|
11687
|
-
} =
|
|
11897
|
+
} = _ref87;
|
|
11688
11898
|
return "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ".concat(type, ".");
|
|
11689
|
-
}
|
|
11690
|
-
})
|
|
11899
|
+
}
|
|
11900
|
+
});
|
|
11691
11901
|
|
|
11692
11902
|
function keywordTypeFromName(value) {
|
|
11693
11903
|
switch (value) {
|
|
@@ -11734,7 +11944,7 @@ function tsIsVarianceAnnotations(modifier) {
|
|
|
11734
11944
|
return modifier === "in" || modifier === "out";
|
|
11735
11945
|
}
|
|
11736
11946
|
|
|
11737
|
-
var typescript = superClass => class extends superClass {
|
|
11947
|
+
var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
11738
11948
|
getScopeHandler() {
|
|
11739
11949
|
return TypeScriptScopeHandler;
|
|
11740
11950
|
}
|
|
@@ -11772,14 +11982,14 @@ var typescript = superClass => class extends superClass {
|
|
|
11772
11982
|
return undefined;
|
|
11773
11983
|
}
|
|
11774
11984
|
|
|
11775
|
-
tsParseModifiers(
|
|
11985
|
+
tsParseModifiers(_ref88) {
|
|
11776
11986
|
var {
|
|
11777
11987
|
modified,
|
|
11778
11988
|
allowedModifiers,
|
|
11779
11989
|
disallowedModifiers,
|
|
11780
11990
|
stopOnStartOfClassStaticBlock,
|
|
11781
11991
|
errorTemplate = TSErrors.InvalidModifierOnTypeMember
|
|
11782
|
-
} =
|
|
11992
|
+
} = _ref88;
|
|
11783
11993
|
|
|
11784
11994
|
var enforceOrder = (loc, modifier, before, after) => {
|
|
11785
11995
|
if (modifier === before && modified[after]) {
|
|
@@ -11960,7 +12170,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11960
12170
|
});
|
|
11961
12171
|
}
|
|
11962
12172
|
|
|
11963
|
-
node.argument =
|
|
12173
|
+
node.argument = super.parseExprAtom();
|
|
11964
12174
|
this.expect(11);
|
|
11965
12175
|
|
|
11966
12176
|
if (this.eat(16)) {
|
|
@@ -12123,7 +12333,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12123
12333
|
}
|
|
12124
12334
|
|
|
12125
12335
|
tsParseBindingListForSignature() {
|
|
12126
|
-
return
|
|
12336
|
+
return super.parseBindingList(11, 41).map(pattern => {
|
|
12127
12337
|
if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") {
|
|
12128
12338
|
this.raise(TSErrors.UnsupportedSignatureParameterKind, {
|
|
12129
12339
|
at: pattern,
|
|
@@ -12288,11 +12498,11 @@ var typescript = superClass => class extends superClass {
|
|
|
12288
12498
|
return idx;
|
|
12289
12499
|
}
|
|
12290
12500
|
|
|
12291
|
-
|
|
12501
|
+
super.parsePropertyName(node);
|
|
12292
12502
|
|
|
12293
12503
|
if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) {
|
|
12294
12504
|
node.kind = node.key.name;
|
|
12295
|
-
|
|
12505
|
+
super.parsePropertyName(node);
|
|
12296
12506
|
}
|
|
12297
12507
|
|
|
12298
12508
|
return this.tsParsePropertyOrMethodSignature(node, !!node.readonly);
|
|
@@ -12392,15 +12602,16 @@ var typescript = superClass => class extends superClass {
|
|
|
12392
12602
|
});
|
|
12393
12603
|
}
|
|
12394
12604
|
|
|
12395
|
-
seenOptionalElement
|
|
12605
|
+
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
12606
|
+
var checkType = type;
|
|
12396
12607
|
|
|
12397
12608
|
if (type === "TSRestType") {
|
|
12398
12609
|
elementNode = elementNode.typeAnnotation;
|
|
12399
|
-
|
|
12610
|
+
checkType = elementNode.type;
|
|
12400
12611
|
}
|
|
12401
12612
|
|
|
12402
|
-
var isLabeled =
|
|
12403
|
-
|
|
12613
|
+
var isLabeled = checkType === "TSNamedTupleMember";
|
|
12614
|
+
(_labeledElements = labeledElements) != null ? _labeledElements : labeledElements = isLabeled;
|
|
12404
12615
|
|
|
12405
12616
|
if (labeledElements !== isLabeled) {
|
|
12406
12617
|
this.raise(TSErrors.MixedLabeledAndUnlabeledElements, {
|
|
@@ -12482,7 +12693,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12482
12693
|
case 129:
|
|
12483
12694
|
case 85:
|
|
12484
12695
|
case 86:
|
|
12485
|
-
return
|
|
12696
|
+
return super.parseExprAtom();
|
|
12486
12697
|
|
|
12487
12698
|
default:
|
|
12488
12699
|
throw this.unexpected();
|
|
@@ -12494,7 +12705,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12494
12705
|
|
|
12495
12706
|
tsParseTemplateLiteralType() {
|
|
12496
12707
|
var node = this.startNode();
|
|
12497
|
-
node.literal =
|
|
12708
|
+
node.literal = super.parseTemplate(false);
|
|
12498
12709
|
return this.finishNode(node, "TSLiteralType");
|
|
12499
12710
|
}
|
|
12500
12711
|
|
|
@@ -12718,7 +12929,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12718
12929
|
var _previousErrorCount = _errors.length;
|
|
12719
12930
|
|
|
12720
12931
|
try {
|
|
12721
|
-
|
|
12932
|
+
super.parseBindingList(3, 93, true);
|
|
12722
12933
|
return _errors.length === _previousErrorCount;
|
|
12723
12934
|
} catch (_unused2) {
|
|
12724
12935
|
return false;
|
|
@@ -13041,10 +13252,10 @@ var typescript = superClass => class extends superClass {
|
|
|
13041
13252
|
|
|
13042
13253
|
tsParseEnumMember() {
|
|
13043
13254
|
var node = this.startNode();
|
|
13044
|
-
node.id = this.match(129) ? this.
|
|
13255
|
+
node.id = this.match(129) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
|
|
13045
13256
|
|
|
13046
13257
|
if (this.eat(29)) {
|
|
13047
|
-
node.initializer =
|
|
13258
|
+
node.initializer = super.parseMaybeAssignAllowIn();
|
|
13048
13259
|
}
|
|
13049
13260
|
|
|
13050
13261
|
return this.finishNode(node, "TSEnumMember");
|
|
@@ -13067,7 +13278,8 @@ var typescript = superClass => class extends superClass {
|
|
|
13067
13278
|
var node = this.startNode();
|
|
13068
13279
|
this.scope.enter(SCOPE_OTHER);
|
|
13069
13280
|
this.expect(5);
|
|
13070
|
-
|
|
13281
|
+
super.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 8);
|
|
13282
|
+
this.next();
|
|
13071
13283
|
this.scope.exit();
|
|
13072
13284
|
return this.finishNode(node, "TSModuleBlock");
|
|
13073
13285
|
}
|
|
@@ -13100,7 +13312,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13100
13312
|
node.global = true;
|
|
13101
13313
|
node.id = this.parseIdentifier();
|
|
13102
13314
|
} else if (this.match(129)) {
|
|
13103
|
-
node.id = this.
|
|
13315
|
+
node.id = super.parseStringLiteral(this.state.value);
|
|
13104
13316
|
} else {
|
|
13105
13317
|
this.unexpected();
|
|
13106
13318
|
}
|
|
@@ -13121,7 +13333,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13121
13333
|
tsParseImportEqualsDeclaration(node, isExport) {
|
|
13122
13334
|
node.isExport = isExport || false;
|
|
13123
13335
|
node.id = this.parseIdentifier();
|
|
13124
|
-
this.checkIdentifier(node.id,
|
|
13336
|
+
this.checkIdentifier(node.id, BIND_FLAGS_TS_IMPORT);
|
|
13125
13337
|
this.expect(29);
|
|
13126
13338
|
var moduleReference = this.tsParseModuleReference();
|
|
13127
13339
|
|
|
@@ -13153,7 +13365,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13153
13365
|
throw this.unexpected();
|
|
13154
13366
|
}
|
|
13155
13367
|
|
|
13156
|
-
node.expression =
|
|
13368
|
+
node.expression = super.parseExprAtom();
|
|
13157
13369
|
this.expect(11);
|
|
13158
13370
|
return this.finishNode(node, "TSExternalModuleReference");
|
|
13159
13371
|
}
|
|
@@ -13200,7 +13412,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13200
13412
|
return this.tsInAmbientContext(() => {
|
|
13201
13413
|
if (starttype === 68) {
|
|
13202
13414
|
nany.declare = true;
|
|
13203
|
-
return
|
|
13415
|
+
return super.parseFunctionStatement(nany, false, true);
|
|
13204
13416
|
}
|
|
13205
13417
|
|
|
13206
13418
|
if (starttype === 80) {
|
|
@@ -13349,7 +13561,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13349
13561
|
return undefined;
|
|
13350
13562
|
}
|
|
13351
13563
|
|
|
13352
|
-
return
|
|
13564
|
+
return super.parseArrowExpression(res, null, true);
|
|
13353
13565
|
}
|
|
13354
13566
|
|
|
13355
13567
|
tsParseTypeArgumentsInExpression() {
|
|
@@ -13456,8 +13668,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13456
13668
|
var bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : undefined;
|
|
13457
13669
|
|
|
13458
13670
|
if (bodilessType && !this.match(5) && this.isLineTerminator()) {
|
|
13459
|
-
this.finishNode(node, bodilessType);
|
|
13460
|
-
return;
|
|
13671
|
+
return this.finishNode(node, bodilessType);
|
|
13461
13672
|
}
|
|
13462
13673
|
|
|
13463
13674
|
if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
|
|
@@ -13466,19 +13677,18 @@ var typescript = superClass => class extends superClass {
|
|
|
13466
13677
|
});
|
|
13467
13678
|
|
|
13468
13679
|
if (node.declare) {
|
|
13469
|
-
super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
13470
|
-
return;
|
|
13680
|
+
return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
13471
13681
|
}
|
|
13472
13682
|
}
|
|
13473
13683
|
|
|
13474
|
-
super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
13684
|
+
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
13475
13685
|
}
|
|
13476
13686
|
|
|
13477
13687
|
registerFunctionStatementId(node) {
|
|
13478
13688
|
if (!node.body && node.id) {
|
|
13479
13689
|
this.checkIdentifier(node.id, BIND_TS_AMBIENT);
|
|
13480
13690
|
} else {
|
|
13481
|
-
super.registerFunctionStatementId(
|
|
13691
|
+
super.registerFunctionStatementId(node);
|
|
13482
13692
|
}
|
|
13483
13693
|
}
|
|
13484
13694
|
|
|
@@ -13497,8 +13707,8 @@ var typescript = superClass => class extends superClass {
|
|
|
13497
13707
|
return exprList;
|
|
13498
13708
|
}
|
|
13499
13709
|
|
|
13500
|
-
parseArrayLike() {
|
|
13501
|
-
var node = super.parseArrayLike(
|
|
13710
|
+
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
13711
|
+
var node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
|
|
13502
13712
|
|
|
13503
13713
|
if (node.type === "ArrayExpression") {
|
|
13504
13714
|
this.tsCheckForInvalidTypeCasts(node.elements);
|
|
@@ -13548,7 +13758,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13548
13758
|
}
|
|
13549
13759
|
|
|
13550
13760
|
if (tokenIsTemplate(this.state.type)) {
|
|
13551
|
-
var _result =
|
|
13761
|
+
var _result = super.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13552
13762
|
|
|
13553
13763
|
_result.typeParameters = typeArguments;
|
|
13554
13764
|
return _result;
|
|
@@ -13571,7 +13781,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13571
13781
|
|
|
13572
13782
|
var tokenType = this.state.type;
|
|
13573
13783
|
|
|
13574
|
-
if (tokenType === 48 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
13784
|
+
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
13575
13785
|
return;
|
|
13576
13786
|
}
|
|
13577
13787
|
|
|
@@ -13684,7 +13894,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13684
13894
|
return this.tsParseImportEqualsDeclaration(node, true);
|
|
13685
13895
|
} else if (this.eat(29)) {
|
|
13686
13896
|
var assign = node;
|
|
13687
|
-
assign.expression =
|
|
13897
|
+
assign.expression = super.parseExpression();
|
|
13688
13898
|
this.semicolon();
|
|
13689
13899
|
return this.finishNode(assign, "TSExportAssignment");
|
|
13690
13900
|
} else if (this.eatContextual(93)) {
|
|
@@ -13714,8 +13924,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13714
13924
|
var cls = this.startNode();
|
|
13715
13925
|
this.next();
|
|
13716
13926
|
cls.abstract = true;
|
|
13717
|
-
this.parseClass(cls, true, true);
|
|
13718
|
-
return cls;
|
|
13927
|
+
return this.parseClass(cls, true, true);
|
|
13719
13928
|
}
|
|
13720
13929
|
|
|
13721
13930
|
if (this.match(125)) {
|
|
@@ -13814,7 +14023,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13814
14023
|
});
|
|
13815
14024
|
}
|
|
13816
14025
|
|
|
13817
|
-
|
|
14026
|
+
super.parseClassStaticBlock(classBody, member);
|
|
13818
14027
|
} else {
|
|
13819
14028
|
this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
|
|
13820
14029
|
}
|
|
@@ -13973,7 +14182,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13973
14182
|
return declaration;
|
|
13974
14183
|
}
|
|
13975
14184
|
|
|
13976
|
-
parseClassId(node, isStatement, optionalId) {
|
|
14185
|
+
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
13977
14186
|
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
13978
14187
|
return;
|
|
13979
14188
|
}
|
|
@@ -13995,7 +14204,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13995
14204
|
parseClassProperty(node) {
|
|
13996
14205
|
this.parseClassPropertyAnnotation(node);
|
|
13997
14206
|
|
|
13998
|
-
if (this.state.isAmbientContext && this.match(29)) {
|
|
14207
|
+
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
|
|
13999
14208
|
this.raise(TSErrors.DeclareClassFieldHasInitializer, {
|
|
14000
14209
|
at: this.state.startLoc
|
|
14001
14210
|
});
|
|
@@ -14081,15 +14290,10 @@ var typescript = superClass => class extends superClass {
|
|
|
14081
14290
|
}
|
|
14082
14291
|
}
|
|
14083
14292
|
|
|
14084
|
-
parseObjPropValue(prop) {
|
|
14293
|
+
parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
14085
14294
|
var typeParameters = this.tsTryParseTypeParameters();
|
|
14086
14295
|
if (typeParameters) prop.typeParameters = typeParameters;
|
|
14087
|
-
|
|
14088
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
14089
|
-
args[_key4 - 1] = arguments[_key4];
|
|
14090
|
-
}
|
|
14091
|
-
|
|
14092
|
-
super.parseObjPropValue(prop, ...args);
|
|
14296
|
+
return super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
14093
14297
|
}
|
|
14094
14298
|
|
|
14095
14299
|
parseFunctionParams(node, allowModifiers) {
|
|
@@ -14121,11 +14325,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14121
14325
|
return super.parseAsyncArrowFromCallExpression(node, call);
|
|
14122
14326
|
}
|
|
14123
14327
|
|
|
14124
|
-
parseMaybeAssign() {
|
|
14125
|
-
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
14126
|
-
args[_key5] = arguments[_key5];
|
|
14127
|
-
}
|
|
14128
|
-
|
|
14328
|
+
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
14129
14329
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
14130
14330
|
|
|
14131
14331
|
var state;
|
|
@@ -14134,7 +14334,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14134
14334
|
|
|
14135
14335
|
if (this.hasPlugin("jsx") && (this.match(138) || this.match(47))) {
|
|
14136
14336
|
state = this.state.clone();
|
|
14137
|
-
jsx = this.tryParse(() => super.parseMaybeAssign(
|
|
14337
|
+
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
14138
14338
|
if (!jsx.error) return jsx.node;
|
|
14139
14339
|
var {
|
|
14140
14340
|
context
|
|
@@ -14147,7 +14347,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14147
14347
|
}
|
|
14148
14348
|
|
|
14149
14349
|
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
|
|
14150
|
-
return super.parseMaybeAssign(
|
|
14350
|
+
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
14151
14351
|
}
|
|
14152
14352
|
|
|
14153
14353
|
if (!state || state === this.state) state = this.state.clone();
|
|
@@ -14156,7 +14356,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14156
14356
|
var _expr$extra, _typeParameters;
|
|
14157
14357
|
|
|
14158
14358
|
typeParameters = this.tsParseTypeParameters();
|
|
14159
|
-
var expr = super.parseMaybeAssign(
|
|
14359
|
+
var expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
14160
14360
|
|
|
14161
14361
|
if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
|
|
14162
14362
|
abort();
|
|
@@ -14177,7 +14377,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14177
14377
|
|
|
14178
14378
|
if (!jsx) {
|
|
14179
14379
|
assert(!this.hasPlugin("jsx"));
|
|
14180
|
-
typeCast = this.tryParse(() => super.parseMaybeAssign(
|
|
14380
|
+
typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
14181
14381
|
if (!typeCast.error) return typeCast.node;
|
|
14182
14382
|
}
|
|
14183
14383
|
|
|
@@ -14213,11 +14413,11 @@ var typescript = superClass => class extends superClass {
|
|
|
14213
14413
|
}
|
|
14214
14414
|
}
|
|
14215
14415
|
|
|
14216
|
-
parseMaybeUnary(refExpressionErrors) {
|
|
14416
|
+
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
14217
14417
|
if (!this.hasPlugin("jsx") && this.match(47)) {
|
|
14218
14418
|
return this.tsParseTypeAssertion();
|
|
14219
14419
|
} else {
|
|
14220
|
-
return super.parseMaybeUnary(refExpressionErrors);
|
|
14420
|
+
return super.parseMaybeUnary(refExpressionErrors, sawUnary);
|
|
14221
14421
|
}
|
|
14222
14422
|
}
|
|
14223
14423
|
|
|
@@ -14383,8 +14583,8 @@ var typescript = superClass => class extends superClass {
|
|
|
14383
14583
|
return this.match(35) || this.match(14) || super.isClassProperty();
|
|
14384
14584
|
}
|
|
14385
14585
|
|
|
14386
|
-
parseMaybeDefault() {
|
|
14387
|
-
var node = super.parseMaybeDefault(
|
|
14586
|
+
parseMaybeDefault(startPos, startLoc, left) {
|
|
14587
|
+
var node = super.parseMaybeDefault(startPos, startLoc, left);
|
|
14388
14588
|
|
|
14389
14589
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
14390
14590
|
this.raise(TSErrors.TypeAnnotationAfterAssign, {
|
|
@@ -14437,7 +14637,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14437
14637
|
return type;
|
|
14438
14638
|
}
|
|
14439
14639
|
|
|
14440
|
-
toAssignableList(exprList) {
|
|
14640
|
+
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
14441
14641
|
for (var i = 0; i < exprList.length; i++) {
|
|
14442
14642
|
var expr = exprList[i];
|
|
14443
14643
|
|
|
@@ -14446,7 +14646,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14446
14646
|
}
|
|
14447
14647
|
}
|
|
14448
14648
|
|
|
14449
|
-
super.toAssignableList(
|
|
14649
|
+
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
14450
14650
|
}
|
|
14451
14651
|
|
|
14452
14652
|
typeCastToParameter(node) {
|
|
@@ -14511,16 +14711,12 @@ var typescript = superClass => class extends superClass {
|
|
|
14511
14711
|
}
|
|
14512
14712
|
}
|
|
14513
14713
|
|
|
14514
|
-
parseClass(node) {
|
|
14714
|
+
parseClass(node, isStatement, optionalId) {
|
|
14515
14715
|
var oldInAbstractClass = this.state.inAbstractClass;
|
|
14516
14716
|
this.state.inAbstractClass = !!node.abstract;
|
|
14517
14717
|
|
|
14518
14718
|
try {
|
|
14519
|
-
|
|
14520
|
-
args[_key6 - 1] = arguments[_key6];
|
|
14521
|
-
}
|
|
14522
|
-
|
|
14523
|
-
return super.parseClass(node, ...args);
|
|
14719
|
+
return super.parseClass(node, isStatement, optionalId);
|
|
14524
14720
|
} finally {
|
|
14525
14721
|
this.state.inAbstractClass = oldInAbstractClass;
|
|
14526
14722
|
}
|
|
@@ -14543,8 +14739,8 @@ var typescript = superClass => class extends superClass {
|
|
|
14543
14739
|
}
|
|
14544
14740
|
}
|
|
14545
14741
|
|
|
14546
|
-
parseMethod() {
|
|
14547
|
-
var method = super.parseMethod(
|
|
14742
|
+
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
|
|
14743
|
+
var method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
14548
14744
|
|
|
14549
14745
|
if (method.abstract) {
|
|
14550
14746
|
var hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
|
|
@@ -14598,14 +14794,14 @@ var typescript = superClass => class extends superClass {
|
|
|
14598
14794
|
return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
|
|
14599
14795
|
}
|
|
14600
14796
|
|
|
14601
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
14797
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
14602
14798
|
if (!importedIsString && isMaybeTypeOnly) {
|
|
14603
14799
|
this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
|
|
14604
14800
|
return this.finishNode(specifier, "ImportSpecifier");
|
|
14605
14801
|
}
|
|
14606
14802
|
|
|
14607
14803
|
specifier.importKind = "value";
|
|
14608
|
-
return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly);
|
|
14804
|
+
return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, isInTypeOnlyImport ? BIND_TS_TYPE_IMPORT : BIND_FLAGS_TS_IMPORT);
|
|
14609
14805
|
}
|
|
14610
14806
|
|
|
14611
14807
|
parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) {
|
|
@@ -14673,7 +14869,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14673
14869
|
}
|
|
14674
14870
|
|
|
14675
14871
|
if (isImport) {
|
|
14676
|
-
this.checkIdentifier(node[rightOfAsKey],
|
|
14872
|
+
this.checkIdentifier(node[rightOfAsKey], hasTypeSpecifier ? BIND_TS_TYPE_IMPORT : BIND_FLAGS_TS_IMPORT);
|
|
14677
14873
|
}
|
|
14678
14874
|
}
|
|
14679
14875
|
|
|
@@ -14700,12 +14896,12 @@ function isUncomputedMemberExpressionChain(expression) {
|
|
|
14700
14896
|
return isUncomputedMemberExpressionChain(expression.object);
|
|
14701
14897
|
}
|
|
14702
14898
|
|
|
14703
|
-
var PlaceholderErrors = ParseErrorEnum(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["placeholders"])))(
|
|
14704
|
-
ClassNameIsRequired:
|
|
14705
|
-
UnexpectedSpace:
|
|
14706
|
-
})
|
|
14899
|
+
var PlaceholderErrors = ParseErrorEnum(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["placeholders"])))({
|
|
14900
|
+
ClassNameIsRequired: "A class name is required.",
|
|
14901
|
+
UnexpectedSpace: "Unexpected space in placeholder."
|
|
14902
|
+
});
|
|
14707
14903
|
|
|
14708
|
-
var placeholders = superClass => class extends superClass {
|
|
14904
|
+
var placeholders = superClass => class PlaceholdersParserMixin extends superClass {
|
|
14709
14905
|
parsePlaceholder(expectedNode) {
|
|
14710
14906
|
if (this.match(140)) {
|
|
14711
14907
|
var node = this.startNode();
|
|
@@ -14729,38 +14925,36 @@ var placeholders = superClass => class extends superClass {
|
|
|
14729
14925
|
return this.finishOp(140, 2);
|
|
14730
14926
|
}
|
|
14731
14927
|
|
|
14732
|
-
return super.getTokenFromCode(
|
|
14928
|
+
return super.getTokenFromCode(code);
|
|
14733
14929
|
}
|
|
14734
14930
|
|
|
14735
|
-
parseExprAtom() {
|
|
14736
|
-
return this.parsePlaceholder("Expression") || super.parseExprAtom(
|
|
14931
|
+
parseExprAtom(refExpressionErrors) {
|
|
14932
|
+
return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors);
|
|
14737
14933
|
}
|
|
14738
14934
|
|
|
14739
|
-
parseIdentifier() {
|
|
14740
|
-
return this.parsePlaceholder("Identifier") || super.parseIdentifier(
|
|
14935
|
+
parseIdentifier(liberal) {
|
|
14936
|
+
return this.parsePlaceholder("Identifier") || super.parseIdentifier(liberal);
|
|
14741
14937
|
}
|
|
14742
14938
|
|
|
14743
|
-
checkReservedWord(word) {
|
|
14744
|
-
if (word !== undefined)
|
|
14939
|
+
checkReservedWord(word, startLoc, checkKeywords, isBinding) {
|
|
14940
|
+
if (word !== undefined) {
|
|
14941
|
+
super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
|
|
14942
|
+
}
|
|
14745
14943
|
}
|
|
14746
14944
|
|
|
14747
14945
|
parseBindingAtom() {
|
|
14748
|
-
return this.parsePlaceholder("Pattern") || super.parseBindingAtom(
|
|
14946
|
+
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
|
|
14749
14947
|
}
|
|
14750
14948
|
|
|
14751
|
-
isValidLVal(type) {
|
|
14752
|
-
|
|
14753
|
-
rest[_key7 - 1] = arguments[_key7];
|
|
14754
|
-
}
|
|
14755
|
-
|
|
14756
|
-
return type === "Placeholder" || super.isValidLVal(type, ...rest);
|
|
14949
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
14950
|
+
return type === "Placeholder" || super.isValidLVal(type, isParenthesized, binding);
|
|
14757
14951
|
}
|
|
14758
14952
|
|
|
14759
|
-
toAssignable(node) {
|
|
14953
|
+
toAssignable(node, isLHS) {
|
|
14760
14954
|
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
|
14761
14955
|
node.expectedNode = "Pattern";
|
|
14762
14956
|
} else {
|
|
14763
|
-
super.toAssignable(
|
|
14957
|
+
super.toAssignable(node, isLHS);
|
|
14764
14958
|
}
|
|
14765
14959
|
}
|
|
14766
14960
|
|
|
@@ -14783,21 +14977,21 @@ var placeholders = superClass => class extends superClass {
|
|
|
14783
14977
|
return false;
|
|
14784
14978
|
}
|
|
14785
14979
|
|
|
14786
|
-
verifyBreakContinue(node) {
|
|
14980
|
+
verifyBreakContinue(node, isBreak) {
|
|
14787
14981
|
if (node.label && node.label.type === "Placeholder") return;
|
|
14788
|
-
super.verifyBreakContinue(
|
|
14982
|
+
super.verifyBreakContinue(node, isBreak);
|
|
14789
14983
|
}
|
|
14790
14984
|
|
|
14791
14985
|
parseExpressionStatement(node, expr) {
|
|
14792
14986
|
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
|
|
14793
|
-
return super.parseExpressionStatement(
|
|
14987
|
+
return super.parseExpressionStatement(node, expr);
|
|
14794
14988
|
}
|
|
14795
14989
|
|
|
14796
14990
|
if (this.match(14)) {
|
|
14797
14991
|
var stmt = node;
|
|
14798
14992
|
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
|
14799
14993
|
this.next();
|
|
14800
|
-
stmt.body =
|
|
14994
|
+
stmt.body = super.parseStatement("label");
|
|
14801
14995
|
return this.finishNode(stmt, "LabeledStatement");
|
|
14802
14996
|
}
|
|
14803
14997
|
|
|
@@ -14806,12 +15000,12 @@ var placeholders = superClass => class extends superClass {
|
|
|
14806
15000
|
return this.finishPlaceholder(node, "Statement");
|
|
14807
15001
|
}
|
|
14808
15002
|
|
|
14809
|
-
parseBlock() {
|
|
14810
|
-
return this.parsePlaceholder("BlockStatement") || super.parseBlock(
|
|
15003
|
+
parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
|
|
15004
|
+
return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
|
|
14811
15005
|
}
|
|
14812
15006
|
|
|
14813
|
-
parseFunctionId() {
|
|
14814
|
-
return this.parsePlaceholder("Identifier") || super.parseFunctionId(
|
|
15007
|
+
parseFunctionId(requireId) {
|
|
15008
|
+
return this.parsePlaceholder("Identifier") || super.parseFunctionId(requireId);
|
|
14815
15009
|
}
|
|
14816
15010
|
|
|
14817
15011
|
parseClass(node, isStatement, optionalId) {
|
|
@@ -14837,14 +15031,14 @@ var placeholders = superClass => class extends superClass {
|
|
|
14837
15031
|
this.parseClassId(node, isStatement, optionalId);
|
|
14838
15032
|
}
|
|
14839
15033
|
|
|
14840
|
-
|
|
14841
|
-
node.body = this.parsePlaceholder("ClassBody") ||
|
|
15034
|
+
super.parseClassSuper(node);
|
|
15035
|
+
node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict);
|
|
14842
15036
|
return this.finishNode(node, type);
|
|
14843
15037
|
}
|
|
14844
15038
|
|
|
14845
15039
|
parseExport(node) {
|
|
14846
15040
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
14847
|
-
if (!placeholder) return super.parseExport(
|
|
15041
|
+
if (!placeholder) return super.parseExport(node);
|
|
14848
15042
|
|
|
14849
15043
|
if (!this.isContextual(97) && !this.match(12)) {
|
|
14850
15044
|
node.specifiers = [];
|
|
@@ -14879,7 +15073,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
14879
15073
|
return true;
|
|
14880
15074
|
}
|
|
14881
15075
|
|
|
14882
|
-
return super.maybeParseExportDefaultSpecifier(
|
|
15076
|
+
return super.maybeParseExportDefaultSpecifier(node);
|
|
14883
15077
|
}
|
|
14884
15078
|
|
|
14885
15079
|
checkExport(node) {
|
|
@@ -14897,7 +15091,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
14897
15091
|
|
|
14898
15092
|
parseImport(node) {
|
|
14899
15093
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
14900
|
-
if (!placeholder) return super.parseImport(
|
|
15094
|
+
if (!placeholder) return super.parseImport(node);
|
|
14901
15095
|
node.specifiers = [];
|
|
14902
15096
|
|
|
14903
15097
|
if (!this.isContextual(97) && !this.match(12)) {
|
|
@@ -14908,8 +15102,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
14908
15102
|
|
|
14909
15103
|
var specifier = this.startNodeAtNode(placeholder);
|
|
14910
15104
|
specifier.local = placeholder;
|
|
14911
|
-
this.finishNode(specifier, "ImportDefaultSpecifier");
|
|
14912
|
-
node.specifiers.push(specifier);
|
|
15105
|
+
node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
|
|
14913
15106
|
|
|
14914
15107
|
if (this.eat(12)) {
|
|
14915
15108
|
var hasStarImport = this.maybeParseStarImportSpecifier(node);
|
|
@@ -14923,7 +15116,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
14923
15116
|
}
|
|
14924
15117
|
|
|
14925
15118
|
parseImportSource() {
|
|
14926
|
-
return this.parsePlaceholder("StringLiteral") || super.parseImportSource(
|
|
15119
|
+
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
|
|
14927
15120
|
}
|
|
14928
15121
|
|
|
14929
15122
|
assertNoSpace() {
|
|
@@ -14936,7 +15129,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
14936
15129
|
|
|
14937
15130
|
};
|
|
14938
15131
|
|
|
14939
|
-
var v8intrinsic = superClass => class extends superClass {
|
|
15132
|
+
var v8intrinsic = superClass => class V8IntrinsicMixin extends superClass {
|
|
14940
15133
|
parseV8Intrinsic() {
|
|
14941
15134
|
if (this.match(54)) {
|
|
14942
15135
|
var v8IntrinsicStartLoc = this.state.startLoc;
|
|
@@ -14957,8 +15150,8 @@ var v8intrinsic = superClass => class extends superClass {
|
|
|
14957
15150
|
}
|
|
14958
15151
|
}
|
|
14959
15152
|
|
|
14960
|
-
parseExprAtom() {
|
|
14961
|
-
return this.parseV8Intrinsic() || super.parseExprAtom(
|
|
15153
|
+
parseExprAtom(refExpressionErrors) {
|
|
15154
|
+
return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
|
|
14962
15155
|
}
|
|
14963
15156
|
|
|
14964
15157
|
};
|
|
@@ -14997,7 +15190,7 @@ function getPluginOption(plugins, name, option) {
|
|
|
14997
15190
|
}
|
|
14998
15191
|
});
|
|
14999
15192
|
|
|
15000
|
-
if (plugin && Array.isArray(plugin)) {
|
|
15193
|
+
if (plugin && Array.isArray(plugin) && plugin.length > 1) {
|
|
15001
15194
|
return plugin[1][option];
|
|
15002
15195
|
}
|
|
15003
15196
|
|
|
@@ -15016,11 +15209,15 @@ function validatePlugins(plugins) {
|
|
|
15016
15209
|
|
|
15017
15210
|
var decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");
|
|
15018
15211
|
|
|
15019
|
-
if (decoratorsBeforeExport
|
|
15020
|
-
throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you are migrating from" + " Babylon/Babel 6 or want to use the old decorators proposal, you" + " should use the 'decorators-legacy' plugin instead of 'decorators'.");
|
|
15021
|
-
} else if (typeof decoratorsBeforeExport !== "boolean") {
|
|
15212
|
+
if (decoratorsBeforeExport != null && typeof decoratorsBeforeExport !== "boolean") {
|
|
15022
15213
|
throw new Error("'decoratorsBeforeExport' must be a boolean.");
|
|
15023
15214
|
}
|
|
15215
|
+
|
|
15216
|
+
var allowCallParenthesized = getPluginOption(plugins, "decorators", "allowCallParenthesized");
|
|
15217
|
+
|
|
15218
|
+
if (allowCallParenthesized != null && typeof allowCallParenthesized !== "boolean") {
|
|
15219
|
+
throw new Error("'allowCallParenthesized' must be a boolean.");
|
|
15220
|
+
}
|
|
15024
15221
|
}
|
|
15025
15222
|
|
|
15026
15223
|
if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
|
|
@@ -15081,8 +15278,8 @@ function validatePlugins(plugins) {
|
|
|
15081
15278
|
}
|
|
15082
15279
|
}
|
|
15083
15280
|
|
|
15084
|
-
if (hasPlugin(plugins, "recordAndTuple") && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
|
|
15085
|
-
throw new Error("
|
|
15281
|
+
if (hasPlugin(plugins, "recordAndTuple") && getPluginOption(plugins, "recordAndTuple", "syntaxType") != null && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
|
|
15282
|
+
throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => "'".concat(p, "'")).join(", "));
|
|
15086
15283
|
}
|
|
15087
15284
|
|
|
15088
15285
|
if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
|
|
@@ -15340,10 +15537,10 @@ class LValParser extends NodeUtils {
|
|
|
15340
15537
|
}
|
|
15341
15538
|
}
|
|
15342
15539
|
|
|
15343
|
-
parseSpread(refExpressionErrors
|
|
15540
|
+
parseSpread(refExpressionErrors) {
|
|
15344
15541
|
var node = this.startNode();
|
|
15345
15542
|
this.next();
|
|
15346
|
-
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined
|
|
15543
|
+
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined);
|
|
15347
15544
|
return this.finishNode(node, "SpreadElement");
|
|
15348
15545
|
}
|
|
15349
15546
|
|
|
@@ -15439,8 +15636,7 @@ class LValParser extends NodeUtils {
|
|
|
15439
15636
|
}
|
|
15440
15637
|
|
|
15441
15638
|
prop.method = false;
|
|
15442
|
-
this.parseObjPropValue(prop, startPos, startLoc, false, false, true, false);
|
|
15443
|
-
return prop;
|
|
15639
|
+
return this.parseObjPropValue(prop, startPos, startLoc, false, false, true, false);
|
|
15444
15640
|
}
|
|
15445
15641
|
|
|
15446
15642
|
parseAssignableListItem(allowModifiers, decorators) {
|
|
@@ -15483,7 +15679,7 @@ class LValParser extends NodeUtils {
|
|
|
15483
15679
|
}, type);
|
|
15484
15680
|
}
|
|
15485
15681
|
|
|
15486
|
-
checkLVal(expression,
|
|
15682
|
+
checkLVal(expression, _ref89) {
|
|
15487
15683
|
var {
|
|
15488
15684
|
in: ancestor,
|
|
15489
15685
|
binding = BIND_NONE,
|
|
@@ -15491,7 +15687,7 @@ class LValParser extends NodeUtils {
|
|
|
15491
15687
|
strictModeChanged = false,
|
|
15492
15688
|
allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
|
|
15493
15689
|
hasParenthesizedAncestor = false
|
|
15494
|
-
} =
|
|
15690
|
+
} = _ref89;
|
|
15495
15691
|
|
|
15496
15692
|
var _expression$extra;
|
|
15497
15693
|
|
|
@@ -15900,7 +16096,7 @@ class ExpressionParser extends LValParser {
|
|
|
15900
16096
|
}
|
|
15901
16097
|
|
|
15902
16098
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
15903
|
-
this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
16099
|
+
var finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
15904
16100
|
var nextOp = this.state.type;
|
|
15905
16101
|
|
|
15906
16102
|
if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
|
|
@@ -15909,7 +16105,7 @@ class ExpressionParser extends LValParser {
|
|
|
15909
16105
|
});
|
|
15910
16106
|
}
|
|
15911
16107
|
|
|
15912
|
-
return this.parseExprOp(
|
|
16108
|
+
return this.parseExprOp(finishedNode, leftStartPos, leftStartLoc, minPrec);
|
|
15913
16109
|
}
|
|
15914
16110
|
}
|
|
15915
16111
|
|
|
@@ -16034,7 +16230,10 @@ class ExpressionParser extends LValParser {
|
|
|
16034
16230
|
}
|
|
16035
16231
|
|
|
16036
16232
|
if (!update) {
|
|
16037
|
-
if (!sawUnary)
|
|
16233
|
+
if (!sawUnary) {
|
|
16234
|
+
this.checkExponentialAfterUnary(node);
|
|
16235
|
+
}
|
|
16236
|
+
|
|
16038
16237
|
return this.finishNode(node, "UnaryExpression");
|
|
16039
16238
|
}
|
|
16040
16239
|
}
|
|
@@ -16061,8 +16260,9 @@ class ExpressionParser extends LValParser {
|
|
|
16061
16260
|
|
|
16062
16261
|
parseUpdate(node, update, refExpressionErrors) {
|
|
16063
16262
|
if (update) {
|
|
16064
|
-
|
|
16065
|
-
|
|
16263
|
+
var updateExpressionNode = node;
|
|
16264
|
+
this.checkLVal(updateExpressionNode.argument, {
|
|
16265
|
+
in: this.finishNode(updateExpressionNode, "UpdateExpression")
|
|
16066
16266
|
});
|
|
16067
16267
|
return node;
|
|
16068
16268
|
}
|
|
@@ -16217,25 +16417,25 @@ class ExpressionParser extends LValParser {
|
|
|
16217
16417
|
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
|
|
16218
16418
|
}
|
|
16219
16419
|
|
|
16220
|
-
this.finishCallExpression(node, optionalChainMember);
|
|
16420
|
+
var finishedNode = this.finishCallExpression(node, optionalChainMember);
|
|
16221
16421
|
|
|
16222
16422
|
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
|
|
16223
16423
|
state.stop = true;
|
|
16224
16424
|
this.checkDestructuringPrivate(refExpressionErrors);
|
|
16225
16425
|
this.expressionScope.validateAsPattern();
|
|
16226
16426
|
this.expressionScope.exit();
|
|
16227
|
-
|
|
16427
|
+
finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), finishedNode);
|
|
16228
16428
|
} else {
|
|
16229
16429
|
if (maybeAsyncArrow) {
|
|
16230
16430
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
16231
16431
|
this.expressionScope.exit();
|
|
16232
16432
|
}
|
|
16233
16433
|
|
|
16234
|
-
this.toReferencedArguments(
|
|
16434
|
+
this.toReferencedArguments(finishedNode);
|
|
16235
16435
|
}
|
|
16236
16436
|
|
|
16237
16437
|
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
|
16238
|
-
return
|
|
16438
|
+
return finishedNode;
|
|
16239
16439
|
}
|
|
16240
16440
|
|
|
16241
16441
|
toReferencedArguments(node, isParenthesizedExpr) {
|
|
@@ -16647,8 +16847,7 @@ class ExpressionParser extends LValParser {
|
|
|
16647
16847
|
}
|
|
16648
16848
|
|
|
16649
16849
|
this.expect(19);
|
|
16650
|
-
this.parseArrowExpression(node, params, true);
|
|
16651
|
-
return node;
|
|
16850
|
+
return this.parseArrowExpression(node, params, true);
|
|
16652
16851
|
}
|
|
16653
16852
|
|
|
16654
16853
|
parseDo(node, isAsync) {
|
|
@@ -16900,8 +17099,7 @@ class ExpressionParser extends LValParser {
|
|
|
16900
17099
|
|
|
16901
17100
|
var parenExpression = this.startNodeAt(startPos, startLoc);
|
|
16902
17101
|
parenExpression.expression = expression;
|
|
16903
|
-
this.finishNode(parenExpression, "ParenthesizedExpression");
|
|
16904
|
-
return parenExpression;
|
|
17102
|
+
return this.finishNode(parenExpression, "ParenthesizedExpression");
|
|
16905
17103
|
}
|
|
16906
17104
|
|
|
16907
17105
|
shouldParseArrow(params) {
|
|
@@ -16984,7 +17182,7 @@ class ExpressionParser extends LValParser {
|
|
|
16984
17182
|
if (value === null) {
|
|
16985
17183
|
if (!isTagged) {
|
|
16986
17184
|
this.raise(Errors.InvalidEscapeSequenceTemplate, {
|
|
16987
|
-
at: createPositionWithColumnOffset(
|
|
17185
|
+
at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
|
|
16988
17186
|
});
|
|
16989
17187
|
}
|
|
16990
17188
|
}
|
|
@@ -16998,9 +17196,9 @@ class ExpressionParser extends LValParser {
|
|
|
16998
17196
|
};
|
|
16999
17197
|
elem.tail = isTail;
|
|
17000
17198
|
this.next();
|
|
17001
|
-
this.finishNode(elem, "TemplateElement");
|
|
17002
|
-
this.resetEndLocation(
|
|
17003
|
-
return
|
|
17199
|
+
var finishedNode = this.finishNode(elem, "TemplateElement");
|
|
17200
|
+
this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
|
|
17201
|
+
return finishedNode;
|
|
17004
17202
|
}
|
|
17005
17203
|
|
|
17006
17204
|
parseTemplate(isTagged) {
|
|
@@ -17162,8 +17360,7 @@ class ExpressionParser extends LValParser {
|
|
|
17162
17360
|
}
|
|
17163
17361
|
}
|
|
17164
17362
|
|
|
17165
|
-
this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors);
|
|
17166
|
-
return prop;
|
|
17363
|
+
return this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors);
|
|
17167
17364
|
}
|
|
17168
17365
|
|
|
17169
17366
|
getGetterSetterExpectedParamCount(method) {
|
|
@@ -17195,9 +17392,9 @@ class ExpressionParser extends LValParser {
|
|
|
17195
17392
|
|
|
17196
17393
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
17197
17394
|
if (isAccessor) {
|
|
17198
|
-
this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
|
|
17199
|
-
this.checkGetterSetterParams(
|
|
17200
|
-
return
|
|
17395
|
+
var finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
|
|
17396
|
+
this.checkGetterSetterParams(finishedProp);
|
|
17397
|
+
return finishedProp;
|
|
17201
17398
|
}
|
|
17202
17399
|
|
|
17203
17400
|
if (isAsync || isGenerator || this.match(10)) {
|
|
@@ -17329,10 +17526,10 @@ class ExpressionParser extends LValParser {
|
|
|
17329
17526
|
this.scope.enter(SCOPE_FUNCTION | SCOPE_SUPER | (inClassScope ? SCOPE_CLASS : 0) | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
17330
17527
|
this.prodParam.enter(functionFlags(isAsync, node.generator));
|
|
17331
17528
|
this.parseFunctionParams(node, allowModifiers);
|
|
17332
|
-
this.parseFunctionBodyAndFinish(node, type, true);
|
|
17529
|
+
var finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
|
|
17333
17530
|
this.prodParam.exit();
|
|
17334
17531
|
this.scope.exit();
|
|
17335
|
-
return
|
|
17532
|
+
return finishedNode;
|
|
17336
17533
|
}
|
|
17337
17534
|
|
|
17338
17535
|
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
@@ -17382,7 +17579,7 @@ class ExpressionParser extends LValParser {
|
|
|
17382
17579
|
parseFunctionBodyAndFinish(node, type) {
|
|
17383
17580
|
var isMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
17384
17581
|
this.parseFunctionBody(node, false, isMethod);
|
|
17385
|
-
this.finishNode(node, type);
|
|
17582
|
+
return this.finishNode(node, type);
|
|
17386
17583
|
}
|
|
17387
17584
|
|
|
17388
17585
|
parseFunctionBody(node, allowExpression) {
|
|
@@ -17702,15 +17899,16 @@ class ExpressionParser extends LValParser {
|
|
|
17702
17899
|
}
|
|
17703
17900
|
|
|
17704
17901
|
parseSmartPipelineBodyInStyle(childExpr, startPos, startLoc) {
|
|
17705
|
-
var bodyNode = this.startNodeAt(startPos, startLoc);
|
|
17706
|
-
|
|
17707
17902
|
if (this.isSimpleReference(childExpr)) {
|
|
17903
|
+
var bodyNode = this.startNodeAt(startPos, startLoc);
|
|
17708
17904
|
bodyNode.callee = childExpr;
|
|
17709
17905
|
return this.finishNode(bodyNode, "PipelineBareFunction");
|
|
17710
17906
|
} else {
|
|
17907
|
+
var _bodyNode2 = this.startNodeAt(startPos, startLoc);
|
|
17908
|
+
|
|
17711
17909
|
this.checkSmartPipeTopicBodyEarlyErrors(startLoc);
|
|
17712
|
-
|
|
17713
|
-
return this.finishNode(
|
|
17910
|
+
_bodyNode2.expression = childExpr;
|
|
17911
|
+
return this.finishNode(_bodyNode2, "PipelineTopicExpression");
|
|
17714
17912
|
}
|
|
17715
17913
|
}
|
|
17716
17914
|
|
|
@@ -17847,7 +18045,7 @@ class ExpressionParser extends LValParser {
|
|
|
17847
18045
|
this.expectPlugin("moduleBlocks");
|
|
17848
18046
|
var node = this.startNode();
|
|
17849
18047
|
this.next();
|
|
17850
|
-
this.
|
|
18048
|
+
this.expect(5);
|
|
17851
18049
|
var revertScopes = this.initializeScopes(true);
|
|
17852
18050
|
this.enterInitialScopes();
|
|
17853
18051
|
var program = this.startNode();
|
|
@@ -18025,6 +18223,10 @@ class StatementParser extends ExpressionParser {
|
|
|
18025
18223
|
}
|
|
18026
18224
|
}
|
|
18027
18225
|
|
|
18226
|
+
if (end === 135) {
|
|
18227
|
+
this.next();
|
|
18228
|
+
}
|
|
18229
|
+
|
|
18028
18230
|
return this.finishNode(program, "Program");
|
|
18029
18231
|
}
|
|
18030
18232
|
|
|
@@ -18219,7 +18421,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18219
18421
|
}
|
|
18220
18422
|
}
|
|
18221
18423
|
|
|
18222
|
-
this.assertModuleNodeAllowed(
|
|
18424
|
+
this.assertModuleNodeAllowed(result);
|
|
18223
18425
|
return result;
|
|
18224
18426
|
}
|
|
18225
18427
|
|
|
@@ -18313,6 +18515,14 @@ class StatementParser extends ExpressionParser {
|
|
|
18313
18515
|
expr = this.parseExpression();
|
|
18314
18516
|
this.expect(11);
|
|
18315
18517
|
expr = this.wrapParenthesis(_startPos2, _startLoc2, expr);
|
|
18518
|
+
var paramsStartLoc = this.state.startLoc;
|
|
18519
|
+
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
18520
|
+
|
|
18521
|
+
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
18522
|
+
this.raise(Errors.DecoratorArgumentsOutsideParentheses, {
|
|
18523
|
+
at: paramsStartLoc
|
|
18524
|
+
});
|
|
18525
|
+
}
|
|
18316
18526
|
} else {
|
|
18317
18527
|
expr = this.parseIdentifier(false);
|
|
18318
18528
|
|
|
@@ -18320,13 +18530,21 @@ class StatementParser extends ExpressionParser {
|
|
|
18320
18530
|
var _node11 = this.startNodeAt(startPos, startLoc);
|
|
18321
18531
|
|
|
18322
18532
|
_node11.object = expr;
|
|
18323
|
-
|
|
18533
|
+
|
|
18534
|
+
if (this.match(134)) {
|
|
18535
|
+
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
18536
|
+
_node11.property = this.parsePrivateName();
|
|
18537
|
+
} else {
|
|
18538
|
+
_node11.property = this.parseIdentifier(true);
|
|
18539
|
+
}
|
|
18540
|
+
|
|
18324
18541
|
_node11.computed = false;
|
|
18325
18542
|
expr = this.finishNode(_node11, "MemberExpression");
|
|
18326
18543
|
}
|
|
18544
|
+
|
|
18545
|
+
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
18327
18546
|
}
|
|
18328
18547
|
|
|
18329
|
-
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
18330
18548
|
this.state.decoratorStack.pop();
|
|
18331
18549
|
} else {
|
|
18332
18550
|
node.expression = this.parseExprSubscripts();
|
|
@@ -18430,12 +18648,12 @@ class StatementParser extends ExpressionParser {
|
|
|
18430
18648
|
var isLet = startsWithLet && this.isLetKeyword();
|
|
18431
18649
|
|
|
18432
18650
|
if (this.match(74) || this.match(75) || isLet) {
|
|
18433
|
-
var
|
|
18434
|
-
|
|
18651
|
+
var initNode = this.startNode();
|
|
18435
18652
|
var kind = isLet ? "let" : this.state.value;
|
|
18436
18653
|
this.next();
|
|
18437
|
-
this.parseVar(
|
|
18438
|
-
|
|
18654
|
+
this.parseVar(initNode, true, kind);
|
|
18655
|
+
|
|
18656
|
+
var _init = this.finishNode(initNode, "VariableDeclaration");
|
|
18439
18657
|
|
|
18440
18658
|
if ((this.match(58) || this.isContextual(101)) && _init.declarations.length === 1) {
|
|
18441
18659
|
return this.parseForIn(node, _init, awaitAt);
|
|
@@ -18721,6 +18939,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18721
18939
|
}
|
|
18722
18940
|
|
|
18723
18941
|
this.parseBlockBody(node, allowDirectives, false, 8, afterBlockParse);
|
|
18942
|
+
this.next();
|
|
18724
18943
|
|
|
18725
18944
|
if (createNewLexicalScope) {
|
|
18726
18945
|
this.scope.exit();
|
|
@@ -18774,8 +18993,6 @@ class StatementParser extends ExpressionParser {
|
|
|
18774
18993
|
if (!oldStrict) {
|
|
18775
18994
|
this.setStrict(false);
|
|
18776
18995
|
}
|
|
18777
|
-
|
|
18778
|
-
this.next();
|
|
18779
18996
|
}
|
|
18780
18997
|
|
|
18781
18998
|
parseFor(node, init) {
|
|
@@ -19224,6 +19441,7 @@ class StatementParser extends ExpressionParser {
|
|
|
19224
19441
|
this.prodParam.enter(PARAM);
|
|
19225
19442
|
var body = member.body = [];
|
|
19226
19443
|
this.parseBlockOrModuleBlockBody(body, undefined, false, 8);
|
|
19444
|
+
this.next();
|
|
19227
19445
|
this.prodParam.exit();
|
|
19228
19446
|
this.scope.exit();
|
|
19229
19447
|
this.state.labels = oldLabels;
|
|
@@ -19731,11 +19949,11 @@ class StatementParser extends ExpressionParser {
|
|
|
19731
19949
|
|
|
19732
19950
|
isJSONModuleImport(node) {
|
|
19733
19951
|
if (node.assertions != null) {
|
|
19734
|
-
return node.assertions.some(
|
|
19952
|
+
return node.assertions.some(_ref90 => {
|
|
19735
19953
|
var {
|
|
19736
19954
|
key,
|
|
19737
19955
|
value
|
|
19738
|
-
} =
|
|
19956
|
+
} = _ref90;
|
|
19739
19957
|
return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type");
|
|
19740
19958
|
});
|
|
19741
19959
|
}
|
|
@@ -19749,7 +19967,7 @@ class StatementParser extends ExpressionParser {
|
|
|
19749
19967
|
specifiers
|
|
19750
19968
|
} = node;
|
|
19751
19969
|
|
|
19752
|
-
if (
|
|
19970
|
+
if (specifiers != null) {
|
|
19753
19971
|
var nonDefaultNamedSpecifier = specifiers.find(specifier => {
|
|
19754
19972
|
var imported;
|
|
19755
19973
|
|
|
@@ -19817,9 +20035,10 @@ class StatementParser extends ExpressionParser {
|
|
|
19817
20035
|
}
|
|
19818
20036
|
|
|
19819
20037
|
finishImportSpecifier(specifier, type) {
|
|
20038
|
+
var bindingType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : BIND_LEXICAL;
|
|
19820
20039
|
this.checkLVal(specifier.local, {
|
|
19821
20040
|
in: specifier,
|
|
19822
|
-
binding:
|
|
20041
|
+
binding: bindingType
|
|
19823
20042
|
});
|
|
19824
20043
|
return this.finishNode(specifier, type);
|
|
19825
20044
|
}
|
|
@@ -19860,8 +20079,7 @@ class StatementParser extends ExpressionParser {
|
|
|
19860
20079
|
}
|
|
19861
20080
|
|
|
19862
20081
|
node.value = this.parseStringLiteral(this.state.value);
|
|
19863
|
-
this.finishNode(node, "ImportAttribute");
|
|
19864
|
-
attrs.push(node);
|
|
20082
|
+
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
19865
20083
|
} while (this.eat(12));
|
|
19866
20084
|
|
|
19867
20085
|
return attrs;
|
|
@@ -19971,12 +20189,12 @@ class StatementParser extends ExpressionParser {
|
|
|
19971
20189
|
var importedIsString = this.match(129);
|
|
19972
20190
|
var isMaybeTypeOnly = this.isContextual(126);
|
|
19973
20191
|
specifier.imported = this.parseModuleExportName();
|
|
19974
|
-
var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
|
|
20192
|
+
var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, undefined);
|
|
19975
20193
|
node.specifiers.push(importSpecifier);
|
|
19976
20194
|
}
|
|
19977
20195
|
}
|
|
19978
20196
|
|
|
19979
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
20197
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
19980
20198
|
if (this.eatContextual(93)) {
|
|
19981
20199
|
specifier.local = this.parseIdentifier();
|
|
19982
20200
|
} else {
|
|
@@ -19998,7 +20216,7 @@ class StatementParser extends ExpressionParser {
|
|
|
19998
20216
|
}
|
|
19999
20217
|
}
|
|
20000
20218
|
|
|
20001
|
-
return this.finishImportSpecifier(specifier, "ImportSpecifier");
|
|
20219
|
+
return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType);
|
|
20002
20220
|
}
|
|
20003
20221
|
|
|
20004
20222
|
isThisParam(param) {
|