@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.bundle.js
CHANGED
|
@@ -497,7 +497,7 @@
|
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
/******************************************************************************
|
|
501
501
|
Copyright (c) Microsoft Corporation.
|
|
502
502
|
|
|
503
503
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -3125,10 +3125,10 @@
|
|
|
3125
3125
|
return new Position(line, column + columnOffset, index + columnOffset);
|
|
3126
3126
|
}
|
|
3127
3127
|
|
|
3128
|
-
var
|
|
3128
|
+
var ParseErrorCode = {
|
|
3129
3129
|
SyntaxError: "BABEL_PARSER_SYNTAX_ERROR",
|
|
3130
3130
|
SourceTypeModuleError: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
|
|
3131
|
-
}
|
|
3131
|
+
};
|
|
3132
3132
|
|
|
3133
3133
|
var reflect = function (keys) {
|
|
3134
3134
|
var last = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keys.length - 1;
|
|
@@ -3144,42 +3144,47 @@
|
|
|
3144
3144
|
};
|
|
3145
3145
|
};
|
|
3146
3146
|
|
|
3147
|
-
var instantiate = (constructor, properties, descriptors) => Object.keys(descriptors).map(key => [key, descriptors[key]]).filter(
|
|
3148
|
-
var [, descriptor] =
|
|
3147
|
+
var instantiate = (constructor, properties, descriptors) => Object.keys(descriptors).map(key => [key, descriptors[key]]).filter(_ref3 => {
|
|
3148
|
+
var [, descriptor] = _ref3;
|
|
3149
3149
|
return !!descriptor;
|
|
3150
|
-
}).map(
|
|
3151
|
-
var [key, descriptor] =
|
|
3150
|
+
}).map(_ref4 => {
|
|
3151
|
+
var [key, descriptor] = _ref4;
|
|
3152
3152
|
return [key, typeof descriptor === "function" ? {
|
|
3153
3153
|
value: descriptor,
|
|
3154
3154
|
enumerable: false
|
|
3155
3155
|
} : typeof descriptor.reflect === "string" ? Object.assign({}, descriptor, reflect(descriptor.reflect.split("."))) : descriptor];
|
|
3156
|
-
}).reduce((instance,
|
|
3157
|
-
var [key, descriptor] =
|
|
3156
|
+
}).reduce((instance, _ref5) => {
|
|
3157
|
+
var [key, descriptor] = _ref5;
|
|
3158
3158
|
return Object.defineProperty(instance, key, Object.assign({
|
|
3159
3159
|
configurable: true
|
|
3160
3160
|
}, descriptor));
|
|
3161
3161
|
}, Object.assign(new constructor(), properties));
|
|
3162
3162
|
|
|
3163
|
-
var ModuleErrors =
|
|
3164
|
-
ImportMetaOutsideModule:
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3163
|
+
var ModuleErrors = {
|
|
3164
|
+
ImportMetaOutsideModule: {
|
|
3165
|
+
message: "import.meta may appear only with 'sourceType: \"module\"'",
|
|
3166
|
+
code: ParseErrorCode.SourceTypeModuleError
|
|
3167
|
+
},
|
|
3168
|
+
ImportOutsideModule: {
|
|
3169
|
+
message: "'import' and 'export' may appear only with 'sourceType: \"module\"'",
|
|
3170
|
+
code: ParseErrorCode.SourceTypeModuleError
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
3172
3173
|
var NodeDescriptions = {
|
|
3173
3174
|
ArrayPattern: "array destructuring pattern",
|
|
3174
3175
|
AssignmentExpression: "assignment expression",
|
|
3175
3176
|
AssignmentPattern: "assignment expression",
|
|
3176
3177
|
ArrowFunctionExpression: "arrow function expression",
|
|
3177
3178
|
ConditionalExpression: "conditional expression",
|
|
3179
|
+
CatchClause: "catch clause",
|
|
3178
3180
|
ForOfStatement: "for-of statement",
|
|
3179
3181
|
ForInStatement: "for-in statement",
|
|
3180
3182
|
ForStatement: "for-loop",
|
|
3181
3183
|
FormalParameters: "function parameter list",
|
|
3182
3184
|
Identifier: "identifier",
|
|
3185
|
+
ImportSpecifier: "import specifier",
|
|
3186
|
+
ImportDefaultSpecifier: "import default specifier",
|
|
3187
|
+
ImportNamespaceSpecifier: "import namespace specifier",
|
|
3183
3188
|
ObjectPattern: "object destructuring pattern",
|
|
3184
3189
|
ParenthesizedExpression: "parenthesized expression",
|
|
3185
3190
|
RestElement: "rest element",
|
|
@@ -3191,349 +3196,347 @@
|
|
|
3191
3196
|
YieldExpression: "yield expression"
|
|
3192
3197
|
};
|
|
3193
3198
|
|
|
3194
|
-
var toNodeDescription =
|
|
3199
|
+
var toNodeDescription = _ref6 => {
|
|
3195
3200
|
var {
|
|
3196
3201
|
type,
|
|
3197
3202
|
prefix
|
|
3198
|
-
} =
|
|
3203
|
+
} = _ref6;
|
|
3199
3204
|
return type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];
|
|
3200
3205
|
};
|
|
3201
3206
|
|
|
3202
|
-
var StandardErrors =
|
|
3203
|
-
AccessorIsGenerator:
|
|
3207
|
+
var StandardErrors = {
|
|
3208
|
+
AccessorIsGenerator: _ref7 => {
|
|
3204
3209
|
var {
|
|
3205
3210
|
kind
|
|
3206
|
-
} =
|
|
3211
|
+
} = _ref7;
|
|
3207
3212
|
return "A ".concat(kind, "ter cannot be a generator.");
|
|
3208
|
-
}
|
|
3209
|
-
ArgumentsInClass:
|
|
3210
|
-
AsyncFunctionInSingleStatementContext:
|
|
3211
|
-
AwaitBindingIdentifier:
|
|
3212
|
-
AwaitBindingIdentifierInStaticBlock:
|
|
3213
|
-
AwaitExpressionFormalParameter:
|
|
3214
|
-
AwaitNotInAsyncContext:
|
|
3215
|
-
AwaitNotInAsyncFunction:
|
|
3216
|
-
BadGetterArity:
|
|
3217
|
-
BadSetterArity:
|
|
3218
|
-
BadSetterRestParameter:
|
|
3219
|
-
ConstructorClassField:
|
|
3220
|
-
ConstructorClassPrivateField:
|
|
3221
|
-
ConstructorIsAccessor:
|
|
3222
|
-
ConstructorIsAsync:
|
|
3223
|
-
ConstructorIsGenerator:
|
|
3224
|
-
DeclarationMissingInitializer:
|
|
3213
|
+
},
|
|
3214
|
+
ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
|
|
3215
|
+
AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
|
|
3216
|
+
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
|
|
3217
|
+
AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
|
|
3218
|
+
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
3219
|
+
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
3220
|
+
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
|
|
3221
|
+
BadGetterArity: "A 'get' accesor must not have any formal parameters.",
|
|
3222
|
+
BadSetterArity: "A 'set' accesor must have exactly one formal parameter.",
|
|
3223
|
+
BadSetterRestParameter: "A 'set' accesor function argument must not be a rest parameter.",
|
|
3224
|
+
ConstructorClassField: "Classes may not have a field named 'constructor'.",
|
|
3225
|
+
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
|
|
3226
|
+
ConstructorIsAccessor: "Class constructor may not be an accessor.",
|
|
3227
|
+
ConstructorIsAsync: "Constructor can't be an async function.",
|
|
3228
|
+
ConstructorIsGenerator: "Constructor can't be a generator.",
|
|
3229
|
+
DeclarationMissingInitializer: _ref8 => {
|
|
3225
3230
|
var {
|
|
3226
3231
|
kind
|
|
3227
|
-
} =
|
|
3232
|
+
} = _ref8;
|
|
3228
3233
|
return "Missing initializer in ".concat(kind, " declaration.");
|
|
3229
|
-
}
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3234
|
+
},
|
|
3235
|
+
DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
|
|
3236
|
+
DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax.",
|
|
3237
|
+
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
|
3238
|
+
DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.",
|
|
3239
|
+
DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
|
|
3240
|
+
DecoratorStaticBlock: "Decorators can't be used with a static block.",
|
|
3241
|
+
DeletePrivateField: "Deleting a private field is not allowed.",
|
|
3242
|
+
DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
|
|
3243
|
+
DuplicateConstructor: "Duplicate constructor in the same class.",
|
|
3244
|
+
DuplicateDefaultExport: "Only one default export allowed per module.",
|
|
3245
|
+
DuplicateExport: _ref9 => {
|
|
3240
3246
|
var {
|
|
3241
3247
|
exportName
|
|
3242
|
-
} =
|
|
3248
|
+
} = _ref9;
|
|
3243
3249
|
return "`".concat(exportName, "` has already been exported. Exported identifiers must be unique.");
|
|
3244
|
-
}
|
|
3245
|
-
DuplicateProto:
|
|
3246
|
-
DuplicateRegExpFlags:
|
|
3247
|
-
ElementAfterRest:
|
|
3248
|
-
EscapedCharNotAnIdentifier:
|
|
3249
|
-
ExportBindingIsString:
|
|
3250
|
+
},
|
|
3251
|
+
DuplicateProto: "Redefinition of __proto__ property.",
|
|
3252
|
+
DuplicateRegExpFlags: "Duplicate regular expression flag.",
|
|
3253
|
+
ElementAfterRest: "Rest element must be last element.",
|
|
3254
|
+
EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
|
|
3255
|
+
ExportBindingIsString: _ref10 => {
|
|
3250
3256
|
var {
|
|
3251
3257
|
localName,
|
|
3252
3258
|
exportName
|
|
3253
|
-
} =
|
|
3259
|
+
} = _ref10;
|
|
3254
3260
|
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'`?");
|
|
3255
|
-
}
|
|
3256
|
-
ExportDefaultFromAsIdentifier:
|
|
3257
|
-
ForInOfLoopInitializer:
|
|
3261
|
+
},
|
|
3262
|
+
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
|
|
3263
|
+
ForInOfLoopInitializer: _ref11 => {
|
|
3258
3264
|
var {
|
|
3259
3265
|
type
|
|
3260
|
-
} =
|
|
3266
|
+
} = _ref11;
|
|
3261
3267
|
return "'".concat(type === "ForInStatement" ? "for-in" : "for-of", "' loop variable declaration may not have an initializer.");
|
|
3262
|
-
}
|
|
3263
|
-
ForOfAsync:
|
|
3264
|
-
ForOfLet:
|
|
3265
|
-
GeneratorInSingleStatementContext:
|
|
3266
|
-
IllegalBreakContinue:
|
|
3268
|
+
},
|
|
3269
|
+
ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
|
|
3270
|
+
ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
|
|
3271
|
+
GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
|
|
3272
|
+
IllegalBreakContinue: _ref12 => {
|
|
3267
3273
|
var {
|
|
3268
3274
|
type
|
|
3269
|
-
} =
|
|
3275
|
+
} = _ref12;
|
|
3270
3276
|
return "Unsyntactic ".concat(type === "BreakStatement" ? "break" : "continue", ".");
|
|
3271
|
-
}
|
|
3272
|
-
IllegalLanguageModeDirective:
|
|
3273
|
-
IllegalReturn:
|
|
3274
|
-
ImportBindingIsString:
|
|
3277
|
+
},
|
|
3278
|
+
IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
|
|
3279
|
+
IllegalReturn: "'return' outside of function.",
|
|
3280
|
+
ImportBindingIsString: _ref13 => {
|
|
3275
3281
|
var {
|
|
3276
3282
|
importName
|
|
3277
|
-
} =
|
|
3283
|
+
} = _ref13;
|
|
3278
3284
|
return "A string literal cannot be used as an imported binding.\n- Did you mean `import { \"".concat(importName, "\" as foo }`?");
|
|
3279
|
-
}
|
|
3280
|
-
ImportCallArgumentTrailingComma:
|
|
3281
|
-
ImportCallArity:
|
|
3285
|
+
},
|
|
3286
|
+
ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.",
|
|
3287
|
+
ImportCallArity: _ref14 => {
|
|
3282
3288
|
var {
|
|
3283
3289
|
maxArgumentCount
|
|
3284
|
-
} =
|
|
3290
|
+
} = _ref14;
|
|
3285
3291
|
return "`import()` requires exactly ".concat(maxArgumentCount === 1 ? "one argument" : "one or two arguments", ".");
|
|
3286
|
-
}
|
|
3287
|
-
ImportCallNotNewExpression:
|
|
3288
|
-
ImportCallSpreadArgument:
|
|
3289
|
-
ImportJSONBindingNotDefault:
|
|
3290
|
-
IncompatibleRegExpUVFlags:
|
|
3291
|
-
InvalidBigIntLiteral:
|
|
3292
|
-
InvalidCodePoint:
|
|
3293
|
-
InvalidCoverInitializedName:
|
|
3294
|
-
InvalidDecimal:
|
|
3295
|
-
InvalidDigit:
|
|
3292
|
+
},
|
|
3293
|
+
ImportCallNotNewExpression: "Cannot use new with import(...).",
|
|
3294
|
+
ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
|
|
3295
|
+
ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
|
|
3296
|
+
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
3297
|
+
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
3298
|
+
InvalidCodePoint: "Code point out of bounds.",
|
|
3299
|
+
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
3300
|
+
InvalidDecimal: "Invalid decimal.",
|
|
3301
|
+
InvalidDigit: _ref15 => {
|
|
3296
3302
|
var {
|
|
3297
3303
|
radix
|
|
3298
|
-
} =
|
|
3304
|
+
} = _ref15;
|
|
3299
3305
|
return "Expected number in radix ".concat(radix, ".");
|
|
3300
|
-
}
|
|
3301
|
-
InvalidEscapeSequence:
|
|
3302
|
-
InvalidEscapeSequenceTemplate:
|
|
3303
|
-
InvalidEscapedReservedWord:
|
|
3306
|
+
},
|
|
3307
|
+
InvalidEscapeSequence: "Bad character escape sequence.",
|
|
3308
|
+
InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
|
|
3309
|
+
InvalidEscapedReservedWord: _ref16 => {
|
|
3304
3310
|
var {
|
|
3305
3311
|
reservedWord
|
|
3306
|
-
} =
|
|
3312
|
+
} = _ref16;
|
|
3307
3313
|
return "Escape sequence in keyword ".concat(reservedWord, ".");
|
|
3308
|
-
}
|
|
3309
|
-
InvalidIdentifier:
|
|
3314
|
+
},
|
|
3315
|
+
InvalidIdentifier: _ref17 => {
|
|
3310
3316
|
var {
|
|
3311
3317
|
identifierName
|
|
3312
|
-
} =
|
|
3318
|
+
} = _ref17;
|
|
3313
3319
|
return "Invalid identifier ".concat(identifierName, ".");
|
|
3314
|
-
}
|
|
3315
|
-
InvalidLhs:
|
|
3320
|
+
},
|
|
3321
|
+
InvalidLhs: _ref18 => {
|
|
3316
3322
|
var {
|
|
3317
3323
|
ancestor
|
|
3318
|
-
} =
|
|
3324
|
+
} = _ref18;
|
|
3319
3325
|
return "Invalid left-hand side in ".concat(toNodeDescription(ancestor), ".");
|
|
3320
|
-
}
|
|
3321
|
-
InvalidLhsBinding:
|
|
3326
|
+
},
|
|
3327
|
+
InvalidLhsBinding: _ref19 => {
|
|
3322
3328
|
var {
|
|
3323
3329
|
ancestor
|
|
3324
|
-
} =
|
|
3330
|
+
} = _ref19;
|
|
3325
3331
|
return "Binding invalid left-hand side in ".concat(toNodeDescription(ancestor), ".");
|
|
3326
|
-
}
|
|
3327
|
-
InvalidNumber:
|
|
3328
|
-
InvalidOrMissingExponent:
|
|
3329
|
-
InvalidOrUnexpectedToken:
|
|
3332
|
+
},
|
|
3333
|
+
InvalidNumber: "Invalid number.",
|
|
3334
|
+
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
|
|
3335
|
+
InvalidOrUnexpectedToken: _ref20 => {
|
|
3330
3336
|
var {
|
|
3331
3337
|
unexpected
|
|
3332
|
-
} =
|
|
3338
|
+
} = _ref20;
|
|
3333
3339
|
return "Unexpected character '".concat(unexpected, "'.");
|
|
3334
|
-
}
|
|
3335
|
-
InvalidParenthesizedAssignment:
|
|
3336
|
-
InvalidPrivateFieldResolution:
|
|
3340
|
+
},
|
|
3341
|
+
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
|
|
3342
|
+
InvalidPrivateFieldResolution: _ref21 => {
|
|
3337
3343
|
var {
|
|
3338
3344
|
identifierName
|
|
3339
|
-
} =
|
|
3345
|
+
} = _ref21;
|
|
3340
3346
|
return "Private name #".concat(identifierName, " is not defined.");
|
|
3341
|
-
}
|
|
3342
|
-
InvalidPropertyBindingPattern:
|
|
3343
|
-
InvalidRecordProperty:
|
|
3344
|
-
InvalidRestAssignmentPattern:
|
|
3345
|
-
LabelRedeclaration:
|
|
3347
|
+
},
|
|
3348
|
+
InvalidPropertyBindingPattern: "Binding member expression.",
|
|
3349
|
+
InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions.",
|
|
3350
|
+
InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
|
|
3351
|
+
LabelRedeclaration: _ref22 => {
|
|
3346
3352
|
var {
|
|
3347
3353
|
labelName
|
|
3348
|
-
} =
|
|
3354
|
+
} = _ref22;
|
|
3349
3355
|
return "Label '".concat(labelName, "' is already declared.");
|
|
3350
|
-
}
|
|
3351
|
-
LetInLexicalBinding:
|
|
3352
|
-
LineTerminatorBeforeArrow:
|
|
3353
|
-
MalformedRegExpFlags:
|
|
3354
|
-
MissingClassName:
|
|
3355
|
-
MissingEqInAssignment:
|
|
3356
|
-
MissingSemicolon:
|
|
3357
|
-
MissingPlugin:
|
|
3356
|
+
},
|
|
3357
|
+
LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations.",
|
|
3358
|
+
LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
|
|
3359
|
+
MalformedRegExpFlags: "Invalid regular expression flag.",
|
|
3360
|
+
MissingClassName: "A class name is required.",
|
|
3361
|
+
MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
|
|
3362
|
+
MissingSemicolon: "Missing semicolon.",
|
|
3363
|
+
MissingPlugin: _ref23 => {
|
|
3358
3364
|
var {
|
|
3359
3365
|
missingPlugin
|
|
3360
|
-
} =
|
|
3366
|
+
} = _ref23;
|
|
3361
3367
|
return "This experimental syntax requires enabling the parser plugin: ".concat(missingPlugin.map(name => JSON.stringify(name)).join(", "), ".");
|
|
3362
|
-
}
|
|
3363
|
-
MissingOneOfPlugins:
|
|
3368
|
+
},
|
|
3369
|
+
MissingOneOfPlugins: _ref24 => {
|
|
3364
3370
|
var {
|
|
3365
3371
|
missingPlugin
|
|
3366
|
-
} =
|
|
3372
|
+
} = _ref24;
|
|
3367
3373
|
return "This experimental syntax requires enabling one of the following parser plugin(s): ".concat(missingPlugin.map(name => JSON.stringify(name)).join(", "), ".");
|
|
3368
|
-
}
|
|
3369
|
-
MissingUnicodeEscape:
|
|
3370
|
-
MixingCoalesceWithLogical:
|
|
3371
|
-
ModuleAttributeDifferentFromType:
|
|
3372
|
-
ModuleAttributeInvalidValue:
|
|
3373
|
-
ModuleAttributesWithDuplicateKeys:
|
|
3374
|
+
},
|
|
3375
|
+
MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
|
|
3376
|
+
MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
|
|
3377
|
+
ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`.",
|
|
3378
|
+
ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
|
|
3379
|
+
ModuleAttributesWithDuplicateKeys: _ref25 => {
|
|
3374
3380
|
var {
|
|
3375
3381
|
key
|
|
3376
|
-
} =
|
|
3382
|
+
} = _ref25;
|
|
3377
3383
|
return "Duplicate key \"".concat(key, "\" is not allowed in module attributes.");
|
|
3378
|
-
}
|
|
3379
|
-
ModuleExportNameHasLoneSurrogate:
|
|
3384
|
+
},
|
|
3385
|
+
ModuleExportNameHasLoneSurrogate: _ref26 => {
|
|
3380
3386
|
var {
|
|
3381
3387
|
surrogateCharCode
|
|
3382
|
-
} =
|
|
3388
|
+
} = _ref26;
|
|
3383
3389
|
return "An export name cannot include a lone surrogate, found '\\u".concat(surrogateCharCode.toString(16), "'.");
|
|
3384
|
-
}
|
|
3385
|
-
ModuleExportUndefined:
|
|
3390
|
+
},
|
|
3391
|
+
ModuleExportUndefined: _ref27 => {
|
|
3386
3392
|
var {
|
|
3387
3393
|
localName
|
|
3388
|
-
} =
|
|
3394
|
+
} = _ref27;
|
|
3389
3395
|
return "Export '".concat(localName, "' is not defined.");
|
|
3390
|
-
}
|
|
3391
|
-
MultipleDefaultsInSwitch:
|
|
3392
|
-
NewlineAfterThrow:
|
|
3393
|
-
NoCatchOrFinally:
|
|
3394
|
-
NumberIdentifier:
|
|
3395
|
-
NumericSeparatorInEscapeSequence:
|
|
3396
|
-
ObsoleteAwaitStar:
|
|
3397
|
-
OptionalChainingNoNew:
|
|
3398
|
-
OptionalChainingNoTemplate:
|
|
3399
|
-
OverrideOnConstructor:
|
|
3400
|
-
ParamDupe:
|
|
3401
|
-
PatternHasAccessor:
|
|
3402
|
-
PatternHasMethod:
|
|
3403
|
-
PrivateInExpectedIn:
|
|
3396
|
+
},
|
|
3397
|
+
MultipleDefaultsInSwitch: "Multiple default clauses.",
|
|
3398
|
+
NewlineAfterThrow: "Illegal newline after throw.",
|
|
3399
|
+
NoCatchOrFinally: "Missing catch or finally clause.",
|
|
3400
|
+
NumberIdentifier: "Identifier directly after number.",
|
|
3401
|
+
NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
|
|
3402
|
+
ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
|
|
3403
|
+
OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
|
|
3404
|
+
OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
|
|
3405
|
+
OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
|
|
3406
|
+
ParamDupe: "Argument name clash.",
|
|
3407
|
+
PatternHasAccessor: "Object pattern can't contain getter or setter.",
|
|
3408
|
+
PatternHasMethod: "Object pattern can't contain methods.",
|
|
3409
|
+
PrivateInExpectedIn: _ref28 => {
|
|
3404
3410
|
var {
|
|
3405
3411
|
identifierName
|
|
3406
|
-
} =
|
|
3412
|
+
} = _ref28;
|
|
3407
3413
|
return "Private names are only allowed in property accesses (`obj.#".concat(identifierName, "`) or in `in` expressions (`#").concat(identifierName, " in obj`).");
|
|
3408
|
-
}
|
|
3409
|
-
PrivateNameRedeclaration:
|
|
3414
|
+
},
|
|
3415
|
+
PrivateNameRedeclaration: _ref29 => {
|
|
3410
3416
|
var {
|
|
3411
3417
|
identifierName
|
|
3412
|
-
} =
|
|
3418
|
+
} = _ref29;
|
|
3413
3419
|
return "Duplicate private name #".concat(identifierName, ".");
|
|
3414
|
-
}
|
|
3415
|
-
RecordExpressionBarIncorrectEndSyntaxType:
|
|
3416
|
-
RecordExpressionBarIncorrectStartSyntaxType:
|
|
3417
|
-
RecordExpressionHashIncorrectStartSyntaxType:
|
|
3418
|
-
RecordNoProto:
|
|
3419
|
-
RestTrailingComma:
|
|
3420
|
-
SloppyFunction:
|
|
3421
|
-
StaticPrototype:
|
|
3422
|
-
SuperNotAllowed:
|
|
3423
|
-
SuperPrivateField:
|
|
3424
|
-
TrailingDecorator:
|
|
3425
|
-
TupleExpressionBarIncorrectEndSyntaxType:
|
|
3426
|
-
TupleExpressionBarIncorrectStartSyntaxType:
|
|
3427
|
-
TupleExpressionHashIncorrectStartSyntaxType:
|
|
3428
|
-
UnexpectedArgumentPlaceholder:
|
|
3429
|
-
UnexpectedAwaitAfterPipelineBody:
|
|
3430
|
-
UnexpectedDigitAfterHash:
|
|
3431
|
-
UnexpectedImportExport:
|
|
3432
|
-
UnexpectedKeyword:
|
|
3420
|
+
},
|
|
3421
|
+
RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3422
|
+
RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3423
|
+
RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
|
|
3424
|
+
RecordNoProto: "'__proto__' is not allowed in Record expressions.",
|
|
3425
|
+
RestTrailingComma: "Unexpected trailing comma after rest element.",
|
|
3426
|
+
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.",
|
|
3427
|
+
StaticPrototype: "Classes may not have static property named prototype.",
|
|
3428
|
+
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?",
|
|
3429
|
+
SuperPrivateField: "Private fields can't be accessed on super.",
|
|
3430
|
+
TrailingDecorator: "Decorators must be attached to a class element.",
|
|
3431
|
+
TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3432
|
+
TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",
|
|
3433
|
+
TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",
|
|
3434
|
+
UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
|
|
3435
|
+
UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',
|
|
3436
|
+
UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
|
|
3437
|
+
UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
|
|
3438
|
+
UnexpectedKeyword: _ref30 => {
|
|
3433
3439
|
var {
|
|
3434
3440
|
keyword
|
|
3435
|
-
} =
|
|
3441
|
+
} = _ref30;
|
|
3436
3442
|
return "Unexpected keyword '".concat(keyword, "'.");
|
|
3437
|
-
}
|
|
3438
|
-
UnexpectedLeadingDecorator:
|
|
3439
|
-
UnexpectedLexicalDeclaration:
|
|
3440
|
-
UnexpectedNewTarget:
|
|
3441
|
-
UnexpectedNumericSeparator:
|
|
3442
|
-
UnexpectedPrivateField:
|
|
3443
|
-
UnexpectedReservedWord:
|
|
3443
|
+
},
|
|
3444
|
+
UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
|
|
3445
|
+
UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
|
|
3446
|
+
UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
|
|
3447
|
+
UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
|
|
3448
|
+
UnexpectedPrivateField: "Unexpected private name.",
|
|
3449
|
+
UnexpectedReservedWord: _ref31 => {
|
|
3444
3450
|
var {
|
|
3445
3451
|
reservedWord
|
|
3446
|
-
} =
|
|
3452
|
+
} = _ref31;
|
|
3447
3453
|
return "Unexpected reserved word '".concat(reservedWord, "'.");
|
|
3448
|
-
}
|
|
3449
|
-
UnexpectedSuper:
|
|
3450
|
-
UnexpectedToken:
|
|
3454
|
+
},
|
|
3455
|
+
UnexpectedSuper: "'super' is only allowed in object methods and classes.",
|
|
3456
|
+
UnexpectedToken: _ref32 => {
|
|
3451
3457
|
var {
|
|
3452
3458
|
expected,
|
|
3453
3459
|
unexpected
|
|
3454
|
-
} =
|
|
3460
|
+
} = _ref32;
|
|
3455
3461
|
return "Unexpected token".concat(unexpected ? " '".concat(unexpected, "'.") : "").concat(expected ? ", expected \"".concat(expected, "\"") : "");
|
|
3456
|
-
}
|
|
3457
|
-
UnexpectedTokenUnaryExponentiation:
|
|
3458
|
-
UnsupportedBind:
|
|
3459
|
-
UnsupportedDecoratorExport:
|
|
3460
|
-
UnsupportedDefaultExport:
|
|
3461
|
-
UnsupportedImport:
|
|
3462
|
-
UnsupportedMetaProperty:
|
|
3462
|
+
},
|
|
3463
|
+
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
|
3464
|
+
UnsupportedBind: "Binding should be performed on object property.",
|
|
3465
|
+
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
3466
|
+
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
3467
|
+
UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
|
|
3468
|
+
UnsupportedMetaProperty: _ref33 => {
|
|
3463
3469
|
var {
|
|
3464
3470
|
target,
|
|
3465
3471
|
onlyValidPropertyName
|
|
3466
|
-
} =
|
|
3472
|
+
} = _ref33;
|
|
3467
3473
|
return "The only valid meta property for ".concat(target, " is ").concat(target, ".").concat(onlyValidPropertyName, ".");
|
|
3468
|
-
}
|
|
3469
|
-
UnsupportedParameterDecorator:
|
|
3470
|
-
UnsupportedPropertyDecorator:
|
|
3471
|
-
UnsupportedSuper:
|
|
3472
|
-
UnterminatedComment:
|
|
3473
|
-
UnterminatedRegExp:
|
|
3474
|
-
UnterminatedString:
|
|
3475
|
-
UnterminatedTemplate:
|
|
3476
|
-
VarRedeclaration:
|
|
3474
|
+
},
|
|
3475
|
+
UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
|
|
3476
|
+
UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
|
|
3477
|
+
UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
|
|
3478
|
+
UnterminatedComment: "Unterminated comment.",
|
|
3479
|
+
UnterminatedRegExp: "Unterminated regular expression.",
|
|
3480
|
+
UnterminatedString: "Unterminated string constant.",
|
|
3481
|
+
UnterminatedTemplate: "Unterminated template.",
|
|
3482
|
+
VarRedeclaration: _ref34 => {
|
|
3477
3483
|
var {
|
|
3478
3484
|
identifierName
|
|
3479
|
-
} =
|
|
3485
|
+
} = _ref34;
|
|
3480
3486
|
return "Identifier '".concat(identifierName, "' has already been declared.");
|
|
3481
|
-
}
|
|
3482
|
-
YieldBindingIdentifier:
|
|
3483
|
-
YieldInParameter:
|
|
3484
|
-
ZeroDigitNumericSeparator:
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
StrictEvalArguments: _(_ref34 => {
|
|
3487
|
+
},
|
|
3488
|
+
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
|
|
3489
|
+
YieldInParameter: "Yield expression is not allowed in formal parameters.",
|
|
3490
|
+
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
|
|
3491
|
+
};
|
|
3492
|
+
var StrictModeErrors = {
|
|
3493
|
+
StrictDelete: "Deleting local variable in strict mode.",
|
|
3494
|
+
StrictEvalArguments: _ref35 => {
|
|
3490
3495
|
var {
|
|
3491
3496
|
referenceName
|
|
3492
|
-
} =
|
|
3497
|
+
} = _ref35;
|
|
3493
3498
|
return "Assigning to '".concat(referenceName, "' in strict mode.");
|
|
3494
|
-
}
|
|
3495
|
-
StrictEvalArgumentsBinding:
|
|
3499
|
+
},
|
|
3500
|
+
StrictEvalArgumentsBinding: _ref36 => {
|
|
3496
3501
|
var {
|
|
3497
3502
|
bindingName
|
|
3498
|
-
} =
|
|
3503
|
+
} = _ref36;
|
|
3499
3504
|
return "Binding '".concat(bindingName, "' in strict mode.");
|
|
3500
|
-
}
|
|
3501
|
-
StrictFunction:
|
|
3502
|
-
StrictNumericEscape:
|
|
3503
|
-
StrictOctalLiteral:
|
|
3504
|
-
StrictWith:
|
|
3505
|
-
}
|
|
3506
|
-
|
|
3505
|
+
},
|
|
3506
|
+
StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
|
|
3507
|
+
StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
|
|
3508
|
+
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
|
|
3509
|
+
StrictWith: "'with' in strict mode."
|
|
3510
|
+
};
|
|
3507
3511
|
var UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
PipeTopicUnconfiguredToken: _(_ref36 => {
|
|
3512
|
+
var PipelineOperatorErrors = {
|
|
3513
|
+
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
|
|
3514
|
+
PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
|
|
3515
|
+
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
|
3516
|
+
PipeTopicUnconfiguredToken: _ref37 => {
|
|
3514
3517
|
var {
|
|
3515
3518
|
token
|
|
3516
|
-
} =
|
|
3519
|
+
} = _ref37;
|
|
3517
3520
|
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, "\" }.");
|
|
3518
|
-
}
|
|
3519
|
-
PipeTopicUnused:
|
|
3520
|
-
PipeUnparenthesizedBody:
|
|
3521
|
+
},
|
|
3522
|
+
PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
|
|
3523
|
+
PipeUnparenthesizedBody: _ref38 => {
|
|
3521
3524
|
var {
|
|
3522
3525
|
type
|
|
3523
|
-
} =
|
|
3526
|
+
} = _ref38;
|
|
3524
3527
|
return "Hack-style pipe body cannot be an unparenthesized ".concat(toNodeDescription({
|
|
3525
3528
|
type
|
|
3526
3529
|
}), "; please wrap it in parentheses.");
|
|
3527
|
-
}
|
|
3528
|
-
PipelineBodyNoArrow:
|
|
3529
|
-
PipelineBodySequenceExpression:
|
|
3530
|
-
PipelineHeadSequenceExpression:
|
|
3531
|
-
PipelineTopicUnused:
|
|
3532
|
-
PrimaryTopicNotAllowed:
|
|
3533
|
-
PrimaryTopicRequiresSmartPipeline:
|
|
3534
|
-
}
|
|
3535
|
-
|
|
3536
|
-
|
|
3530
|
+
},
|
|
3531
|
+
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
|
|
3532
|
+
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
|
|
3533
|
+
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
|
|
3534
|
+
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
|
|
3535
|
+
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
3536
|
+
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
3537
|
+
};
|
|
3538
|
+
var _excluded$1 = ["toMessage"],
|
|
3539
|
+
_excluded2$1 = ["message"];
|
|
3537
3540
|
|
|
3538
3541
|
function toParseErrorConstructor(_ref) {
|
|
3539
3542
|
var {
|
|
@@ -3541,11 +3544,11 @@
|
|
|
3541
3544
|
} = _ref,
|
|
3542
3545
|
properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
3543
3546
|
|
|
3544
|
-
return function constructor(
|
|
3547
|
+
return function constructor(_ref39) {
|
|
3545
3548
|
var {
|
|
3546
3549
|
loc,
|
|
3547
3550
|
details
|
|
3548
|
-
} =
|
|
3551
|
+
} = _ref39;
|
|
3549
3552
|
return instantiate(SyntaxError, Object.assign({}, properties, {
|
|
3550
3553
|
loc
|
|
3551
3554
|
}), {
|
|
@@ -3586,27 +3589,38 @@
|
|
|
3586
3589
|
};
|
|
3587
3590
|
}
|
|
3588
3591
|
|
|
3589
|
-
function toParseErrorCredentials(toMessageOrMessage, credentials) {
|
|
3590
|
-
return Object.assign({
|
|
3591
|
-
toMessage: typeof toMessageOrMessage === "string" ? () => toMessageOrMessage : toMessageOrMessage
|
|
3592
|
-
}, credentials);
|
|
3593
|
-
}
|
|
3594
|
-
|
|
3595
3592
|
function ParseErrorEnum(argument, syntaxPlugin) {
|
|
3596
3593
|
if (Array.isArray(argument)) {
|
|
3597
|
-
return
|
|
3594
|
+
return parseErrorTemplates => ParseErrorEnum(parseErrorTemplates, argument[0]);
|
|
3598
3595
|
}
|
|
3599
3596
|
|
|
3600
|
-
var partialCredentials = argument(toParseErrorCredentials);
|
|
3601
3597
|
var ParseErrorConstructors = {};
|
|
3602
3598
|
|
|
3603
|
-
|
|
3599
|
+
var _loop = function (reasonCode) {
|
|
3600
|
+
var template = argument[reasonCode];
|
|
3601
|
+
|
|
3602
|
+
var _ref2 = typeof template === "string" ? {
|
|
3603
|
+
message: () => template
|
|
3604
|
+
} : typeof template === "function" ? {
|
|
3605
|
+
message: template
|
|
3606
|
+
} : template,
|
|
3607
|
+
{
|
|
3608
|
+
message
|
|
3609
|
+
} = _ref2,
|
|
3610
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
|
|
3611
|
+
|
|
3612
|
+
var toMessage = typeof message === "string" ? () => message : message;
|
|
3604
3613
|
ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
|
|
3605
|
-
code:
|
|
3606
|
-
reasonCode
|
|
3614
|
+
code: ParseErrorCode.SyntaxError,
|
|
3615
|
+
reasonCode,
|
|
3616
|
+
toMessage
|
|
3607
3617
|
}, syntaxPlugin ? {
|
|
3608
3618
|
syntaxPlugin
|
|
3609
|
-
} : {},
|
|
3619
|
+
} : {}, rest));
|
|
3620
|
+
};
|
|
3621
|
+
|
|
3622
|
+
for (var reasonCode of Object.keys(argument)) {
|
|
3623
|
+
_loop(reasonCode);
|
|
3610
3624
|
}
|
|
3611
3625
|
|
|
3612
3626
|
return ParseErrorConstructors;
|
|
@@ -3628,7 +3642,7 @@
|
|
|
3628
3642
|
return node;
|
|
3629
3643
|
}
|
|
3630
3644
|
|
|
3631
|
-
var estree = superClass => class extends superClass {
|
|
3645
|
+
var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
3632
3646
|
parse() {
|
|
3633
3647
|
var file = toESTreeLocation(super.parse());
|
|
3634
3648
|
|
|
@@ -3639,11 +3653,11 @@
|
|
|
3639
3653
|
return file;
|
|
3640
3654
|
}
|
|
3641
3655
|
|
|
3642
|
-
parseRegExpLiteral(
|
|
3656
|
+
parseRegExpLiteral(_ref40) {
|
|
3643
3657
|
var {
|
|
3644
3658
|
pattern,
|
|
3645
3659
|
flags
|
|
3646
|
-
} =
|
|
3660
|
+
} = _ref40;
|
|
3647
3661
|
var regex = null;
|
|
3648
3662
|
|
|
3649
3663
|
try {
|
|
@@ -3700,14 +3714,17 @@
|
|
|
3700
3714
|
}
|
|
3701
3715
|
|
|
3702
3716
|
directiveToStmt(directive) {
|
|
3703
|
-
var
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
expression.
|
|
3707
|
-
expression.
|
|
3708
|
-
stmt
|
|
3709
|
-
stmt.
|
|
3710
|
-
|
|
3717
|
+
var expression = directive.value;
|
|
3718
|
+
delete directive.value;
|
|
3719
|
+
expression.type = "Literal";
|
|
3720
|
+
expression.raw = expression.extra.raw;
|
|
3721
|
+
expression.value = expression.extra.expressionValue;
|
|
3722
|
+
var stmt = directive;
|
|
3723
|
+
stmt.type = "ExpressionStatement";
|
|
3724
|
+
stmt.expression = expression;
|
|
3725
|
+
stmt.directive = expression.extra.rawValue;
|
|
3726
|
+
delete expression.extra;
|
|
3727
|
+
return stmt;
|
|
3711
3728
|
}
|
|
3712
3729
|
|
|
3713
3730
|
initFunction(node, isAsync) {
|
|
@@ -3733,12 +3750,8 @@
|
|
|
3733
3750
|
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) != null && _stmt$expression$extr.parenthesized);
|
|
3734
3751
|
}
|
|
3735
3752
|
|
|
3736
|
-
parseBlockBody(node) {
|
|
3737
|
-
|
|
3738
|
-
args[_key - 1] = arguments[_key];
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
super.parseBlockBody(node, ...args);
|
|
3753
|
+
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
|
|
3754
|
+
super.parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse);
|
|
3742
3755
|
var directiveStatements = node.directives.map(d => this.directiveToStmt(d));
|
|
3743
3756
|
node.body = directiveStatements.concat(node.body);
|
|
3744
3757
|
delete node.directives;
|
|
@@ -3818,8 +3831,7 @@
|
|
|
3818
3831
|
node.computed = false;
|
|
3819
3832
|
}
|
|
3820
3833
|
|
|
3821
|
-
|
|
3822
|
-
return this.finishNode(node, type);
|
|
3834
|
+
return this.finishNode(node, "MethodDefinition");
|
|
3823
3835
|
}
|
|
3824
3836
|
|
|
3825
3837
|
parseClassProperty() {
|
|
@@ -3850,7 +3862,11 @@
|
|
|
3850
3862
|
|
|
3851
3863
|
if (node) {
|
|
3852
3864
|
node.type = "Property";
|
|
3853
|
-
|
|
3865
|
+
|
|
3866
|
+
if (node.kind === "method") {
|
|
3867
|
+
node.kind = "init";
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3854
3870
|
node.shorthand = false;
|
|
3855
3871
|
}
|
|
3856
3872
|
|
|
@@ -3868,12 +3884,8 @@
|
|
|
3868
3884
|
return node;
|
|
3869
3885
|
}
|
|
3870
3886
|
|
|
3871
|
-
isValidLVal(type) {
|
|
3872
|
-
|
|
3873
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
3874
|
-
}
|
|
3875
|
-
|
|
3876
|
-
return type === "Property" ? "value" : super.isValidLVal(type, ...rest);
|
|
3887
|
+
isValidLVal(type, isUnparenthesizedInAssign, binding) {
|
|
3888
|
+
return type === "Property" ? "value" : super.isValidLVal(type, isUnparenthesizedInAssign, binding);
|
|
3877
3889
|
}
|
|
3878
3890
|
|
|
3879
3891
|
isAssignable(node, isBinding) {
|
|
@@ -3903,7 +3915,7 @@
|
|
|
3903
3915
|
}
|
|
3904
3916
|
}
|
|
3905
3917
|
|
|
3906
|
-
toAssignableObjectExpressionProp(prop) {
|
|
3918
|
+
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
3907
3919
|
if (prop.kind === "get" || prop.kind === "set") {
|
|
3908
3920
|
this.raise(Errors.PatternHasAccessor, {
|
|
3909
3921
|
at: prop.key
|
|
@@ -3913,12 +3925,12 @@
|
|
|
3913
3925
|
at: prop.key
|
|
3914
3926
|
});
|
|
3915
3927
|
} else {
|
|
3916
|
-
super.toAssignableObjectExpressionProp(
|
|
3928
|
+
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
3917
3929
|
}
|
|
3918
3930
|
}
|
|
3919
3931
|
|
|
3920
|
-
finishCallExpression(
|
|
3921
|
-
super.finishCallExpression(
|
|
3932
|
+
finishCallExpression(unfinished, optional) {
|
|
3933
|
+
var node = super.finishCallExpression(unfinished, optional);
|
|
3922
3934
|
|
|
3923
3935
|
if (node.callee.type === "Import") {
|
|
3924
3936
|
node.type = "ImportExpression";
|
|
@@ -3945,8 +3957,8 @@
|
|
|
3945
3957
|
super.toReferencedArguments(node);
|
|
3946
3958
|
}
|
|
3947
3959
|
|
|
3948
|
-
parseExport(
|
|
3949
|
-
super.parseExport(
|
|
3960
|
+
parseExport(unfinished) {
|
|
3961
|
+
var node = super.parseExport(unfinished);
|
|
3950
3962
|
|
|
3951
3963
|
switch (node.type) {
|
|
3952
3964
|
case "ExportAllDeclaration":
|
|
@@ -4621,12 +4633,12 @@
|
|
|
4621
4633
|
};
|
|
4622
4634
|
}
|
|
4623
4635
|
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";
|
|
4624
|
-
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-\
|
|
4636
|
+
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";
|
|
4625
4637
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
4626
4638
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
4627
4639
|
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
4628
|
-
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,
|
|
4629
|
-
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,
|
|
4640
|
+
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];
|
|
4641
|
+
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];
|
|
4630
4642
|
|
|
4631
4643
|
function isInAstralSet(code, set) {
|
|
4632
4644
|
var pos = 0x10000;
|
|
@@ -4724,12 +4736,13 @@
|
|
|
4724
4736
|
BIND_SCOPE_VAR = 0b000000000100,
|
|
4725
4737
|
BIND_SCOPE_LEXICAL = 0b000000001000,
|
|
4726
4738
|
BIND_SCOPE_FUNCTION = 0b000000010000,
|
|
4727
|
-
BIND_FLAGS_NONE =
|
|
4728
|
-
BIND_FLAGS_CLASS =
|
|
4729
|
-
BIND_FLAGS_TS_ENUM =
|
|
4730
|
-
BIND_FLAGS_TS_CONST_ENUM =
|
|
4731
|
-
BIND_FLAGS_TS_EXPORT_ONLY =
|
|
4732
|
-
BIND_FLAGS_FLOW_DECLARE_FN =
|
|
4739
|
+
BIND_FLAGS_NONE = 0b0000001000000,
|
|
4740
|
+
BIND_FLAGS_CLASS = 0b0000010000000,
|
|
4741
|
+
BIND_FLAGS_TS_ENUM = 0b0000100000000,
|
|
4742
|
+
BIND_FLAGS_TS_CONST_ENUM = 0b0001000000000,
|
|
4743
|
+
BIND_FLAGS_TS_EXPORT_ONLY = 0b0010000000000,
|
|
4744
|
+
BIND_FLAGS_FLOW_DECLARE_FN = 0b0100000000000,
|
|
4745
|
+
BIND_FLAGS_TS_IMPORT = 0b1000000000000;
|
|
4733
4746
|
var BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS,
|
|
4734
4747
|
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
|
|
4735
4748
|
BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
|
|
@@ -4742,6 +4755,7 @@
|
|
|
4742
4755
|
BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE,
|
|
4743
4756
|
BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,
|
|
4744
4757
|
BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
|
|
4758
|
+
BIND_TS_TYPE_IMPORT = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_TS_IMPORT,
|
|
4745
4759
|
BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;
|
|
4746
4760
|
var CLASS_ELEMENT_FLAG_STATIC = 0b100,
|
|
4747
4761
|
CLASS_ELEMENT_KIND_GETTER = 0b010,
|
|
@@ -4753,59 +4767,285 @@
|
|
|
4753
4767
|
CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER,
|
|
4754
4768
|
CLASS_ELEMENT_OTHER = 0;
|
|
4755
4769
|
|
|
4756
|
-
class
|
|
4757
|
-
constructor() {
|
|
4758
|
-
this.
|
|
4759
|
-
this.
|
|
4770
|
+
class Scope {
|
|
4771
|
+
constructor(flags) {
|
|
4772
|
+
this.var = new Set();
|
|
4773
|
+
this.lexical = new Set();
|
|
4774
|
+
this.functions = new Set();
|
|
4775
|
+
this.flags = flags;
|
|
4760
4776
|
}
|
|
4761
4777
|
|
|
4762
|
-
|
|
4763
|
-
if (typeof pluginConfig === "string") {
|
|
4764
|
-
return this.plugins.has(pluginConfig);
|
|
4765
|
-
} else {
|
|
4766
|
-
var [pluginName, pluginOptions] = pluginConfig;
|
|
4778
|
+
}
|
|
4767
4779
|
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4780
|
+
class ScopeHandler {
|
|
4781
|
+
constructor(parser, inModule) {
|
|
4782
|
+
this.parser = void 0;
|
|
4783
|
+
this.scopeStack = [];
|
|
4784
|
+
this.inModule = void 0;
|
|
4785
|
+
this.undefinedExports = new Map();
|
|
4786
|
+
this.parser = parser;
|
|
4787
|
+
this.inModule = inModule;
|
|
4788
|
+
}
|
|
4771
4789
|
|
|
4772
|
-
|
|
4790
|
+
get inFunction() {
|
|
4791
|
+
return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
4792
|
+
}
|
|
4773
4793
|
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
}
|
|
4778
|
-
}
|
|
4794
|
+
get allowSuper() {
|
|
4795
|
+
return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;
|
|
4796
|
+
}
|
|
4779
4797
|
|
|
4780
|
-
|
|
4781
|
-
|
|
4798
|
+
get allowDirectSuper() {
|
|
4799
|
+
return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;
|
|
4782
4800
|
}
|
|
4783
4801
|
|
|
4784
|
-
|
|
4785
|
-
|
|
4802
|
+
get inClass() {
|
|
4803
|
+
return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;
|
|
4804
|
+
}
|
|
4786
4805
|
|
|
4787
|
-
|
|
4806
|
+
get inClassAndNotInNonArrowFunction() {
|
|
4807
|
+
var flags = this.currentThisScopeFlags();
|
|
4808
|
+
return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
|
|
4788
4809
|
}
|
|
4789
4810
|
|
|
4790
|
-
|
|
4811
|
+
get inStaticBlock() {
|
|
4812
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4813
|
+
var {
|
|
4814
|
+
flags
|
|
4815
|
+
} = this.scopeStack[i];
|
|
4791
4816
|
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4817
|
+
if (flags & SCOPE_STATIC_BLOCK) {
|
|
4818
|
+
return true;
|
|
4819
|
+
}
|
|
4820
|
+
|
|
4821
|
+
if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
|
|
4822
|
+
return false;
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4797
4825
|
}
|
|
4798
|
-
}
|
|
4799
4826
|
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
node.leadingComments = comments;
|
|
4803
|
-
} else {
|
|
4804
|
-
node.leadingComments.unshift(...comments);
|
|
4827
|
+
get inNonArrowFunction() {
|
|
4828
|
+
return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
4805
4829
|
}
|
|
4806
|
-
}
|
|
4807
4830
|
|
|
4808
|
-
|
|
4831
|
+
get treatFunctionsAsVar() {
|
|
4832
|
+
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4835
|
+
createScope(flags) {
|
|
4836
|
+
return new Scope(flags);
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
enter(flags) {
|
|
4840
|
+
this.scopeStack.push(this.createScope(flags));
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
exit() {
|
|
4844
|
+
var scope = this.scopeStack.pop();
|
|
4845
|
+
return scope.flags;
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4848
|
+
treatFunctionsAsVarInScope(scope) {
|
|
4849
|
+
return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
|
|
4850
|
+
}
|
|
4851
|
+
|
|
4852
|
+
declareName(name, bindingType, loc) {
|
|
4853
|
+
var scope = this.currentScope();
|
|
4854
|
+
|
|
4855
|
+
if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {
|
|
4856
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4857
|
+
|
|
4858
|
+
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
4859
|
+
scope.functions.add(name);
|
|
4860
|
+
} else {
|
|
4861
|
+
scope.lexical.add(name);
|
|
4862
|
+
}
|
|
4863
|
+
|
|
4864
|
+
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
4865
|
+
this.maybeExportDefined(scope, name);
|
|
4866
|
+
}
|
|
4867
|
+
} else if (bindingType & BIND_SCOPE_VAR) {
|
|
4868
|
+
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
4869
|
+
scope = this.scopeStack[i];
|
|
4870
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4871
|
+
scope.var.add(name);
|
|
4872
|
+
this.maybeExportDefined(scope, name);
|
|
4873
|
+
if (scope.flags & SCOPE_VAR) break;
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4876
|
+
|
|
4877
|
+
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
4878
|
+
this.undefinedExports.delete(name);
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
|
|
4882
|
+
maybeExportDefined(scope, name) {
|
|
4883
|
+
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
4884
|
+
this.undefinedExports.delete(name);
|
|
4885
|
+
}
|
|
4886
|
+
}
|
|
4887
|
+
|
|
4888
|
+
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
4889
|
+
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
4890
|
+
this.parser.raise(Errors.VarRedeclaration, {
|
|
4891
|
+
at: loc,
|
|
4892
|
+
identifierName: name
|
|
4893
|
+
});
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
isRedeclaredInScope(scope, name, bindingType) {
|
|
4898
|
+
if (!(bindingType & BIND_KIND_VALUE)) return false;
|
|
4899
|
+
|
|
4900
|
+
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
4901
|
+
return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
|
|
4902
|
+
}
|
|
4903
|
+
|
|
4904
|
+
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
4905
|
+
return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
|
|
4906
|
+
}
|
|
4907
|
+
|
|
4908
|
+
return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
|
|
4909
|
+
}
|
|
4910
|
+
|
|
4911
|
+
checkLocalExport(id) {
|
|
4912
|
+
var {
|
|
4913
|
+
name
|
|
4914
|
+
} = id;
|
|
4915
|
+
var topLevelScope = this.scopeStack[0];
|
|
4916
|
+
|
|
4917
|
+
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
|
|
4918
|
+
this.undefinedExports.set(name, id.loc.start);
|
|
4919
|
+
}
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
currentScope() {
|
|
4923
|
+
return this.scopeStack[this.scopeStack.length - 1];
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
currentVarScopeFlags() {
|
|
4927
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4928
|
+
var {
|
|
4929
|
+
flags
|
|
4930
|
+
} = this.scopeStack[i];
|
|
4931
|
+
|
|
4932
|
+
if (flags & SCOPE_VAR) {
|
|
4933
|
+
return flags;
|
|
4934
|
+
}
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
|
|
4938
|
+
currentThisScopeFlags() {
|
|
4939
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4940
|
+
var {
|
|
4941
|
+
flags
|
|
4942
|
+
} = this.scopeStack[i];
|
|
4943
|
+
|
|
4944
|
+
if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {
|
|
4945
|
+
return flags;
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
|
|
4950
|
+
}
|
|
4951
|
+
|
|
4952
|
+
class FlowScope extends Scope {
|
|
4953
|
+
constructor() {
|
|
4954
|
+
super(...arguments);
|
|
4955
|
+
this.declareFunctions = new Set();
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4958
|
+
}
|
|
4959
|
+
|
|
4960
|
+
class FlowScopeHandler extends ScopeHandler {
|
|
4961
|
+
createScope(flags) {
|
|
4962
|
+
return new FlowScope(flags);
|
|
4963
|
+
}
|
|
4964
|
+
|
|
4965
|
+
declareName(name, bindingType, loc) {
|
|
4966
|
+
var scope = this.currentScope();
|
|
4967
|
+
|
|
4968
|
+
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
4969
|
+
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4970
|
+
this.maybeExportDefined(scope, name);
|
|
4971
|
+
scope.declareFunctions.add(name);
|
|
4972
|
+
return;
|
|
4973
|
+
}
|
|
4974
|
+
|
|
4975
|
+
super.declareName(name, bindingType, loc);
|
|
4976
|
+
}
|
|
4977
|
+
|
|
4978
|
+
isRedeclaredInScope(scope, name, bindingType) {
|
|
4979
|
+
if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
|
|
4980
|
+
|
|
4981
|
+
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
4982
|
+
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
|
|
4983
|
+
}
|
|
4984
|
+
|
|
4985
|
+
return false;
|
|
4986
|
+
}
|
|
4987
|
+
|
|
4988
|
+
checkLocalExport(id) {
|
|
4989
|
+
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
|
|
4990
|
+
super.checkLocalExport(id);
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4996
|
+
class BaseParser {
|
|
4997
|
+
constructor() {
|
|
4998
|
+
this.sawUnambiguousESM = false;
|
|
4999
|
+
this.ambiguousScriptDifferentAst = false;
|
|
5000
|
+
}
|
|
5001
|
+
|
|
5002
|
+
hasPlugin(pluginConfig) {
|
|
5003
|
+
if (typeof pluginConfig === "string") {
|
|
5004
|
+
return this.plugins.has(pluginConfig);
|
|
5005
|
+
} else {
|
|
5006
|
+
var [pluginName, pluginOptions] = pluginConfig;
|
|
5007
|
+
|
|
5008
|
+
if (!this.hasPlugin(pluginName)) {
|
|
5009
|
+
return false;
|
|
5010
|
+
}
|
|
5011
|
+
|
|
5012
|
+
var actualOptions = this.plugins.get(pluginName);
|
|
5013
|
+
|
|
5014
|
+
for (var key of Object.keys(pluginOptions)) {
|
|
5015
|
+
if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
|
|
5016
|
+
return false;
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
|
|
5020
|
+
return true;
|
|
5021
|
+
}
|
|
5022
|
+
}
|
|
5023
|
+
|
|
5024
|
+
getPluginOption(plugin, name) {
|
|
5025
|
+
var _this$plugins$get;
|
|
5026
|
+
|
|
5027
|
+
return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
|
|
5028
|
+
}
|
|
5029
|
+
|
|
5030
|
+
}
|
|
5031
|
+
|
|
5032
|
+
function setTrailingComments(node, comments) {
|
|
5033
|
+
if (node.trailingComments === undefined) {
|
|
5034
|
+
node.trailingComments = comments;
|
|
5035
|
+
} else {
|
|
5036
|
+
node.trailingComments.unshift(...comments);
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
|
|
5040
|
+
function setLeadingComments(node, comments) {
|
|
5041
|
+
if (node.leadingComments === undefined) {
|
|
5042
|
+
node.leadingComments = comments;
|
|
5043
|
+
} else {
|
|
5044
|
+
node.leadingComments.unshift(...comments);
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5047
|
+
|
|
5048
|
+
function setInnerComments(node, comments) {
|
|
4809
5049
|
if (node.innerComments === undefined) {
|
|
4810
5050
|
node.innerComments = comments;
|
|
4811
5051
|
} else {
|
|
@@ -5074,65 +5314,394 @@
|
|
|
5074
5314
|
this.context = [types.brace];
|
|
5075
5315
|
this.canStartJSXElement = true;
|
|
5076
5316
|
this.containsEsc = false;
|
|
5317
|
+
this.firstInvalidTemplateEscapePos = null;
|
|
5077
5318
|
this.strictErrors = new Map();
|
|
5078
5319
|
this.tokensLength = 0;
|
|
5079
5320
|
}
|
|
5080
5321
|
|
|
5081
|
-
init(
|
|
5082
|
-
var {
|
|
5083
|
-
strictMode,
|
|
5084
|
-
sourceType,
|
|
5085
|
-
startLine,
|
|
5086
|
-
startColumn
|
|
5087
|
-
} =
|
|
5088
|
-
this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
|
|
5089
|
-
this.curLine = startLine;
|
|
5090
|
-
this.lineStart = -startColumn;
|
|
5091
|
-
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
5322
|
+
init(_ref41) {
|
|
5323
|
+
var {
|
|
5324
|
+
strictMode,
|
|
5325
|
+
sourceType,
|
|
5326
|
+
startLine,
|
|
5327
|
+
startColumn
|
|
5328
|
+
} = _ref41;
|
|
5329
|
+
this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
|
|
5330
|
+
this.curLine = startLine;
|
|
5331
|
+
this.lineStart = -startColumn;
|
|
5332
|
+
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
5333
|
+
}
|
|
5334
|
+
|
|
5335
|
+
curPosition() {
|
|
5336
|
+
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
|
|
5337
|
+
}
|
|
5338
|
+
|
|
5339
|
+
clone(skipArrays) {
|
|
5340
|
+
var state = new State();
|
|
5341
|
+
var keys = Object.keys(this);
|
|
5342
|
+
|
|
5343
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
|
5344
|
+
var key = keys[i];
|
|
5345
|
+
var val = this[key];
|
|
5346
|
+
|
|
5347
|
+
if (!skipArrays && Array.isArray(val)) {
|
|
5348
|
+
val = val.slice();
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5351
|
+
state[key] = val;
|
|
5352
|
+
}
|
|
5353
|
+
|
|
5354
|
+
return state;
|
|
5355
|
+
}
|
|
5356
|
+
|
|
5357
|
+
}
|
|
5358
|
+
|
|
5359
|
+
var _isDigit = function isDigit(code) {
|
|
5360
|
+
return code >= 48 && code <= 57;
|
|
5361
|
+
};
|
|
5362
|
+
|
|
5363
|
+
var forbiddenNumericSeparatorSiblings = {
|
|
5364
|
+
decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
|
|
5365
|
+
hex: new Set([46, 88, 95, 120])
|
|
5366
|
+
};
|
|
5367
|
+
var isAllowedNumericSeparatorSibling = {
|
|
5368
|
+
bin: ch => ch === 48 || ch === 49,
|
|
5369
|
+
oct: ch => ch >= 48 && ch <= 55,
|
|
5370
|
+
dec: ch => ch >= 48 && ch <= 57,
|
|
5371
|
+
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
5372
|
+
};
|
|
5373
|
+
|
|
5374
|
+
function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
5375
|
+
var initialPos = pos;
|
|
5376
|
+
var initialLineStart = lineStart;
|
|
5377
|
+
var initialCurLine = curLine;
|
|
5378
|
+
var out = "";
|
|
5379
|
+
var firstInvalidLoc = null;
|
|
5380
|
+
var chunkStart = pos;
|
|
5381
|
+
var {
|
|
5382
|
+
length
|
|
5383
|
+
} = input;
|
|
5384
|
+
|
|
5385
|
+
for (;;) {
|
|
5386
|
+
if (pos >= length) {
|
|
5387
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
5388
|
+
out += input.slice(chunkStart, pos);
|
|
5389
|
+
break;
|
|
5390
|
+
}
|
|
5391
|
+
|
|
5392
|
+
var ch = input.charCodeAt(pos);
|
|
5393
|
+
|
|
5394
|
+
if (isStringEnd(type, ch, input, pos)) {
|
|
5395
|
+
out += input.slice(chunkStart, pos);
|
|
5396
|
+
break;
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5399
|
+
if (ch === 92) {
|
|
5400
|
+
out += input.slice(chunkStart, pos);
|
|
5401
|
+
var res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
|
|
5402
|
+
|
|
5403
|
+
if (res.ch === null && !firstInvalidLoc) {
|
|
5404
|
+
firstInvalidLoc = {
|
|
5405
|
+
pos,
|
|
5406
|
+
lineStart,
|
|
5407
|
+
curLine
|
|
5408
|
+
};
|
|
5409
|
+
} else {
|
|
5410
|
+
out += res.ch;
|
|
5411
|
+
}
|
|
5412
|
+
|
|
5413
|
+
({
|
|
5414
|
+
pos,
|
|
5415
|
+
lineStart,
|
|
5416
|
+
curLine
|
|
5417
|
+
} = res);
|
|
5418
|
+
chunkStart = pos;
|
|
5419
|
+
} else if (ch === 8232 || ch === 8233) {
|
|
5420
|
+
++pos;
|
|
5421
|
+
++curLine;
|
|
5422
|
+
lineStart = pos;
|
|
5423
|
+
} else if (ch === 10 || ch === 13) {
|
|
5424
|
+
if (type === "template") {
|
|
5425
|
+
out += input.slice(chunkStart, pos) + "\n";
|
|
5426
|
+
++pos;
|
|
5427
|
+
|
|
5428
|
+
if (ch === 13 && input.charCodeAt(pos) === 10) {
|
|
5429
|
+
++pos;
|
|
5430
|
+
}
|
|
5431
|
+
|
|
5432
|
+
++curLine;
|
|
5433
|
+
chunkStart = lineStart = pos;
|
|
5434
|
+
} else {
|
|
5435
|
+
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
5436
|
+
}
|
|
5437
|
+
} else {
|
|
5438
|
+
++pos;
|
|
5439
|
+
}
|
|
5440
|
+
}
|
|
5441
|
+
|
|
5442
|
+
return {
|
|
5443
|
+
pos,
|
|
5444
|
+
str: out,
|
|
5445
|
+
firstInvalidLoc,
|
|
5446
|
+
lineStart,
|
|
5447
|
+
curLine,
|
|
5448
|
+
containsInvalid: !!firstInvalidLoc
|
|
5449
|
+
};
|
|
5450
|
+
}
|
|
5451
|
+
|
|
5452
|
+
function isStringEnd(type, ch, input, pos) {
|
|
5453
|
+
if (type === "template") {
|
|
5454
|
+
return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
|
|
5455
|
+
}
|
|
5456
|
+
|
|
5457
|
+
return ch === (type === "double" ? 34 : 39);
|
|
5458
|
+
}
|
|
5459
|
+
|
|
5460
|
+
function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
5461
|
+
var throwOnInvalid = !inTemplate;
|
|
5462
|
+
pos++;
|
|
5463
|
+
|
|
5464
|
+
var res = ch => ({
|
|
5465
|
+
pos,
|
|
5466
|
+
ch,
|
|
5467
|
+
lineStart,
|
|
5468
|
+
curLine
|
|
5469
|
+
});
|
|
5470
|
+
|
|
5471
|
+
var ch = input.charCodeAt(pos++);
|
|
5472
|
+
|
|
5473
|
+
switch (ch) {
|
|
5474
|
+
case 110:
|
|
5475
|
+
return res("\n");
|
|
5476
|
+
|
|
5477
|
+
case 114:
|
|
5478
|
+
return res("\r");
|
|
5479
|
+
|
|
5480
|
+
case 120:
|
|
5481
|
+
{
|
|
5482
|
+
var code;
|
|
5483
|
+
({
|
|
5484
|
+
code,
|
|
5485
|
+
pos
|
|
5486
|
+
} = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
5487
|
+
return res(code === null ? null : String.fromCharCode(code));
|
|
5488
|
+
}
|
|
5489
|
+
|
|
5490
|
+
case 117:
|
|
5491
|
+
{
|
|
5492
|
+
var _code;
|
|
5493
|
+
|
|
5494
|
+
({
|
|
5495
|
+
code: _code,
|
|
5496
|
+
pos
|
|
5497
|
+
} = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
5498
|
+
return res(_code === null ? null : String.fromCodePoint(_code));
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5501
|
+
case 116:
|
|
5502
|
+
return res("\t");
|
|
5503
|
+
|
|
5504
|
+
case 98:
|
|
5505
|
+
return res("\b");
|
|
5506
|
+
|
|
5507
|
+
case 118:
|
|
5508
|
+
return res("\u000b");
|
|
5509
|
+
|
|
5510
|
+
case 102:
|
|
5511
|
+
return res("\f");
|
|
5512
|
+
|
|
5513
|
+
case 13:
|
|
5514
|
+
if (input.charCodeAt(pos) === 10) {
|
|
5515
|
+
++pos;
|
|
5516
|
+
}
|
|
5517
|
+
|
|
5518
|
+
case 10:
|
|
5519
|
+
lineStart = pos;
|
|
5520
|
+
++curLine;
|
|
5521
|
+
|
|
5522
|
+
case 8232:
|
|
5523
|
+
case 8233:
|
|
5524
|
+
return res("");
|
|
5525
|
+
|
|
5526
|
+
case 56:
|
|
5527
|
+
case 57:
|
|
5528
|
+
if (inTemplate) {
|
|
5529
|
+
return res(null);
|
|
5530
|
+
} else {
|
|
5531
|
+
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
5532
|
+
}
|
|
5533
|
+
|
|
5534
|
+
default:
|
|
5535
|
+
if (ch >= 48 && ch <= 55) {
|
|
5536
|
+
var startPos = pos - 1;
|
|
5537
|
+
var match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
|
|
5538
|
+
var octalStr = match[0];
|
|
5539
|
+
var octal = parseInt(octalStr, 8);
|
|
5540
|
+
|
|
5541
|
+
if (octal > 255) {
|
|
5542
|
+
octalStr = octalStr.slice(0, -1);
|
|
5543
|
+
octal = parseInt(octalStr, 8);
|
|
5544
|
+
}
|
|
5545
|
+
|
|
5546
|
+
pos += octalStr.length - 1;
|
|
5547
|
+
var next = input.charCodeAt(pos);
|
|
5548
|
+
|
|
5549
|
+
if (octalStr !== "0" || next === 56 || next === 57) {
|
|
5550
|
+
if (inTemplate) {
|
|
5551
|
+
return res(null);
|
|
5552
|
+
} else {
|
|
5553
|
+
errors.strictNumericEscape(startPos, lineStart, curLine);
|
|
5554
|
+
}
|
|
5555
|
+
}
|
|
5556
|
+
|
|
5557
|
+
return res(String.fromCharCode(octal));
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
return res(String.fromCharCode(ch));
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
|
|
5564
|
+
function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
5565
|
+
var initialPos = pos;
|
|
5566
|
+
var n;
|
|
5567
|
+
({
|
|
5568
|
+
n,
|
|
5569
|
+
pos
|
|
5570
|
+
} = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
5571
|
+
|
|
5572
|
+
if (n === null) {
|
|
5573
|
+
if (throwOnInvalid) {
|
|
5574
|
+
errors.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
5575
|
+
} else {
|
|
5576
|
+
pos = initialPos - 1;
|
|
5577
|
+
}
|
|
5578
|
+
}
|
|
5579
|
+
|
|
5580
|
+
return {
|
|
5581
|
+
code: n,
|
|
5582
|
+
pos
|
|
5583
|
+
};
|
|
5584
|
+
}
|
|
5585
|
+
|
|
5586
|
+
function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
5587
|
+
var start = pos;
|
|
5588
|
+
var forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
5589
|
+
var isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
5590
|
+
var invalid = false;
|
|
5591
|
+
var total = 0;
|
|
5592
|
+
|
|
5593
|
+
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
5594
|
+
var code = input.charCodeAt(pos);
|
|
5595
|
+
var val = void 0;
|
|
5596
|
+
|
|
5597
|
+
if (code === 95 && allowNumSeparator !== "bail") {
|
|
5598
|
+
var prev = input.charCodeAt(pos - 1);
|
|
5599
|
+
var next = input.charCodeAt(pos + 1);
|
|
5600
|
+
|
|
5601
|
+
if (!allowNumSeparator) {
|
|
5602
|
+
if (bailOnError) return {
|
|
5603
|
+
n: null,
|
|
5604
|
+
pos
|
|
5605
|
+
};
|
|
5606
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
5607
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
|
|
5608
|
+
if (bailOnError) return {
|
|
5609
|
+
n: null,
|
|
5610
|
+
pos
|
|
5611
|
+
};
|
|
5612
|
+
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
5613
|
+
}
|
|
5614
|
+
|
|
5615
|
+
++pos;
|
|
5616
|
+
continue;
|
|
5617
|
+
}
|
|
5618
|
+
|
|
5619
|
+
if (code >= 97) {
|
|
5620
|
+
val = code - 97 + 10;
|
|
5621
|
+
} else if (code >= 65) {
|
|
5622
|
+
val = code - 65 + 10;
|
|
5623
|
+
} else if (_isDigit(code)) {
|
|
5624
|
+
val = code - 48;
|
|
5625
|
+
} else {
|
|
5626
|
+
val = Infinity;
|
|
5627
|
+
}
|
|
5628
|
+
|
|
5629
|
+
if (val >= radix) {
|
|
5630
|
+
if (val <= 9 && bailOnError) {
|
|
5631
|
+
return {
|
|
5632
|
+
n: null,
|
|
5633
|
+
pos
|
|
5634
|
+
};
|
|
5635
|
+
} else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
|
|
5636
|
+
val = 0;
|
|
5637
|
+
} else if (forceLen) {
|
|
5638
|
+
val = 0;
|
|
5639
|
+
invalid = true;
|
|
5640
|
+
} else {
|
|
5641
|
+
break;
|
|
5642
|
+
}
|
|
5643
|
+
}
|
|
5644
|
+
|
|
5645
|
+
++pos;
|
|
5646
|
+
total = total * radix + val;
|
|
5092
5647
|
}
|
|
5093
5648
|
|
|
5094
|
-
|
|
5095
|
-
return
|
|
5649
|
+
if (pos === start || len != null && pos - start !== len || invalid) {
|
|
5650
|
+
return {
|
|
5651
|
+
n: null,
|
|
5652
|
+
pos
|
|
5653
|
+
};
|
|
5096
5654
|
}
|
|
5097
5655
|
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5656
|
+
return {
|
|
5657
|
+
n: total,
|
|
5658
|
+
pos
|
|
5659
|
+
};
|
|
5660
|
+
}
|
|
5101
5661
|
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5662
|
+
function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
5663
|
+
var ch = input.charCodeAt(pos);
|
|
5664
|
+
var code;
|
|
5105
5665
|
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5666
|
+
if (ch === 123) {
|
|
5667
|
+
++pos;
|
|
5668
|
+
({
|
|
5669
|
+
code,
|
|
5670
|
+
pos
|
|
5671
|
+
} = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
5672
|
+
++pos;
|
|
5109
5673
|
|
|
5110
|
-
|
|
5674
|
+
if (code !== null && code > 0x10ffff) {
|
|
5675
|
+
if (throwOnInvalid) {
|
|
5676
|
+
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
5677
|
+
} else {
|
|
5678
|
+
return {
|
|
5679
|
+
code: null,
|
|
5680
|
+
pos
|
|
5681
|
+
};
|
|
5682
|
+
}
|
|
5111
5683
|
}
|
|
5112
|
-
|
|
5113
|
-
|
|
5684
|
+
} else {
|
|
5685
|
+
({
|
|
5686
|
+
code,
|
|
5687
|
+
pos
|
|
5688
|
+
} = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
5114
5689
|
}
|
|
5115
5690
|
|
|
5691
|
+
return {
|
|
5692
|
+
code,
|
|
5693
|
+
pos
|
|
5694
|
+
};
|
|
5116
5695
|
}
|
|
5117
5696
|
|
|
5118
5697
|
var _excluded$2 = ["at"],
|
|
5119
5698
|
_excluded2 = ["at"];
|
|
5120
5699
|
|
|
5121
|
-
|
|
5122
|
-
return
|
|
5123
|
-
}
|
|
5700
|
+
function buildPosition(pos, lineStart, curLine) {
|
|
5701
|
+
return new Position(curLine, pos - lineStart, pos);
|
|
5702
|
+
}
|
|
5124
5703
|
|
|
5125
5704
|
var VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
5126
|
-
var forbiddenNumericSeparatorSiblings = {
|
|
5127
|
-
decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
|
|
5128
|
-
hex: new Set([46, 88, 95, 120])
|
|
5129
|
-
};
|
|
5130
|
-
var isAllowedNumericSeparatorSibling = {
|
|
5131
|
-
bin: ch => ch === 48 || ch === 49,
|
|
5132
|
-
oct: ch => ch >= 48 && ch <= 55,
|
|
5133
|
-
dec: ch => ch >= 48 && ch <= 57,
|
|
5134
|
-
hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
5135
|
-
};
|
|
5136
5705
|
|
|
5137
5706
|
class Token {
|
|
5138
5707
|
constructor(state) {
|
|
@@ -5150,6 +5719,42 @@
|
|
|
5150
5719
|
super();
|
|
5151
5720
|
this.isLookahead = void 0;
|
|
5152
5721
|
this.tokens = [];
|
|
5722
|
+
this.errorHandlers_readInt = {
|
|
5723
|
+
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
5724
|
+
if (!this.options.errorRecovery) return false;
|
|
5725
|
+
this.raise(Errors.InvalidDigit, {
|
|
5726
|
+
at: buildPosition(pos, lineStart, curLine),
|
|
5727
|
+
radix
|
|
5728
|
+
});
|
|
5729
|
+
return true;
|
|
5730
|
+
},
|
|
5731
|
+
numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),
|
|
5732
|
+
unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator)
|
|
5733
|
+
};
|
|
5734
|
+
this.errorHandlers_readCodePoint = Object.assign({}, this.errorHandlers_readInt, {
|
|
5735
|
+
invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence),
|
|
5736
|
+
invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint)
|
|
5737
|
+
});
|
|
5738
|
+
this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
5739
|
+
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
5740
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
|
|
5741
|
+
at: buildPosition(pos, lineStart, curLine)
|
|
5742
|
+
});
|
|
5743
|
+
},
|
|
5744
|
+
unterminated: (pos, lineStart, curLine) => {
|
|
5745
|
+
throw this.raise(Errors.UnterminatedString, {
|
|
5746
|
+
at: buildPosition(pos - 1, lineStart, curLine)
|
|
5747
|
+
});
|
|
5748
|
+
}
|
|
5749
|
+
});
|
|
5750
|
+
this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
5751
|
+
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
5752
|
+
unterminated: (pos, lineStart, curLine) => {
|
|
5753
|
+
throw this.raise(Errors.UnterminatedTemplate, {
|
|
5754
|
+
at: buildPosition(pos, lineStart, curLine)
|
|
5755
|
+
});
|
|
5756
|
+
}
|
|
5757
|
+
});
|
|
5153
5758
|
this.state = new State();
|
|
5154
5759
|
this.state.init(options);
|
|
5155
5760
|
this.input = input;
|
|
@@ -5248,8 +5853,8 @@
|
|
|
5248
5853
|
this.state.strict = strict;
|
|
5249
5854
|
|
|
5250
5855
|
if (strict) {
|
|
5251
|
-
this.state.strictErrors.forEach(
|
|
5252
|
-
var [toParseError, at] =
|
|
5856
|
+
this.state.strictErrors.forEach(_ref42 => {
|
|
5857
|
+
var [toParseError, at] = _ref42;
|
|
5253
5858
|
return this.raise(toParseError, {
|
|
5254
5859
|
at
|
|
5255
5860
|
});
|
|
@@ -5430,7 +6035,7 @@
|
|
|
5430
6035
|
|
|
5431
6036
|
if (comments.length > 0) {
|
|
5432
6037
|
var end = this.state.pos;
|
|
5433
|
-
var
|
|
6038
|
+
var commentWhitespace = {
|
|
5434
6039
|
start: spaceStart,
|
|
5435
6040
|
end,
|
|
5436
6041
|
comments,
|
|
@@ -5438,7 +6043,7 @@
|
|
|
5438
6043
|
trailingNode: null,
|
|
5439
6044
|
containingNode: null
|
|
5440
6045
|
};
|
|
5441
|
-
this.state.commentStack.push(
|
|
6046
|
+
this.state.commentStack.push(commentWhitespace);
|
|
5442
6047
|
}
|
|
5443
6048
|
}
|
|
5444
6049
|
|
|
@@ -5476,7 +6081,7 @@
|
|
|
5476
6081
|
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
|
|
5477
6082
|
this.expectPlugin("recordAndTuple");
|
|
5478
6083
|
|
|
5479
|
-
if (this.getPluginOption("recordAndTuple", "syntaxType")
|
|
6084
|
+
if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
|
|
5480
6085
|
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, {
|
|
5481
6086
|
at: this.state.curPosition()
|
|
5482
6087
|
});
|
|
@@ -6034,70 +6639,15 @@
|
|
|
6034
6639
|
});
|
|
6035
6640
|
}
|
|
6036
6641
|
|
|
6037
|
-
readInt(radix, len
|
|
6642
|
+
readInt(radix, len) {
|
|
6643
|
+
var forceLen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6038
6644
|
var allowNumSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
6039
|
-
var
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
6046
|
-
var code = this.input.charCodeAt(this.state.pos);
|
|
6047
|
-
var val = void 0;
|
|
6048
|
-
|
|
6049
|
-
if (code === 95 && allowNumSeparator !== "bail") {
|
|
6050
|
-
var prev = this.input.charCodeAt(this.state.pos - 1);
|
|
6051
|
-
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
6052
|
-
|
|
6053
|
-
if (!allowNumSeparator) {
|
|
6054
|
-
this.raise(Errors.NumericSeparatorInEscapeSequence, {
|
|
6055
|
-
at: this.state.curPosition()
|
|
6056
|
-
});
|
|
6057
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
|
|
6058
|
-
this.raise(Errors.UnexpectedNumericSeparator, {
|
|
6059
|
-
at: this.state.curPosition()
|
|
6060
|
-
});
|
|
6061
|
-
}
|
|
6062
|
-
|
|
6063
|
-
++this.state.pos;
|
|
6064
|
-
continue;
|
|
6065
|
-
}
|
|
6066
|
-
|
|
6067
|
-
if (code >= 97) {
|
|
6068
|
-
val = code - 97 + 10;
|
|
6069
|
-
} else if (code >= 65) {
|
|
6070
|
-
val = code - 65 + 10;
|
|
6071
|
-
} else if (_isDigit(code)) {
|
|
6072
|
-
val = code - 48;
|
|
6073
|
-
} else {
|
|
6074
|
-
val = Infinity;
|
|
6075
|
-
}
|
|
6076
|
-
|
|
6077
|
-
if (val >= radix) {
|
|
6078
|
-
if (this.options.errorRecovery && val <= 9) {
|
|
6079
|
-
val = 0;
|
|
6080
|
-
this.raise(Errors.InvalidDigit, {
|
|
6081
|
-
at: this.state.curPosition(),
|
|
6082
|
-
radix
|
|
6083
|
-
});
|
|
6084
|
-
} else if (forceLen) {
|
|
6085
|
-
val = 0;
|
|
6086
|
-
invalid = true;
|
|
6087
|
-
} else {
|
|
6088
|
-
break;
|
|
6089
|
-
}
|
|
6090
|
-
}
|
|
6091
|
-
|
|
6092
|
-
++this.state.pos;
|
|
6093
|
-
total = total * radix + val;
|
|
6094
|
-
}
|
|
6095
|
-
|
|
6096
|
-
if (this.state.pos === start || len != null && this.state.pos - start !== len || invalid) {
|
|
6097
|
-
return null;
|
|
6098
|
-
}
|
|
6099
|
-
|
|
6100
|
-
return total;
|
|
6645
|
+
var {
|
|
6646
|
+
n,
|
|
6647
|
+
pos
|
|
6648
|
+
} = readInt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, radix, len, forceLen, allowNumSeparator, this.errorHandlers_readInt, false);
|
|
6649
|
+
this.state.pos = pos;
|
|
6650
|
+
return n;
|
|
6101
6651
|
}
|
|
6102
6652
|
|
|
6103
6653
|
readRadixNumber(radix) {
|
|
@@ -6249,63 +6799,25 @@
|
|
|
6249
6799
|
}
|
|
6250
6800
|
|
|
6251
6801
|
readCodePoint(throwOnInvalid) {
|
|
6252
|
-
var
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, true, throwOnInvalid);
|
|
6258
|
-
++this.state.pos;
|
|
6259
|
-
|
|
6260
|
-
if (code !== null && code > 0x10ffff) {
|
|
6261
|
-
if (throwOnInvalid) {
|
|
6262
|
-
this.raise(Errors.InvalidCodePoint, {
|
|
6263
|
-
at: this.state.curPosition()
|
|
6264
|
-
});
|
|
6265
|
-
} else {
|
|
6266
|
-
return null;
|
|
6267
|
-
}
|
|
6268
|
-
}
|
|
6269
|
-
} else {
|
|
6270
|
-
code = this.readHexChar(4, false, throwOnInvalid);
|
|
6271
|
-
}
|
|
6272
|
-
|
|
6802
|
+
var {
|
|
6803
|
+
code,
|
|
6804
|
+
pos
|
|
6805
|
+
} = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
|
|
6806
|
+
this.state.pos = pos;
|
|
6273
6807
|
return code;
|
|
6274
6808
|
}
|
|
6275
6809
|
|
|
6276
6810
|
readString(quote) {
|
|
6277
|
-
var
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
var ch = this.input.charCodeAt(this.state.pos);
|
|
6288
|
-
if (ch === quote) break;
|
|
6289
|
-
|
|
6290
|
-
if (ch === 92) {
|
|
6291
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6292
|
-
out += this.readEscapedChar(false);
|
|
6293
|
-
chunkStart = this.state.pos;
|
|
6294
|
-
} else if (ch === 8232 || ch === 8233) {
|
|
6295
|
-
++this.state.pos;
|
|
6296
|
-
++this.state.curLine;
|
|
6297
|
-
this.state.lineStart = this.state.pos;
|
|
6298
|
-
} else if (isNewLine(ch)) {
|
|
6299
|
-
throw this.raise(Errors.UnterminatedString, {
|
|
6300
|
-
at: this.state.startLoc
|
|
6301
|
-
});
|
|
6302
|
-
} else {
|
|
6303
|
-
++this.state.pos;
|
|
6304
|
-
}
|
|
6305
|
-
}
|
|
6306
|
-
|
|
6307
|
-
out += this.input.slice(chunkStart, this.state.pos++);
|
|
6308
|
-
this.finishToken(129, out);
|
|
6811
|
+
var {
|
|
6812
|
+
str,
|
|
6813
|
+
pos,
|
|
6814
|
+
curLine,
|
|
6815
|
+
lineStart
|
|
6816
|
+
} = readStringContents(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
6817
|
+
this.state.pos = pos + 1;
|
|
6818
|
+
this.state.lineStart = lineStart;
|
|
6819
|
+
this.state.curLine = curLine;
|
|
6820
|
+
this.finishToken(129, str);
|
|
6309
6821
|
}
|
|
6310
6822
|
|
|
6311
6823
|
readTemplateContinuation() {
|
|
@@ -6318,195 +6830,43 @@
|
|
|
6318
6830
|
}
|
|
6319
6831
|
|
|
6320
6832
|
readTemplateToken() {
|
|
6321
|
-
var
|
|
6322
|
-
chunkStart = this.state.pos,
|
|
6323
|
-
containsInvalid = false;
|
|
6324
|
-
++this.state.pos;
|
|
6325
|
-
|
|
6326
|
-
for (;;) {
|
|
6327
|
-
if (this.state.pos >= this.length) {
|
|
6328
|
-
throw this.raise(Errors.UnterminatedTemplate, {
|
|
6329
|
-
at: createPositionWithColumnOffset(this.state.startLoc, 1)
|
|
6330
|
-
});
|
|
6331
|
-
}
|
|
6332
|
-
|
|
6333
|
-
var ch = this.input.charCodeAt(this.state.pos);
|
|
6334
|
-
|
|
6335
|
-
if (ch === 96) {
|
|
6336
|
-
++this.state.pos;
|
|
6337
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6338
|
-
this.finishToken(24, containsInvalid ? null : out);
|
|
6339
|
-
return;
|
|
6340
|
-
}
|
|
6341
|
-
|
|
6342
|
-
if (ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
|
|
6343
|
-
this.state.pos += 2;
|
|
6344
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6345
|
-
this.finishToken(25, containsInvalid ? null : out);
|
|
6346
|
-
return;
|
|
6347
|
-
}
|
|
6348
|
-
|
|
6349
|
-
if (ch === 92) {
|
|
6350
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6351
|
-
var escaped = this.readEscapedChar(true);
|
|
6352
|
-
|
|
6353
|
-
if (escaped === null) {
|
|
6354
|
-
containsInvalid = true;
|
|
6355
|
-
} else {
|
|
6356
|
-
out += escaped;
|
|
6357
|
-
}
|
|
6358
|
-
|
|
6359
|
-
chunkStart = this.state.pos;
|
|
6360
|
-
} else if (isNewLine(ch)) {
|
|
6361
|
-
out += this.input.slice(chunkStart, this.state.pos);
|
|
6362
|
-
++this.state.pos;
|
|
6363
|
-
|
|
6364
|
-
switch (ch) {
|
|
6365
|
-
case 13:
|
|
6366
|
-
if (this.input.charCodeAt(this.state.pos) === 10) {
|
|
6367
|
-
++this.state.pos;
|
|
6368
|
-
}
|
|
6369
|
-
|
|
6370
|
-
case 10:
|
|
6371
|
-
out += "\n";
|
|
6372
|
-
break;
|
|
6373
|
-
|
|
6374
|
-
default:
|
|
6375
|
-
out += String.fromCharCode(ch);
|
|
6376
|
-
break;
|
|
6377
|
-
}
|
|
6378
|
-
|
|
6379
|
-
++this.state.curLine;
|
|
6380
|
-
this.state.lineStart = this.state.pos;
|
|
6381
|
-
chunkStart = this.state.pos;
|
|
6382
|
-
} else {
|
|
6383
|
-
++this.state.pos;
|
|
6384
|
-
}
|
|
6385
|
-
}
|
|
6386
|
-
}
|
|
6387
|
-
|
|
6388
|
-
recordStrictModeErrors(toParseError, _ref42) {
|
|
6833
|
+
var opening = this.input[this.state.pos];
|
|
6389
6834
|
var {
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
case 110:
|
|
6410
|
-
return "\n";
|
|
6411
|
-
|
|
6412
|
-
case 114:
|
|
6413
|
-
return "\r";
|
|
6414
|
-
|
|
6415
|
-
case 120:
|
|
6416
|
-
{
|
|
6417
|
-
var code = this.readHexChar(2, false, throwOnInvalid);
|
|
6418
|
-
return code === null ? null : String.fromCharCode(code);
|
|
6419
|
-
}
|
|
6420
|
-
|
|
6421
|
-
case 117:
|
|
6422
|
-
{
|
|
6423
|
-
var _code = this.readCodePoint(throwOnInvalid);
|
|
6424
|
-
|
|
6425
|
-
return _code === null ? null : String.fromCodePoint(_code);
|
|
6426
|
-
}
|
|
6427
|
-
|
|
6428
|
-
case 116:
|
|
6429
|
-
return "\t";
|
|
6430
|
-
|
|
6431
|
-
case 98:
|
|
6432
|
-
return "\b";
|
|
6433
|
-
|
|
6434
|
-
case 118:
|
|
6435
|
-
return "\u000b";
|
|
6436
|
-
|
|
6437
|
-
case 102:
|
|
6438
|
-
return "\f";
|
|
6439
|
-
|
|
6440
|
-
case 13:
|
|
6441
|
-
if (this.input.charCodeAt(this.state.pos) === 10) {
|
|
6442
|
-
++this.state.pos;
|
|
6443
|
-
}
|
|
6444
|
-
|
|
6445
|
-
case 10:
|
|
6446
|
-
this.state.lineStart = this.state.pos;
|
|
6447
|
-
++this.state.curLine;
|
|
6448
|
-
|
|
6449
|
-
case 8232:
|
|
6450
|
-
case 8233:
|
|
6451
|
-
return "";
|
|
6452
|
-
|
|
6453
|
-
case 56:
|
|
6454
|
-
case 57:
|
|
6455
|
-
if (inTemplate) {
|
|
6456
|
-
return null;
|
|
6457
|
-
} else {
|
|
6458
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
|
|
6459
|
-
at: createPositionWithColumnOffset(this.state.curPosition(), -1)
|
|
6460
|
-
});
|
|
6461
|
-
}
|
|
6462
|
-
|
|
6463
|
-
default:
|
|
6464
|
-
if (ch >= 48 && ch <= 55) {
|
|
6465
|
-
var codePos = createPositionWithColumnOffset(this.state.curPosition(), -1);
|
|
6466
|
-
var match = this.input.slice(this.state.pos - 1, this.state.pos + 2).match(/^[0-7]+/);
|
|
6467
|
-
var octalStr = match[0];
|
|
6468
|
-
var octal = parseInt(octalStr, 8);
|
|
6469
|
-
|
|
6470
|
-
if (octal > 255) {
|
|
6471
|
-
octalStr = octalStr.slice(0, -1);
|
|
6472
|
-
octal = parseInt(octalStr, 8);
|
|
6473
|
-
}
|
|
6474
|
-
|
|
6475
|
-
this.state.pos += octalStr.length - 1;
|
|
6476
|
-
var next = this.input.charCodeAt(this.state.pos);
|
|
6477
|
-
|
|
6478
|
-
if (octalStr !== "0" || next === 56 || next === 57) {
|
|
6479
|
-
if (inTemplate) {
|
|
6480
|
-
return null;
|
|
6481
|
-
} else {
|
|
6482
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape, {
|
|
6483
|
-
at: codePos
|
|
6484
|
-
});
|
|
6485
|
-
}
|
|
6486
|
-
}
|
|
6487
|
-
|
|
6488
|
-
return String.fromCharCode(octal);
|
|
6489
|
-
}
|
|
6490
|
-
|
|
6491
|
-
return String.fromCharCode(ch);
|
|
6835
|
+
str,
|
|
6836
|
+
firstInvalidLoc,
|
|
6837
|
+
pos,
|
|
6838
|
+
curLine,
|
|
6839
|
+
lineStart
|
|
6840
|
+
} = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
6841
|
+
this.state.pos = pos + 1;
|
|
6842
|
+
this.state.lineStart = lineStart;
|
|
6843
|
+
this.state.curLine = curLine;
|
|
6844
|
+
|
|
6845
|
+
if (firstInvalidLoc) {
|
|
6846
|
+
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
|
|
6847
|
+
}
|
|
6848
|
+
|
|
6849
|
+
if (this.input.codePointAt(pos) === 96) {
|
|
6850
|
+
this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
|
|
6851
|
+
} else {
|
|
6852
|
+
this.state.pos++;
|
|
6853
|
+
this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
|
|
6492
6854
|
}
|
|
6493
6855
|
}
|
|
6494
6856
|
|
|
6495
|
-
|
|
6496
|
-
var
|
|
6497
|
-
|
|
6857
|
+
recordStrictModeErrors(toParseError, _ref43) {
|
|
6858
|
+
var {
|
|
6859
|
+
at
|
|
6860
|
+
} = _ref43;
|
|
6861
|
+
var index = at.index;
|
|
6498
6862
|
|
|
6499
|
-
if (
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
this.state.pos = codeLoc.index - 1;
|
|
6506
|
-
}
|
|
6863
|
+
if (this.state.strict && !this.state.strictErrors.has(index)) {
|
|
6864
|
+
this.raise(toParseError, {
|
|
6865
|
+
at
|
|
6866
|
+
});
|
|
6867
|
+
} else {
|
|
6868
|
+
this.state.strictErrors.set(index, [toParseError, at]);
|
|
6507
6869
|
}
|
|
6508
|
-
|
|
6509
|
-
return n;
|
|
6510
6870
|
}
|
|
6511
6871
|
|
|
6512
6872
|
readWord1(firstCode) {
|
|
@@ -6655,229 +7015,12 @@
|
|
|
6655
7015
|
}
|
|
6656
7016
|
}
|
|
6657
7017
|
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
this.var = new Set();
|
|
6663
|
-
this.lexical = new Set();
|
|
6664
|
-
this.functions = new Set();
|
|
6665
|
-
this.flags = flags;
|
|
6666
|
-
}
|
|
6667
|
-
|
|
6668
|
-
}
|
|
6669
|
-
|
|
6670
|
-
class ScopeHandler {
|
|
6671
|
-
constructor(parser, inModule) {
|
|
6672
|
-
this.parser = void 0;
|
|
6673
|
-
this.scopeStack = [];
|
|
6674
|
-
this.inModule = void 0;
|
|
6675
|
-
this.undefinedExports = new Map();
|
|
6676
|
-
this.parser = parser;
|
|
6677
|
-
this.inModule = inModule;
|
|
6678
|
-
}
|
|
6679
|
-
|
|
6680
|
-
get inFunction() {
|
|
6681
|
-
return (this.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
6682
|
-
}
|
|
6683
|
-
|
|
6684
|
-
get allowSuper() {
|
|
6685
|
-
return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;
|
|
6686
|
-
}
|
|
6687
|
-
|
|
6688
|
-
get allowDirectSuper() {
|
|
6689
|
-
return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;
|
|
6690
|
-
}
|
|
6691
|
-
|
|
6692
|
-
get inClass() {
|
|
6693
|
-
return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;
|
|
6694
|
-
}
|
|
6695
|
-
|
|
6696
|
-
get inClassAndNotInNonArrowFunction() {
|
|
6697
|
-
var flags = this.currentThisScopeFlags();
|
|
6698
|
-
return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
|
|
6699
|
-
}
|
|
6700
|
-
|
|
6701
|
-
get inStaticBlock() {
|
|
6702
|
-
for (var i = this.scopeStack.length - 1;; i--) {
|
|
6703
|
-
var {
|
|
6704
|
-
flags
|
|
6705
|
-
} = this.scopeStack[i];
|
|
6706
|
-
|
|
6707
|
-
if (flags & SCOPE_STATIC_BLOCK) {
|
|
6708
|
-
return true;
|
|
6709
|
-
}
|
|
6710
|
-
|
|
6711
|
-
if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
|
|
6712
|
-
return false;
|
|
6713
|
-
}
|
|
6714
|
-
}
|
|
6715
|
-
}
|
|
6716
|
-
|
|
6717
|
-
get inNonArrowFunction() {
|
|
6718
|
-
return (this.currentThisScopeFlags() & SCOPE_FUNCTION) > 0;
|
|
6719
|
-
}
|
|
6720
|
-
|
|
6721
|
-
get treatFunctionsAsVar() {
|
|
6722
|
-
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
6723
|
-
}
|
|
6724
|
-
|
|
6725
|
-
createScope(flags) {
|
|
6726
|
-
return new Scope(flags);
|
|
6727
|
-
}
|
|
6728
|
-
|
|
6729
|
-
enter(flags) {
|
|
6730
|
-
this.scopeStack.push(this.createScope(flags));
|
|
6731
|
-
}
|
|
6732
|
-
|
|
6733
|
-
exit() {
|
|
6734
|
-
this.scopeStack.pop();
|
|
6735
|
-
}
|
|
6736
|
-
|
|
6737
|
-
treatFunctionsAsVarInScope(scope) {
|
|
6738
|
-
return !!(scope.flags & (SCOPE_FUNCTION | SCOPE_STATIC_BLOCK) || !this.parser.inModule && scope.flags & SCOPE_PROGRAM);
|
|
6739
|
-
}
|
|
6740
|
-
|
|
6741
|
-
declareName(name, bindingType, loc) {
|
|
6742
|
-
var scope = this.currentScope();
|
|
6743
|
-
|
|
6744
|
-
if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {
|
|
6745
|
-
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
6746
|
-
|
|
6747
|
-
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
6748
|
-
scope.functions.add(name);
|
|
6749
|
-
} else {
|
|
6750
|
-
scope.lexical.add(name);
|
|
6751
|
-
}
|
|
6752
|
-
|
|
6753
|
-
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
6754
|
-
this.maybeExportDefined(scope, name);
|
|
6755
|
-
}
|
|
6756
|
-
} else if (bindingType & BIND_SCOPE_VAR) {
|
|
6757
|
-
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
6758
|
-
scope = this.scopeStack[i];
|
|
6759
|
-
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
6760
|
-
scope.var.add(name);
|
|
6761
|
-
this.maybeExportDefined(scope, name);
|
|
6762
|
-
if (scope.flags & SCOPE_VAR) break;
|
|
6763
|
-
}
|
|
6764
|
-
}
|
|
6765
|
-
|
|
6766
|
-
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
6767
|
-
this.undefinedExports.delete(name);
|
|
6768
|
-
}
|
|
6769
|
-
}
|
|
6770
|
-
|
|
6771
|
-
maybeExportDefined(scope, name) {
|
|
6772
|
-
if (this.parser.inModule && scope.flags & SCOPE_PROGRAM) {
|
|
6773
|
-
this.undefinedExports.delete(name);
|
|
6774
|
-
}
|
|
6775
|
-
}
|
|
6776
|
-
|
|
6777
|
-
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
6778
|
-
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
6779
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
6780
|
-
at: loc,
|
|
6781
|
-
identifierName: name
|
|
7018
|
+
errorBuilder(error) {
|
|
7019
|
+
return (pos, lineStart, curLine) => {
|
|
7020
|
+
this.raise(error, {
|
|
7021
|
+
at: buildPosition(pos, lineStart, curLine)
|
|
6782
7022
|
});
|
|
6783
|
-
}
|
|
6784
|
-
}
|
|
6785
|
-
|
|
6786
|
-
isRedeclaredInScope(scope, name, bindingType) {
|
|
6787
|
-
if (!(bindingType & BIND_KIND_VALUE)) return false;
|
|
6788
|
-
|
|
6789
|
-
if (bindingType & BIND_SCOPE_LEXICAL) {
|
|
6790
|
-
return scope.lexical.has(name) || scope.functions.has(name) || scope.var.has(name);
|
|
6791
|
-
}
|
|
6792
|
-
|
|
6793
|
-
if (bindingType & BIND_SCOPE_FUNCTION) {
|
|
6794
|
-
return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
|
|
6795
|
-
}
|
|
6796
|
-
|
|
6797
|
-
return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
|
|
6798
|
-
}
|
|
6799
|
-
|
|
6800
|
-
checkLocalExport(id) {
|
|
6801
|
-
var {
|
|
6802
|
-
name
|
|
6803
|
-
} = id;
|
|
6804
|
-
var topLevelScope = this.scopeStack[0];
|
|
6805
|
-
|
|
6806
|
-
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
|
|
6807
|
-
this.undefinedExports.set(name, id.loc.start);
|
|
6808
|
-
}
|
|
6809
|
-
}
|
|
6810
|
-
|
|
6811
|
-
currentScope() {
|
|
6812
|
-
return this.scopeStack[this.scopeStack.length - 1];
|
|
6813
|
-
}
|
|
6814
|
-
|
|
6815
|
-
currentVarScopeFlags() {
|
|
6816
|
-
for (var i = this.scopeStack.length - 1;; i--) {
|
|
6817
|
-
var {
|
|
6818
|
-
flags
|
|
6819
|
-
} = this.scopeStack[i];
|
|
6820
|
-
|
|
6821
|
-
if (flags & SCOPE_VAR) {
|
|
6822
|
-
return flags;
|
|
6823
|
-
}
|
|
6824
|
-
}
|
|
6825
|
-
}
|
|
6826
|
-
|
|
6827
|
-
currentThisScopeFlags() {
|
|
6828
|
-
for (var i = this.scopeStack.length - 1;; i--) {
|
|
6829
|
-
var {
|
|
6830
|
-
flags
|
|
6831
|
-
} = this.scopeStack[i];
|
|
6832
|
-
|
|
6833
|
-
if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {
|
|
6834
|
-
return flags;
|
|
6835
|
-
}
|
|
6836
|
-
}
|
|
6837
|
-
}
|
|
6838
|
-
|
|
6839
|
-
}
|
|
6840
|
-
|
|
6841
|
-
class FlowScope extends Scope {
|
|
6842
|
-
constructor() {
|
|
6843
|
-
super(...arguments);
|
|
6844
|
-
this.declareFunctions = new Set();
|
|
6845
|
-
}
|
|
6846
|
-
|
|
6847
|
-
}
|
|
6848
|
-
|
|
6849
|
-
class FlowScopeHandler extends ScopeHandler {
|
|
6850
|
-
createScope(flags) {
|
|
6851
|
-
return new FlowScope(flags);
|
|
6852
|
-
}
|
|
6853
|
-
|
|
6854
|
-
declareName(name, bindingType, loc) {
|
|
6855
|
-
var scope = this.currentScope();
|
|
6856
|
-
|
|
6857
|
-
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
6858
|
-
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
6859
|
-
this.maybeExportDefined(scope, name);
|
|
6860
|
-
scope.declareFunctions.add(name);
|
|
6861
|
-
return;
|
|
6862
|
-
}
|
|
6863
|
-
|
|
6864
|
-
super.declareName(...arguments);
|
|
6865
|
-
}
|
|
6866
|
-
|
|
6867
|
-
isRedeclaredInScope(scope, name, bindingType) {
|
|
6868
|
-
if (super.isRedeclaredInScope(...arguments)) return true;
|
|
6869
|
-
|
|
6870
|
-
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
|
|
6871
|
-
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
|
|
6872
|
-
}
|
|
6873
|
-
|
|
6874
|
-
return false;
|
|
6875
|
-
}
|
|
6876
|
-
|
|
6877
|
-
checkLocalExport(id) {
|
|
6878
|
-
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
|
|
6879
|
-
super.checkLocalExport(id);
|
|
6880
|
-
}
|
|
7023
|
+
};
|
|
6881
7024
|
}
|
|
6882
7025
|
|
|
6883
7026
|
}
|
|
@@ -7006,10 +7149,10 @@
|
|
|
7006
7149
|
this.declarationErrors = new Map();
|
|
7007
7150
|
}
|
|
7008
7151
|
|
|
7009
|
-
recordDeclarationError(ParsingErrorClass,
|
|
7152
|
+
recordDeclarationError(ParsingErrorClass, _ref44) {
|
|
7010
7153
|
var {
|
|
7011
7154
|
at
|
|
7012
|
-
} =
|
|
7155
|
+
} = _ref44;
|
|
7013
7156
|
var index = at.index;
|
|
7014
7157
|
this.declarationErrors.set(index, [ParsingErrorClass, at]);
|
|
7015
7158
|
}
|
|
@@ -7039,10 +7182,10 @@
|
|
|
7039
7182
|
this.stack.pop();
|
|
7040
7183
|
}
|
|
7041
7184
|
|
|
7042
|
-
recordParameterInitializerError(toParseError,
|
|
7185
|
+
recordParameterInitializerError(toParseError, _ref45) {
|
|
7043
7186
|
var {
|
|
7044
7187
|
at: node
|
|
7045
|
-
} =
|
|
7188
|
+
} = _ref45;
|
|
7046
7189
|
var origin = {
|
|
7047
7190
|
at: node.loc.start
|
|
7048
7191
|
};
|
|
@@ -7065,10 +7208,10 @@
|
|
|
7065
7208
|
this.parser.raise(toParseError, origin);
|
|
7066
7209
|
}
|
|
7067
7210
|
|
|
7068
|
-
recordArrowParemeterBindingError(error,
|
|
7211
|
+
recordArrowParemeterBindingError(error, _ref46) {
|
|
7069
7212
|
var {
|
|
7070
7213
|
at: node
|
|
7071
|
-
} =
|
|
7214
|
+
} = _ref46;
|
|
7072
7215
|
var {
|
|
7073
7216
|
stack
|
|
7074
7217
|
} = this;
|
|
@@ -7086,10 +7229,10 @@
|
|
|
7086
7229
|
}
|
|
7087
7230
|
}
|
|
7088
7231
|
|
|
7089
|
-
recordAsyncArrowParametersError(
|
|
7232
|
+
recordAsyncArrowParametersError(_ref47) {
|
|
7090
7233
|
var {
|
|
7091
7234
|
at
|
|
7092
|
-
} =
|
|
7235
|
+
} = _ref47;
|
|
7093
7236
|
var {
|
|
7094
7237
|
stack
|
|
7095
7238
|
} = this;
|
|
@@ -7113,8 +7256,8 @@
|
|
|
7113
7256
|
} = this;
|
|
7114
7257
|
var currentScope = stack[stack.length - 1];
|
|
7115
7258
|
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
7116
|
-
currentScope.iterateErrors(
|
|
7117
|
-
var [toParseError, loc] =
|
|
7259
|
+
currentScope.iterateErrors(_ref48 => {
|
|
7260
|
+
var [toParseError, loc] = _ref48;
|
|
7118
7261
|
this.parser.raise(toParseError, {
|
|
7119
7262
|
at: loc
|
|
7120
7263
|
});
|
|
@@ -7479,7 +7622,7 @@
|
|
|
7479
7622
|
var NodePrototype = Node.prototype;
|
|
7480
7623
|
{
|
|
7481
7624
|
NodePrototype.__clone = function () {
|
|
7482
|
-
var newNode = new Node();
|
|
7625
|
+
var newNode = new Node(undefined, this.start, this.loc.start);
|
|
7483
7626
|
var keys = Object.keys(this);
|
|
7484
7627
|
|
|
7485
7628
|
for (var i = 0, length = keys.length; i < length; i++) {
|
|
@@ -7601,138 +7744,140 @@
|
|
|
7601
7744
|
}
|
|
7602
7745
|
|
|
7603
7746
|
var reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
|
|
7604
|
-
var FlowErrors = ParseErrorEnum(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["flow"])))(
|
|
7605
|
-
AmbiguousConditionalArrow:
|
|
7606
|
-
AmbiguousDeclareModuleKind:
|
|
7607
|
-
AssignReservedType:
|
|
7747
|
+
var FlowErrors = ParseErrorEnum(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["flow"])))({
|
|
7748
|
+
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
7749
|
+
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.",
|
|
7750
|
+
AssignReservedType: _ref49 => {
|
|
7608
7751
|
var {
|
|
7609
7752
|
reservedType
|
|
7610
|
-
} =
|
|
7753
|
+
} = _ref49;
|
|
7611
7754
|
return "Cannot overwrite reserved type ".concat(reservedType, ".");
|
|
7612
|
-
}
|
|
7613
|
-
DeclareClassElement:
|
|
7614
|
-
DeclareClassFieldInitializer:
|
|
7615
|
-
DuplicateDeclareModuleExports:
|
|
7616
|
-
EnumBooleanMemberNotInitialized:
|
|
7755
|
+
},
|
|
7756
|
+
DeclareClassElement: "The `declare` modifier can only appear on class fields.",
|
|
7757
|
+
DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
|
|
7758
|
+
DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
|
|
7759
|
+
EnumBooleanMemberNotInitialized: _ref50 => {
|
|
7617
7760
|
var {
|
|
7618
7761
|
memberName,
|
|
7619
7762
|
enumName
|
|
7620
|
-
} =
|
|
7763
|
+
} = _ref50;
|
|
7621
7764
|
return "Boolean enum members need to be initialized. Use either `".concat(memberName, " = true,` or `").concat(memberName, " = false,` in enum `").concat(enumName, "`.");
|
|
7622
|
-
}
|
|
7623
|
-
EnumDuplicateMemberName:
|
|
7765
|
+
},
|
|
7766
|
+
EnumDuplicateMemberName: _ref51 => {
|
|
7624
7767
|
var {
|
|
7625
7768
|
memberName,
|
|
7626
7769
|
enumName
|
|
7627
|
-
} =
|
|
7770
|
+
} = _ref51;
|
|
7628
7771
|
return "Enum member names need to be unique, but the name `".concat(memberName, "` has already been used before in enum `").concat(enumName, "`.");
|
|
7629
|
-
}
|
|
7630
|
-
EnumInconsistentMemberValues:
|
|
7772
|
+
},
|
|
7773
|
+
EnumInconsistentMemberValues: _ref52 => {
|
|
7631
7774
|
var {
|
|
7632
7775
|
enumName
|
|
7633
|
-
} =
|
|
7776
|
+
} = _ref52;
|
|
7634
7777
|
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.");
|
|
7635
|
-
}
|
|
7636
|
-
EnumInvalidExplicitType:
|
|
7778
|
+
},
|
|
7779
|
+
EnumInvalidExplicitType: _ref53 => {
|
|
7637
7780
|
var {
|
|
7638
7781
|
invalidEnumType,
|
|
7639
7782
|
enumName
|
|
7640
|
-
} =
|
|
7783
|
+
} = _ref53;
|
|
7641
7784
|
return "Enum type `".concat(invalidEnumType, "` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `").concat(enumName, "`.");
|
|
7642
|
-
}
|
|
7643
|
-
EnumInvalidExplicitTypeUnknownSupplied:
|
|
7785
|
+
},
|
|
7786
|
+
EnumInvalidExplicitTypeUnknownSupplied: _ref54 => {
|
|
7644
7787
|
var {
|
|
7645
7788
|
enumName
|
|
7646
|
-
} =
|
|
7789
|
+
} = _ref54;
|
|
7647
7790
|
return "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `".concat(enumName, "`.");
|
|
7648
|
-
}
|
|
7649
|
-
EnumInvalidMemberInitializerPrimaryType:
|
|
7791
|
+
},
|
|
7792
|
+
EnumInvalidMemberInitializerPrimaryType: _ref55 => {
|
|
7650
7793
|
var {
|
|
7651
7794
|
enumName,
|
|
7652
7795
|
memberName,
|
|
7653
7796
|
explicitType
|
|
7654
|
-
} =
|
|
7797
|
+
} = _ref55;
|
|
7655
7798
|
return "Enum `".concat(enumName, "` has type `").concat(explicitType, "`, so the initializer of `").concat(memberName, "` needs to be a ").concat(explicitType, " literal.");
|
|
7656
|
-
}
|
|
7657
|
-
EnumInvalidMemberInitializerSymbolType:
|
|
7799
|
+
},
|
|
7800
|
+
EnumInvalidMemberInitializerSymbolType: _ref56 => {
|
|
7658
7801
|
var {
|
|
7659
7802
|
enumName,
|
|
7660
7803
|
memberName
|
|
7661
|
-
} =
|
|
7804
|
+
} = _ref56;
|
|
7662
7805
|
return "Symbol enum members cannot be initialized. Use `".concat(memberName, ",` in enum `").concat(enumName, "`.");
|
|
7663
|
-
}
|
|
7664
|
-
EnumInvalidMemberInitializerUnknownType:
|
|
7806
|
+
},
|
|
7807
|
+
EnumInvalidMemberInitializerUnknownType: _ref57 => {
|
|
7665
7808
|
var {
|
|
7666
7809
|
enumName,
|
|
7667
7810
|
memberName
|
|
7668
|
-
} =
|
|
7811
|
+
} = _ref57;
|
|
7669
7812
|
return "The enum member initializer for `".concat(memberName, "` needs to be a literal (either a boolean, number, or string) in enum `").concat(enumName, "`.");
|
|
7670
|
-
}
|
|
7671
|
-
EnumInvalidMemberName:
|
|
7813
|
+
},
|
|
7814
|
+
EnumInvalidMemberName: _ref58 => {
|
|
7672
7815
|
var {
|
|
7673
7816
|
enumName,
|
|
7674
7817
|
memberName,
|
|
7675
7818
|
suggestion
|
|
7676
|
-
} =
|
|
7819
|
+
} = _ref58;
|
|
7677
7820
|
return "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `".concat(memberName, "`, consider using `").concat(suggestion, "`, in enum `").concat(enumName, "`.");
|
|
7678
|
-
}
|
|
7679
|
-
EnumNumberMemberNotInitialized:
|
|
7821
|
+
},
|
|
7822
|
+
EnumNumberMemberNotInitialized: _ref59 => {
|
|
7680
7823
|
var {
|
|
7681
7824
|
enumName,
|
|
7682
7825
|
memberName
|
|
7683
|
-
} =
|
|
7826
|
+
} = _ref59;
|
|
7684
7827
|
return "Number enum members need to be initialized, e.g. `".concat(memberName, " = 1` in enum `").concat(enumName, "`.");
|
|
7685
|
-
}
|
|
7686
|
-
EnumStringMemberInconsistentlyInitailized:
|
|
7828
|
+
},
|
|
7829
|
+
EnumStringMemberInconsistentlyInitailized: _ref60 => {
|
|
7687
7830
|
var {
|
|
7688
7831
|
enumName
|
|
7689
|
-
} =
|
|
7832
|
+
} = _ref60;
|
|
7690
7833
|
return "String enum members need to consistently either all use initializers, or use no initializers, in enum `".concat(enumName, "`.");
|
|
7691
|
-
}
|
|
7692
|
-
GetterMayNotHaveThisParam:
|
|
7693
|
-
ImportTypeShorthandOnlyInPureImport:
|
|
7694
|
-
InexactInsideExact:
|
|
7695
|
-
InexactInsideNonObject:
|
|
7696
|
-
InexactVariance:
|
|
7697
|
-
InvalidNonTypeImportInDeclareModule:
|
|
7698
|
-
MissingTypeParamDefault:
|
|
7699
|
-
NestedDeclareModule:
|
|
7700
|
-
NestedFlowComment:
|
|
7701
|
-
PatternIsOptional:
|
|
7834
|
+
},
|
|
7835
|
+
GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
|
|
7836
|
+
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.",
|
|
7837
|
+
InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
|
|
7838
|
+
InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
|
|
7839
|
+
InexactVariance: "Explicit inexact syntax cannot have variance.",
|
|
7840
|
+
InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
|
|
7841
|
+
MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
|
|
7842
|
+
NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
|
|
7843
|
+
NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
|
|
7844
|
+
PatternIsOptional: Object.assign({
|
|
7845
|
+
message: "A binding pattern parameter cannot be optional in an implementation signature."
|
|
7846
|
+
}, {
|
|
7702
7847
|
reasonCode: "OptionalBindingPattern"
|
|
7703
7848
|
}),
|
|
7704
|
-
SetterMayNotHaveThisParam:
|
|
7705
|
-
SpreadVariance:
|
|
7706
|
-
ThisParamAnnotationRequired:
|
|
7707
|
-
ThisParamBannedInConstructor:
|
|
7708
|
-
ThisParamMayNotBeOptional:
|
|
7709
|
-
ThisParamMustBeFirst:
|
|
7710
|
-
ThisParamNoDefault:
|
|
7711
|
-
TypeBeforeInitializer:
|
|
7712
|
-
TypeCastInPattern:
|
|
7713
|
-
UnexpectedExplicitInexactInObject:
|
|
7714
|
-
UnexpectedReservedType:
|
|
7849
|
+
SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
|
|
7850
|
+
SpreadVariance: "Spread properties cannot have variance.",
|
|
7851
|
+
ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
|
|
7852
|
+
ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
|
|
7853
|
+
ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
|
|
7854
|
+
ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
|
|
7855
|
+
ThisParamNoDefault: "The `this` parameter may not have a default value.",
|
|
7856
|
+
TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
7857
|
+
TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
|
|
7858
|
+
UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
|
|
7859
|
+
UnexpectedReservedType: _ref61 => {
|
|
7715
7860
|
var {
|
|
7716
7861
|
reservedType
|
|
7717
|
-
} =
|
|
7862
|
+
} = _ref61;
|
|
7718
7863
|
return "Unexpected reserved type ".concat(reservedType, ".");
|
|
7719
|
-
}
|
|
7720
|
-
UnexpectedReservedUnderscore:
|
|
7721
|
-
UnexpectedSpaceBetweenModuloChecks:
|
|
7722
|
-
UnexpectedSpreadType:
|
|
7723
|
-
UnexpectedSubtractionOperand:
|
|
7724
|
-
UnexpectedTokenAfterTypeParameter:
|
|
7725
|
-
UnexpectedTypeParameterBeforeAsyncArrowFunction:
|
|
7726
|
-
UnsupportedDeclareExportKind:
|
|
7864
|
+
},
|
|
7865
|
+
UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
|
|
7866
|
+
UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
|
|
7867
|
+
UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
|
|
7868
|
+
UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".',
|
|
7869
|
+
UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
|
|
7870
|
+
UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
|
|
7871
|
+
UnsupportedDeclareExportKind: _ref62 => {
|
|
7727
7872
|
var {
|
|
7728
7873
|
unsupportedExportKind,
|
|
7729
7874
|
suggestion
|
|
7730
|
-
} =
|
|
7875
|
+
} = _ref62;
|
|
7731
7876
|
return "`declare export ".concat(unsupportedExportKind, "` is not supported. Use `").concat(suggestion, "` instead.");
|
|
7732
|
-
}
|
|
7733
|
-
UnsupportedStatementInDeclareModule:
|
|
7734
|
-
UnterminatedFlowComment:
|
|
7735
|
-
})
|
|
7877
|
+
},
|
|
7878
|
+
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
|
|
7879
|
+
UnterminatedFlowComment: "Unterminated flow-comment."
|
|
7880
|
+
});
|
|
7736
7881
|
|
|
7737
7882
|
function isEsModuleType(bodyElement) {
|
|
7738
7883
|
return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
|
|
@@ -7766,7 +7911,7 @@
|
|
|
7766
7911
|
|
|
7767
7912
|
var FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
|
|
7768
7913
|
|
|
7769
|
-
var flow = superClass => class extends superClass {
|
|
7914
|
+
var flow = superClass => class FlowParserMixin extends superClass {
|
|
7770
7915
|
constructor() {
|
|
7771
7916
|
super(...arguments);
|
|
7772
7917
|
this.flowPragma = undefined;
|
|
@@ -7831,7 +7976,7 @@
|
|
|
7831
7976
|
}
|
|
7832
7977
|
|
|
7833
7978
|
if (this.eat(10)) {
|
|
7834
|
-
node.value =
|
|
7979
|
+
node.value = super.parseExpression();
|
|
7835
7980
|
this.expect(11);
|
|
7836
7981
|
return this.finishNode(node, "DeclaredPredicate");
|
|
7837
7982
|
} else {
|
|
@@ -7938,7 +8083,7 @@
|
|
|
7938
8083
|
this.scope.enter(SCOPE_OTHER);
|
|
7939
8084
|
|
|
7940
8085
|
if (this.match(129)) {
|
|
7941
|
-
node.id =
|
|
8086
|
+
node.id = super.parseExprAtom();
|
|
7942
8087
|
} else {
|
|
7943
8088
|
node.id = this.parseIdentifier();
|
|
7944
8089
|
}
|
|
@@ -7959,7 +8104,7 @@
|
|
|
7959
8104
|
});
|
|
7960
8105
|
}
|
|
7961
8106
|
|
|
7962
|
-
|
|
8107
|
+
super.parseImport(_bodyNode);
|
|
7963
8108
|
} else {
|
|
7964
8109
|
this.expectContextual(121, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
7965
8110
|
_bodyNode = this.flowParseDeclare(_bodyNode, true);
|
|
@@ -8057,16 +8202,16 @@
|
|
|
8057
8202
|
|
|
8058
8203
|
flowParseDeclareTypeAlias(node) {
|
|
8059
8204
|
this.next();
|
|
8060
|
-
this.flowParseTypeAlias(node);
|
|
8061
|
-
|
|
8062
|
-
return
|
|
8205
|
+
var finished = this.flowParseTypeAlias(node);
|
|
8206
|
+
finished.type = "DeclareTypeAlias";
|
|
8207
|
+
return finished;
|
|
8063
8208
|
}
|
|
8064
8209
|
|
|
8065
8210
|
flowParseDeclareOpaqueType(node) {
|
|
8066
8211
|
this.next();
|
|
8067
|
-
this.flowParseOpaqueType(node, true);
|
|
8068
|
-
|
|
8069
|
-
return
|
|
8212
|
+
var finished = this.flowParseOpaqueType(node, true);
|
|
8213
|
+
finished.type = "DeclareOpaqueType";
|
|
8214
|
+
return finished;
|
|
8070
8215
|
}
|
|
8071
8216
|
|
|
8072
8217
|
flowParseDeclareInterface(node) {
|
|
@@ -8323,7 +8468,7 @@
|
|
|
8323
8468
|
}
|
|
8324
8469
|
|
|
8325
8470
|
flowParseObjectPropertyKey() {
|
|
8326
|
-
return this.match(130) || this.match(129) ?
|
|
8471
|
+
return this.match(130) || this.match(129) ? super.parseExprAtom() : this.parseIdentifier(true);
|
|
8327
8472
|
}
|
|
8328
8473
|
|
|
8329
8474
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
@@ -8411,14 +8556,14 @@
|
|
|
8411
8556
|
return this.finishNode(node, "ObjectTypeCallProperty");
|
|
8412
8557
|
}
|
|
8413
8558
|
|
|
8414
|
-
flowParseObjectType(
|
|
8559
|
+
flowParseObjectType(_ref63) {
|
|
8415
8560
|
var {
|
|
8416
8561
|
allowStatic,
|
|
8417
8562
|
allowExact,
|
|
8418
8563
|
allowSpread,
|
|
8419
8564
|
allowProto,
|
|
8420
8565
|
allowInexact
|
|
8421
|
-
} =
|
|
8566
|
+
} = _ref63;
|
|
8422
8567
|
var oldInType = this.state.inType;
|
|
8423
8568
|
this.state.inType = true;
|
|
8424
8569
|
var nodeStart = this.startNode();
|
|
@@ -9108,7 +9253,7 @@
|
|
|
9108
9253
|
}
|
|
9109
9254
|
|
|
9110
9255
|
this.next();
|
|
9111
|
-
this.finishNode(variance, "Variance");
|
|
9256
|
+
return this.finishNode(variance, "Variance");
|
|
9112
9257
|
}
|
|
9113
9258
|
|
|
9114
9259
|
return variance;
|
|
@@ -9133,7 +9278,7 @@
|
|
|
9133
9278
|
node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
|
|
9134
9279
|
}
|
|
9135
9280
|
|
|
9136
|
-
super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
9281
|
+
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
9137
9282
|
}
|
|
9138
9283
|
|
|
9139
9284
|
parseStatement(context, topLevel) {
|
|
@@ -9388,7 +9533,7 @@
|
|
|
9388
9533
|
|
|
9389
9534
|
if (this.match(5)) {
|
|
9390
9535
|
node.specifiers = this.parseExportSpecifiers(true);
|
|
9391
|
-
|
|
9536
|
+
super.parseExportFrom(node);
|
|
9392
9537
|
return null;
|
|
9393
9538
|
} else {
|
|
9394
9539
|
return this.flowParseTypeAlias(declarationNode);
|
|
@@ -9420,7 +9565,7 @@
|
|
|
9420
9565
|
}
|
|
9421
9566
|
|
|
9422
9567
|
eatExportStar(node) {
|
|
9423
|
-
if (super.eatExportStar(
|
|
9568
|
+
if (super.eatExportStar(node)) return true;
|
|
9424
9569
|
|
|
9425
9570
|
if (this.isContextual(126) && this.lookahead().type === 55) {
|
|
9426
9571
|
node.exportKind = "type";
|
|
@@ -9459,7 +9604,7 @@
|
|
|
9459
9604
|
} = this.state;
|
|
9460
9605
|
|
|
9461
9606
|
if (this.isContextual(121)) {
|
|
9462
|
-
if (
|
|
9607
|
+
if (super.parseClassMemberFromModifier(classBody, member)) {
|
|
9463
9608
|
return;
|
|
9464
9609
|
}
|
|
9465
9610
|
|
|
@@ -9535,7 +9680,7 @@
|
|
|
9535
9680
|
node.left = this.typeCastToParameter(node.left);
|
|
9536
9681
|
}
|
|
9537
9682
|
|
|
9538
|
-
super.toAssignable(
|
|
9683
|
+
super.toAssignable(node, isLHS);
|
|
9539
9684
|
}
|
|
9540
9685
|
|
|
9541
9686
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
@@ -9576,12 +9721,8 @@
|
|
|
9576
9721
|
return node;
|
|
9577
9722
|
}
|
|
9578
9723
|
|
|
9579
|
-
isValidLVal(type) {
|
|
9580
|
-
|
|
9581
|
-
rest[_key3 - 1] = arguments[_key3];
|
|
9582
|
-
}
|
|
9583
|
-
|
|
9584
|
-
return type === "TypeCastExpression" || super.isValidLVal(type, ...rest);
|
|
9724
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
9725
|
+
return type === "TypeCastExpression" || super.isValidLVal(type, isParenthesized, binding);
|
|
9585
9726
|
}
|
|
9586
9727
|
|
|
9587
9728
|
parseClassProperty(node) {
|
|
@@ -9721,11 +9862,13 @@
|
|
|
9721
9862
|
if (!this.match(10)) this.unexpected();
|
|
9722
9863
|
}
|
|
9723
9864
|
|
|
9724
|
-
super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
9865
|
+
var result = super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
9725
9866
|
|
|
9726
9867
|
if (typeParameters) {
|
|
9727
|
-
(
|
|
9868
|
+
(result.value || result).typeParameters = typeParameters;
|
|
9728
9869
|
}
|
|
9870
|
+
|
|
9871
|
+
return result;
|
|
9729
9872
|
}
|
|
9730
9873
|
|
|
9731
9874
|
parseAssignableListItemTypes(param) {
|
|
@@ -9817,7 +9960,7 @@
|
|
|
9817
9960
|
return super.maybeParseDefaultImportSpecifier(node);
|
|
9818
9961
|
}
|
|
9819
9962
|
|
|
9820
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
9963
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
9821
9964
|
var firstIdent = specifier.imported;
|
|
9822
9965
|
var specifierTypeKind = null;
|
|
9823
9966
|
|
|
@@ -10040,6 +10183,8 @@
|
|
|
10040
10183
|
}
|
|
10041
10184
|
|
|
10042
10185
|
checkParams(node, allowDuplicates, isArrowFunction) {
|
|
10186
|
+
var strictModeChanged = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
10187
|
+
|
|
10043
10188
|
if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
10044
10189
|
return;
|
|
10045
10190
|
}
|
|
@@ -10052,7 +10197,7 @@
|
|
|
10052
10197
|
}
|
|
10053
10198
|
}
|
|
10054
10199
|
|
|
10055
|
-
return super.checkParams(
|
|
10200
|
+
return super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
|
|
10056
10201
|
}
|
|
10057
10202
|
|
|
10058
10203
|
parseParenAndDistinguishExpression(canBeArrow) {
|
|
@@ -10064,7 +10209,7 @@
|
|
|
10064
10209
|
this.next();
|
|
10065
10210
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10066
10211
|
node.callee = base;
|
|
10067
|
-
node.arguments =
|
|
10212
|
+
node.arguments = super.parseCallExpressionArguments(11, false);
|
|
10068
10213
|
base = this.finishNode(node, "CallExpression");
|
|
10069
10214
|
} else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
|
|
10070
10215
|
var state = this.state.clone();
|
|
@@ -10113,8 +10258,12 @@
|
|
|
10113
10258
|
var result = this.tryParse(() => {
|
|
10114
10259
|
_node4.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
|
|
10115
10260
|
this.expect(10);
|
|
10116
|
-
_node4.arguments =
|
|
10117
|
-
|
|
10261
|
+
_node4.arguments = super.parseCallExpressionArguments(11, false);
|
|
10262
|
+
|
|
10263
|
+
if (subscriptState.optionalChainMember) {
|
|
10264
|
+
_node4.optional = false;
|
|
10265
|
+
}
|
|
10266
|
+
|
|
10118
10267
|
return this.finishCallExpression(_node4, subscriptState.optionalChainMember);
|
|
10119
10268
|
});
|
|
10120
10269
|
|
|
@@ -10142,7 +10291,7 @@
|
|
|
10142
10291
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10143
10292
|
this.parseFunctionParams(node);
|
|
10144
10293
|
if (!this.parseArrow(node)) return;
|
|
10145
|
-
return
|
|
10294
|
+
return super.parseArrowExpression(node, undefined, true);
|
|
10146
10295
|
}
|
|
10147
10296
|
|
|
10148
10297
|
readToken_mult_modulo(code) {
|
|
@@ -10190,8 +10339,13 @@
|
|
|
10190
10339
|
}
|
|
10191
10340
|
|
|
10192
10341
|
this.hasFlowCommentCompletion();
|
|
10193
|
-
|
|
10194
|
-
|
|
10342
|
+
var commentSkip = this.skipFlowComment();
|
|
10343
|
+
|
|
10344
|
+
if (commentSkip) {
|
|
10345
|
+
this.state.pos += commentSkip;
|
|
10346
|
+
this.state.hasFlowComment = true;
|
|
10347
|
+
}
|
|
10348
|
+
|
|
10195
10349
|
return;
|
|
10196
10350
|
}
|
|
10197
10351
|
|
|
@@ -10249,11 +10403,11 @@
|
|
|
10249
10403
|
}
|
|
10250
10404
|
}
|
|
10251
10405
|
|
|
10252
|
-
flowEnumErrorBooleanMemberNotInitialized(loc,
|
|
10406
|
+
flowEnumErrorBooleanMemberNotInitialized(loc, _ref64) {
|
|
10253
10407
|
var {
|
|
10254
10408
|
enumName,
|
|
10255
10409
|
memberName
|
|
10256
|
-
} =
|
|
10410
|
+
} = _ref64;
|
|
10257
10411
|
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
|
|
10258
10412
|
at: loc,
|
|
10259
10413
|
memberName,
|
|
@@ -10267,11 +10421,11 @@
|
|
|
10267
10421
|
}, enumContext));
|
|
10268
10422
|
}
|
|
10269
10423
|
|
|
10270
|
-
flowEnumErrorNumberMemberNotInitialized(loc,
|
|
10424
|
+
flowEnumErrorNumberMemberNotInitialized(loc, _ref65) {
|
|
10271
10425
|
var {
|
|
10272
10426
|
enumName,
|
|
10273
10427
|
memberName
|
|
10274
|
-
} =
|
|
10428
|
+
} = _ref65;
|
|
10275
10429
|
this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
|
|
10276
10430
|
at: loc,
|
|
10277
10431
|
enumName,
|
|
@@ -10279,10 +10433,10 @@
|
|
|
10279
10433
|
});
|
|
10280
10434
|
}
|
|
10281
10435
|
|
|
10282
|
-
flowEnumErrorStringMemberInconsistentlyInitailized(node,
|
|
10436
|
+
flowEnumErrorStringMemberInconsistentlyInitailized(node, _ref66) {
|
|
10283
10437
|
var {
|
|
10284
10438
|
enumName
|
|
10285
|
-
} =
|
|
10439
|
+
} = _ref66;
|
|
10286
10440
|
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitailized, {
|
|
10287
10441
|
at: node,
|
|
10288
10442
|
enumName
|
|
@@ -10385,11 +10539,11 @@
|
|
|
10385
10539
|
}
|
|
10386
10540
|
}
|
|
10387
10541
|
|
|
10388
|
-
flowEnumMembers(
|
|
10542
|
+
flowEnumMembers(_ref67) {
|
|
10389
10543
|
var {
|
|
10390
10544
|
enumName,
|
|
10391
10545
|
explicitType
|
|
10392
|
-
} =
|
|
10546
|
+
} = _ref67;
|
|
10393
10547
|
var seenNames = new Set();
|
|
10394
10548
|
var members = {
|
|
10395
10549
|
booleanMembers: [],
|
|
@@ -10499,10 +10653,10 @@
|
|
|
10499
10653
|
};
|
|
10500
10654
|
}
|
|
10501
10655
|
|
|
10502
|
-
flowEnumStringMembers(initializedMembers, defaultedMembers,
|
|
10656
|
+
flowEnumStringMembers(initializedMembers, defaultedMembers, _ref68) {
|
|
10503
10657
|
var {
|
|
10504
10658
|
enumName
|
|
10505
|
-
} =
|
|
10659
|
+
} = _ref68;
|
|
10506
10660
|
|
|
10507
10661
|
if (initializedMembers.length === 0) {
|
|
10508
10662
|
return defaultedMembers;
|
|
@@ -10527,10 +10681,10 @@
|
|
|
10527
10681
|
}
|
|
10528
10682
|
}
|
|
10529
10683
|
|
|
10530
|
-
flowEnumParseExplicitType(
|
|
10684
|
+
flowEnumParseExplicitType(_ref69) {
|
|
10531
10685
|
var {
|
|
10532
10686
|
enumName
|
|
10533
|
-
} =
|
|
10687
|
+
} = _ref69;
|
|
10534
10688
|
if (!this.eatContextual(101)) return null;
|
|
10535
10689
|
|
|
10536
10690
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
@@ -10933,27 +11087,27 @@
|
|
|
10933
11087
|
hearts: "\u2665",
|
|
10934
11088
|
diams: "\u2666"
|
|
10935
11089
|
};
|
|
10936
|
-
var JsxErrors = ParseErrorEnum(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["jsx"])))(
|
|
10937
|
-
AttributeIsEmpty:
|
|
10938
|
-
MissingClosingTagElement:
|
|
11090
|
+
var JsxErrors = ParseErrorEnum(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["jsx"])))({
|
|
11091
|
+
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
|
|
11092
|
+
MissingClosingTagElement: _ref70 => {
|
|
10939
11093
|
var {
|
|
10940
11094
|
openingTagName
|
|
10941
|
-
} =
|
|
11095
|
+
} = _ref70;
|
|
10942
11096
|
return "Expected corresponding JSX closing tag for <".concat(openingTagName, ">.");
|
|
10943
|
-
}
|
|
10944
|
-
MissingClosingTagFragment:
|
|
10945
|
-
UnexpectedSequenceExpression:
|
|
10946
|
-
UnexpectedToken:
|
|
11097
|
+
},
|
|
11098
|
+
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
|
|
11099
|
+
UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
|
|
11100
|
+
UnexpectedToken: _ref71 => {
|
|
10947
11101
|
var {
|
|
10948
11102
|
unexpected,
|
|
10949
11103
|
HTMLEntity
|
|
10950
|
-
} =
|
|
11104
|
+
} = _ref71;
|
|
10951
11105
|
return "Unexpected token `".concat(unexpected, "`. Did you mean `").concat(HTMLEntity, "` or `{'").concat(unexpected, "'}`?");
|
|
10952
|
-
}
|
|
10953
|
-
UnsupportedJsxValue:
|
|
10954
|
-
UnterminatedJsxContent:
|
|
10955
|
-
UnwrappedAdjacentJSXElements:
|
|
10956
|
-
})
|
|
11106
|
+
},
|
|
11107
|
+
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
|
|
11108
|
+
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
11109
|
+
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
11110
|
+
});
|
|
10957
11111
|
|
|
10958
11112
|
function isFragment(object) {
|
|
10959
11113
|
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
|
|
@@ -10975,7 +11129,7 @@
|
|
|
10975
11129
|
throw new Error("Node had unexpected type: " + object.type);
|
|
10976
11130
|
}
|
|
10977
11131
|
|
|
10978
|
-
var jsx = superClass => class extends superClass {
|
|
11132
|
+
var jsx = superClass => class JSXParserMixin extends superClass {
|
|
10979
11133
|
jsxReadToken() {
|
|
10980
11134
|
var out = "";
|
|
10981
11135
|
var chunkStart = this.state.pos;
|
|
@@ -11207,7 +11361,7 @@
|
|
|
11207
11361
|
jsxParseSpreadChild(node) {
|
|
11208
11362
|
this.next();
|
|
11209
11363
|
node.expression = this.parseExpression();
|
|
11210
|
-
this.setContext(types.
|
|
11364
|
+
this.setContext(types.j_expr);
|
|
11211
11365
|
this.state.canStartJSXElement = true;
|
|
11212
11366
|
this.expect(8);
|
|
11213
11367
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -11470,11 +11624,63 @@
|
|
|
11470
11624
|
}
|
|
11471
11625
|
|
|
11472
11626
|
class TypeScriptScopeHandler extends ScopeHandler {
|
|
11627
|
+
constructor() {
|
|
11628
|
+
super(...arguments);
|
|
11629
|
+
this.importsStack = [];
|
|
11630
|
+
}
|
|
11631
|
+
|
|
11473
11632
|
createScope(flags) {
|
|
11633
|
+
this.importsStack.push(new Set());
|
|
11474
11634
|
return new TypeScriptScope(flags);
|
|
11475
11635
|
}
|
|
11476
11636
|
|
|
11637
|
+
enter(flags) {
|
|
11638
|
+
if (flags == SCOPE_TS_MODULE) {
|
|
11639
|
+
this.importsStack.push(new Set());
|
|
11640
|
+
}
|
|
11641
|
+
|
|
11642
|
+
super.enter(flags);
|
|
11643
|
+
}
|
|
11644
|
+
|
|
11645
|
+
exit() {
|
|
11646
|
+
var flags = super.exit();
|
|
11647
|
+
|
|
11648
|
+
if (flags == SCOPE_TS_MODULE) {
|
|
11649
|
+
this.importsStack.pop();
|
|
11650
|
+
}
|
|
11651
|
+
|
|
11652
|
+
return flags;
|
|
11653
|
+
}
|
|
11654
|
+
|
|
11655
|
+
hasImport(name, allowShadow) {
|
|
11656
|
+
var len = this.importsStack.length;
|
|
11657
|
+
|
|
11658
|
+
if (this.importsStack[len - 1].has(name)) {
|
|
11659
|
+
return true;
|
|
11660
|
+
}
|
|
11661
|
+
|
|
11662
|
+
if (!allowShadow && len > 1) {
|
|
11663
|
+
for (var i = 0; i < len - 1; i++) {
|
|
11664
|
+
if (this.importsStack[i].has(name)) return true;
|
|
11665
|
+
}
|
|
11666
|
+
}
|
|
11667
|
+
|
|
11668
|
+
return false;
|
|
11669
|
+
}
|
|
11670
|
+
|
|
11477
11671
|
declareName(name, bindingType, loc) {
|
|
11672
|
+
if (bindingType & BIND_FLAGS_TS_IMPORT) {
|
|
11673
|
+
if (this.hasImport(name, true)) {
|
|
11674
|
+
this.parser.raise(Errors.VarRedeclaration, {
|
|
11675
|
+
at: loc,
|
|
11676
|
+
identifierName: name
|
|
11677
|
+
});
|
|
11678
|
+
}
|
|
11679
|
+
|
|
11680
|
+
this.importsStack[this.importsStack.length - 1].add(name);
|
|
11681
|
+
return;
|
|
11682
|
+
}
|
|
11683
|
+
|
|
11478
11684
|
var scope = this.currentScope();
|
|
11479
11685
|
|
|
11480
11686
|
if (bindingType & BIND_FLAGS_TS_EXPORT_ONLY) {
|
|
@@ -11483,7 +11689,7 @@
|
|
|
11483
11689
|
return;
|
|
11484
11690
|
}
|
|
11485
11691
|
|
|
11486
|
-
super.declareName(
|
|
11692
|
+
super.declareName(name, bindingType, loc);
|
|
11487
11693
|
|
|
11488
11694
|
if (bindingType & BIND_KIND_TYPE) {
|
|
11489
11695
|
if (!(bindingType & BIND_KIND_VALUE)) {
|
|
@@ -11522,18 +11728,22 @@
|
|
|
11522
11728
|
return true;
|
|
11523
11729
|
}
|
|
11524
11730
|
|
|
11525
|
-
return super.isRedeclaredInScope(
|
|
11731
|
+
return super.isRedeclaredInScope(scope, name, bindingType);
|
|
11526
11732
|
}
|
|
11527
11733
|
|
|
11528
11734
|
checkLocalExport(id) {
|
|
11529
|
-
var topLevelScope = this.scopeStack[0];
|
|
11530
11735
|
var {
|
|
11531
11736
|
name
|
|
11532
11737
|
} = id;
|
|
11738
|
+
if (this.hasImport(name)) return;
|
|
11739
|
+
var len = this.scopeStack.length;
|
|
11533
11740
|
|
|
11534
|
-
|
|
11535
|
-
|
|
11741
|
+
for (var i = len - 1; i >= 0; i--) {
|
|
11742
|
+
var scope = this.scopeStack[i];
|
|
11743
|
+
if (scope.types.has(name) || scope.exportOnlyBindings.has(name)) return;
|
|
11536
11744
|
}
|
|
11745
|
+
|
|
11746
|
+
super.checkLocalExport(id);
|
|
11537
11747
|
}
|
|
11538
11748
|
|
|
11539
11749
|
}
|
|
@@ -11554,145 +11764,145 @@
|
|
|
11554
11764
|
}
|
|
11555
11765
|
}
|
|
11556
11766
|
|
|
11557
|
-
var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["typescript"])))(
|
|
11558
|
-
AbstractMethodHasImplementation:
|
|
11767
|
+
var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["typescript"])))({
|
|
11768
|
+
AbstractMethodHasImplementation: _ref72 => {
|
|
11559
11769
|
var {
|
|
11560
11770
|
methodName
|
|
11561
|
-
} =
|
|
11771
|
+
} = _ref72;
|
|
11562
11772
|
return "Method '".concat(methodName, "' cannot have an implementation because it is marked abstract.");
|
|
11563
|
-
}
|
|
11564
|
-
AbstractPropertyHasInitializer:
|
|
11773
|
+
},
|
|
11774
|
+
AbstractPropertyHasInitializer: _ref73 => {
|
|
11565
11775
|
var {
|
|
11566
11776
|
propertyName
|
|
11567
|
-
} =
|
|
11777
|
+
} = _ref73;
|
|
11568
11778
|
return "Property '".concat(propertyName, "' cannot have an initializer because it is marked abstract.");
|
|
11569
|
-
}
|
|
11570
|
-
AccesorCannotDeclareThisParameter:
|
|
11571
|
-
AccesorCannotHaveTypeParameters:
|
|
11572
|
-
CannotFindName:
|
|
11779
|
+
},
|
|
11780
|
+
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
|
11781
|
+
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
|
11782
|
+
CannotFindName: _ref74 => {
|
|
11573
11783
|
var {
|
|
11574
11784
|
name
|
|
11575
|
-
} =
|
|
11785
|
+
} = _ref74;
|
|
11576
11786
|
return "Cannot find name '".concat(name, "'.");
|
|
11577
|
-
}
|
|
11578
|
-
ClassMethodHasDeclare:
|
|
11579
|
-
ClassMethodHasReadonly:
|
|
11580
|
-
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference:
|
|
11581
|
-
ConstructorHasTypeParameters:
|
|
11582
|
-
DeclareAccessor:
|
|
11787
|
+
},
|
|
11788
|
+
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
|
11789
|
+
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
|
11790
|
+
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
|
11791
|
+
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
|
|
11792
|
+
DeclareAccessor: _ref75 => {
|
|
11583
11793
|
var {
|
|
11584
11794
|
kind
|
|
11585
|
-
} =
|
|
11795
|
+
} = _ref75;
|
|
11586
11796
|
return "'declare' is not allowed in ".concat(kind, "ters.");
|
|
11587
|
-
}
|
|
11588
|
-
DeclareClassFieldHasInitializer:
|
|
11589
|
-
DeclareFunctionHasImplementation:
|
|
11590
|
-
DuplicateAccessibilityModifier:
|
|
11797
|
+
},
|
|
11798
|
+
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
11799
|
+
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
11800
|
+
DuplicateAccessibilityModifier: _ref76 => {
|
|
11591
11801
|
return "Accessibility modifier already seen.";
|
|
11592
|
-
}
|
|
11593
|
-
DuplicateModifier:
|
|
11802
|
+
},
|
|
11803
|
+
DuplicateModifier: _ref77 => {
|
|
11594
11804
|
var {
|
|
11595
11805
|
modifier
|
|
11596
|
-
} =
|
|
11806
|
+
} = _ref77;
|
|
11597
11807
|
return "Duplicate modifier: '".concat(modifier, "'.");
|
|
11598
|
-
}
|
|
11599
|
-
EmptyHeritageClauseType:
|
|
11808
|
+
},
|
|
11809
|
+
EmptyHeritageClauseType: _ref78 => {
|
|
11600
11810
|
var {
|
|
11601
11811
|
token
|
|
11602
|
-
} =
|
|
11812
|
+
} = _ref78;
|
|
11603
11813
|
return "'".concat(token, "' list cannot be empty.");
|
|
11604
|
-
}
|
|
11605
|
-
EmptyTypeArguments:
|
|
11606
|
-
EmptyTypeParameters:
|
|
11607
|
-
ExpectedAmbientAfterExportDeclare:
|
|
11608
|
-
ImportAliasHasImportType:
|
|
11609
|
-
IncompatibleModifiers:
|
|
11814
|
+
},
|
|
11815
|
+
EmptyTypeArguments: "Type argument list cannot be empty.",
|
|
11816
|
+
EmptyTypeParameters: "Type parameter list cannot be empty.",
|
|
11817
|
+
ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
|
|
11818
|
+
ImportAliasHasImportType: "An import alias can not use 'import type'.",
|
|
11819
|
+
IncompatibleModifiers: _ref79 => {
|
|
11610
11820
|
var {
|
|
11611
11821
|
modifiers
|
|
11612
|
-
} =
|
|
11822
|
+
} = _ref79;
|
|
11613
11823
|
return "'".concat(modifiers[0], "' modifier cannot be used with '").concat(modifiers[1], "' modifier.");
|
|
11614
|
-
}
|
|
11615
|
-
IndexSignatureHasAbstract:
|
|
11616
|
-
IndexSignatureHasAccessibility:
|
|
11824
|
+
},
|
|
11825
|
+
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
|
|
11826
|
+
IndexSignatureHasAccessibility: _ref80 => {
|
|
11617
11827
|
var {
|
|
11618
11828
|
modifier
|
|
11619
|
-
} =
|
|
11829
|
+
} = _ref80;
|
|
11620
11830
|
return "Index signatures cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11621
|
-
}
|
|
11622
|
-
IndexSignatureHasDeclare:
|
|
11623
|
-
IndexSignatureHasOverride:
|
|
11624
|
-
IndexSignatureHasStatic:
|
|
11625
|
-
InitializerNotAllowedInAmbientContext:
|
|
11626
|
-
InvalidModifierOnTypeMember:
|
|
11831
|
+
},
|
|
11832
|
+
IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
|
|
11833
|
+
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
|
|
11834
|
+
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
|
|
11835
|
+
InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
|
|
11836
|
+
InvalidModifierOnTypeMember: _ref81 => {
|
|
11627
11837
|
var {
|
|
11628
11838
|
modifier
|
|
11629
|
-
} =
|
|
11839
|
+
} = _ref81;
|
|
11630
11840
|
return "'".concat(modifier, "' modifier cannot appear on a type member.");
|
|
11631
|
-
}
|
|
11632
|
-
InvalidModifierOnTypeParameter:
|
|
11841
|
+
},
|
|
11842
|
+
InvalidModifierOnTypeParameter: _ref82 => {
|
|
11633
11843
|
var {
|
|
11634
11844
|
modifier
|
|
11635
|
-
} =
|
|
11845
|
+
} = _ref82;
|
|
11636
11846
|
return "'".concat(modifier, "' modifier cannot appear on a type parameter.");
|
|
11637
|
-
}
|
|
11638
|
-
InvalidModifierOnTypeParameterPositions:
|
|
11847
|
+
},
|
|
11848
|
+
InvalidModifierOnTypeParameterPositions: _ref83 => {
|
|
11639
11849
|
var {
|
|
11640
11850
|
modifier
|
|
11641
|
-
} =
|
|
11851
|
+
} = _ref83;
|
|
11642
11852
|
return "'".concat(modifier, "' modifier can only appear on a type parameter of a class, interface or type alias.");
|
|
11643
|
-
}
|
|
11644
|
-
InvalidModifiersOrder:
|
|
11853
|
+
},
|
|
11854
|
+
InvalidModifiersOrder: _ref84 => {
|
|
11645
11855
|
var {
|
|
11646
11856
|
orderedModifiers
|
|
11647
|
-
} =
|
|
11857
|
+
} = _ref84;
|
|
11648
11858
|
return "'".concat(orderedModifiers[0], "' modifier must precede '").concat(orderedModifiers[1], "' modifier.");
|
|
11649
|
-
}
|
|
11650
|
-
InvalidPropertyAccessAfterInstantiationExpression:
|
|
11651
|
-
InvalidTupleMemberLabel:
|
|
11652
|
-
MissingInterfaceName:
|
|
11653
|
-
MixedLabeledAndUnlabeledElements:
|
|
11654
|
-
NonAbstractClassHasAbstractMethod:
|
|
11655
|
-
NonClassMethodPropertyHasAbstractModifer:
|
|
11656
|
-
OptionalTypeBeforeRequired:
|
|
11657
|
-
OverrideNotInSubClass:
|
|
11658
|
-
PatternIsOptional:
|
|
11659
|
-
PrivateElementHasAbstract:
|
|
11660
|
-
PrivateElementHasAccessibility:
|
|
11859
|
+
},
|
|
11860
|
+
InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. " + "You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
|
|
11861
|
+
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
|
11862
|
+
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
|
|
11863
|
+
MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
|
|
11864
|
+
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
|
|
11865
|
+
NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
|
|
11866
|
+
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
|
11867
|
+
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
|
|
11868
|
+
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
|
11869
|
+
PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
|
|
11870
|
+
PrivateElementHasAccessibility: _ref85 => {
|
|
11661
11871
|
var {
|
|
11662
11872
|
modifier
|
|
11663
|
-
} =
|
|
11873
|
+
} = _ref85;
|
|
11664
11874
|
return "Private elements cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11665
|
-
}
|
|
11666
|
-
ReadonlyForMethodSignature:
|
|
11667
|
-
ReservedArrowTypeParam:
|
|
11668
|
-
ReservedTypeAssertion:
|
|
11669
|
-
SetAccesorCannotHaveOptionalParameter:
|
|
11670
|
-
SetAccesorCannotHaveRestParameter:
|
|
11671
|
-
SetAccesorCannotHaveReturnType:
|
|
11672
|
-
SingleTypeParameterWithoutTrailingComma:
|
|
11875
|
+
},
|
|
11876
|
+
ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
|
|
11877
|
+
ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
|
|
11878
|
+
ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
|
|
11879
|
+
SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
|
|
11880
|
+
SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
|
|
11881
|
+
SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
|
|
11882
|
+
SingleTypeParameterWithoutTrailingComma: _ref86 => {
|
|
11673
11883
|
var {
|
|
11674
11884
|
typeParameterName
|
|
11675
|
-
} =
|
|
11885
|
+
} = _ref86;
|
|
11676
11886
|
return "Single type parameter ".concat(typeParameterName, " should have a trailing comma. Example usage: <").concat(typeParameterName, ",>.");
|
|
11677
|
-
}
|
|
11678
|
-
StaticBlockCannotHaveModifier:
|
|
11679
|
-
TypeAnnotationAfterAssign:
|
|
11680
|
-
TypeImportCannotSpecifyDefaultAndNamed:
|
|
11681
|
-
TypeModifierIsUsedInTypeExports:
|
|
11682
|
-
TypeModifierIsUsedInTypeImports:
|
|
11683
|
-
UnexpectedParameterModifier:
|
|
11684
|
-
UnexpectedReadonly:
|
|
11685
|
-
UnexpectedTypeAnnotation:
|
|
11686
|
-
UnexpectedTypeCastInParameter:
|
|
11687
|
-
UnsupportedImportTypeArgument:
|
|
11688
|
-
UnsupportedParameterPropertyKind:
|
|
11689
|
-
UnsupportedSignatureParameterKind:
|
|
11887
|
+
},
|
|
11888
|
+
StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
|
|
11889
|
+
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
11890
|
+
TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
|
|
11891
|
+
TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
|
|
11892
|
+
TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
|
|
11893
|
+
UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
|
|
11894
|
+
UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
|
|
11895
|
+
UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
|
|
11896
|
+
UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
|
|
11897
|
+
UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
|
|
11898
|
+
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
|
11899
|
+
UnsupportedSignatureParameterKind: _ref87 => {
|
|
11690
11900
|
var {
|
|
11691
11901
|
type
|
|
11692
|
-
} =
|
|
11902
|
+
} = _ref87;
|
|
11693
11903
|
return "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ".concat(type, ".");
|
|
11694
|
-
}
|
|
11695
|
-
})
|
|
11904
|
+
}
|
|
11905
|
+
});
|
|
11696
11906
|
|
|
11697
11907
|
function keywordTypeFromName(value) {
|
|
11698
11908
|
switch (value) {
|
|
@@ -11739,7 +11949,7 @@
|
|
|
11739
11949
|
return modifier === "in" || modifier === "out";
|
|
11740
11950
|
}
|
|
11741
11951
|
|
|
11742
|
-
var typescript = superClass => class extends superClass {
|
|
11952
|
+
var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
11743
11953
|
getScopeHandler() {
|
|
11744
11954
|
return TypeScriptScopeHandler;
|
|
11745
11955
|
}
|
|
@@ -11777,14 +11987,14 @@
|
|
|
11777
11987
|
return undefined;
|
|
11778
11988
|
}
|
|
11779
11989
|
|
|
11780
|
-
tsParseModifiers(
|
|
11990
|
+
tsParseModifiers(_ref88) {
|
|
11781
11991
|
var {
|
|
11782
11992
|
modified,
|
|
11783
11993
|
allowedModifiers,
|
|
11784
11994
|
disallowedModifiers,
|
|
11785
11995
|
stopOnStartOfClassStaticBlock,
|
|
11786
11996
|
errorTemplate = TSErrors.InvalidModifierOnTypeMember
|
|
11787
|
-
} =
|
|
11997
|
+
} = _ref88;
|
|
11788
11998
|
|
|
11789
11999
|
var enforceOrder = (loc, modifier, before, after) => {
|
|
11790
12000
|
if (modifier === before && modified[after]) {
|
|
@@ -11965,7 +12175,7 @@
|
|
|
11965
12175
|
});
|
|
11966
12176
|
}
|
|
11967
12177
|
|
|
11968
|
-
node.argument =
|
|
12178
|
+
node.argument = super.parseExprAtom();
|
|
11969
12179
|
this.expect(11);
|
|
11970
12180
|
|
|
11971
12181
|
if (this.eat(16)) {
|
|
@@ -12128,7 +12338,7 @@
|
|
|
12128
12338
|
}
|
|
12129
12339
|
|
|
12130
12340
|
tsParseBindingListForSignature() {
|
|
12131
|
-
return
|
|
12341
|
+
return super.parseBindingList(11, 41).map(pattern => {
|
|
12132
12342
|
if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") {
|
|
12133
12343
|
this.raise(TSErrors.UnsupportedSignatureParameterKind, {
|
|
12134
12344
|
at: pattern,
|
|
@@ -12293,11 +12503,11 @@
|
|
|
12293
12503
|
return idx;
|
|
12294
12504
|
}
|
|
12295
12505
|
|
|
12296
|
-
|
|
12506
|
+
super.parsePropertyName(node);
|
|
12297
12507
|
|
|
12298
12508
|
if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) {
|
|
12299
12509
|
node.kind = node.key.name;
|
|
12300
|
-
|
|
12510
|
+
super.parsePropertyName(node);
|
|
12301
12511
|
}
|
|
12302
12512
|
|
|
12303
12513
|
return this.tsParsePropertyOrMethodSignature(node, !!node.readonly);
|
|
@@ -12397,15 +12607,16 @@
|
|
|
12397
12607
|
});
|
|
12398
12608
|
}
|
|
12399
12609
|
|
|
12400
|
-
seenOptionalElement
|
|
12610
|
+
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
12611
|
+
var checkType = type;
|
|
12401
12612
|
|
|
12402
12613
|
if (type === "TSRestType") {
|
|
12403
12614
|
elementNode = elementNode.typeAnnotation;
|
|
12404
|
-
|
|
12615
|
+
checkType = elementNode.type;
|
|
12405
12616
|
}
|
|
12406
12617
|
|
|
12407
|
-
var isLabeled =
|
|
12408
|
-
|
|
12618
|
+
var isLabeled = checkType === "TSNamedTupleMember";
|
|
12619
|
+
(_labeledElements = labeledElements) != null ? _labeledElements : labeledElements = isLabeled;
|
|
12409
12620
|
|
|
12410
12621
|
if (labeledElements !== isLabeled) {
|
|
12411
12622
|
this.raise(TSErrors.MixedLabeledAndUnlabeledElements, {
|
|
@@ -12487,7 +12698,7 @@
|
|
|
12487
12698
|
case 129:
|
|
12488
12699
|
case 85:
|
|
12489
12700
|
case 86:
|
|
12490
|
-
return
|
|
12701
|
+
return super.parseExprAtom();
|
|
12491
12702
|
|
|
12492
12703
|
default:
|
|
12493
12704
|
throw this.unexpected();
|
|
@@ -12499,7 +12710,7 @@
|
|
|
12499
12710
|
|
|
12500
12711
|
tsParseTemplateLiteralType() {
|
|
12501
12712
|
var node = this.startNode();
|
|
12502
|
-
node.literal =
|
|
12713
|
+
node.literal = super.parseTemplate(false);
|
|
12503
12714
|
return this.finishNode(node, "TSLiteralType");
|
|
12504
12715
|
}
|
|
12505
12716
|
|
|
@@ -12723,7 +12934,7 @@
|
|
|
12723
12934
|
var _previousErrorCount = _errors.length;
|
|
12724
12935
|
|
|
12725
12936
|
try {
|
|
12726
|
-
|
|
12937
|
+
super.parseBindingList(3, 93, true);
|
|
12727
12938
|
return _errors.length === _previousErrorCount;
|
|
12728
12939
|
} catch (_unused2) {
|
|
12729
12940
|
return false;
|
|
@@ -13046,10 +13257,10 @@
|
|
|
13046
13257
|
|
|
13047
13258
|
tsParseEnumMember() {
|
|
13048
13259
|
var node = this.startNode();
|
|
13049
|
-
node.id = this.match(129) ? this.
|
|
13260
|
+
node.id = this.match(129) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
|
|
13050
13261
|
|
|
13051
13262
|
if (this.eat(29)) {
|
|
13052
|
-
node.initializer =
|
|
13263
|
+
node.initializer = super.parseMaybeAssignAllowIn();
|
|
13053
13264
|
}
|
|
13054
13265
|
|
|
13055
13266
|
return this.finishNode(node, "TSEnumMember");
|
|
@@ -13072,7 +13283,8 @@
|
|
|
13072
13283
|
var node = this.startNode();
|
|
13073
13284
|
this.scope.enter(SCOPE_OTHER);
|
|
13074
13285
|
this.expect(5);
|
|
13075
|
-
|
|
13286
|
+
super.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 8);
|
|
13287
|
+
this.next();
|
|
13076
13288
|
this.scope.exit();
|
|
13077
13289
|
return this.finishNode(node, "TSModuleBlock");
|
|
13078
13290
|
}
|
|
@@ -13105,7 +13317,7 @@
|
|
|
13105
13317
|
node.global = true;
|
|
13106
13318
|
node.id = this.parseIdentifier();
|
|
13107
13319
|
} else if (this.match(129)) {
|
|
13108
|
-
node.id = this.
|
|
13320
|
+
node.id = super.parseStringLiteral(this.state.value);
|
|
13109
13321
|
} else {
|
|
13110
13322
|
this.unexpected();
|
|
13111
13323
|
}
|
|
@@ -13126,7 +13338,7 @@
|
|
|
13126
13338
|
tsParseImportEqualsDeclaration(node, isExport) {
|
|
13127
13339
|
node.isExport = isExport || false;
|
|
13128
13340
|
node.id = this.parseIdentifier();
|
|
13129
|
-
this.checkIdentifier(node.id,
|
|
13341
|
+
this.checkIdentifier(node.id, BIND_FLAGS_TS_IMPORT);
|
|
13130
13342
|
this.expect(29);
|
|
13131
13343
|
var moduleReference = this.tsParseModuleReference();
|
|
13132
13344
|
|
|
@@ -13158,7 +13370,7 @@
|
|
|
13158
13370
|
throw this.unexpected();
|
|
13159
13371
|
}
|
|
13160
13372
|
|
|
13161
|
-
node.expression =
|
|
13373
|
+
node.expression = super.parseExprAtom();
|
|
13162
13374
|
this.expect(11);
|
|
13163
13375
|
return this.finishNode(node, "TSExternalModuleReference");
|
|
13164
13376
|
}
|
|
@@ -13205,7 +13417,7 @@
|
|
|
13205
13417
|
return this.tsInAmbientContext(() => {
|
|
13206
13418
|
if (starttype === 68) {
|
|
13207
13419
|
nany.declare = true;
|
|
13208
|
-
return
|
|
13420
|
+
return super.parseFunctionStatement(nany, false, true);
|
|
13209
13421
|
}
|
|
13210
13422
|
|
|
13211
13423
|
if (starttype === 80) {
|
|
@@ -13354,7 +13566,7 @@
|
|
|
13354
13566
|
return undefined;
|
|
13355
13567
|
}
|
|
13356
13568
|
|
|
13357
|
-
return
|
|
13569
|
+
return super.parseArrowExpression(res, null, true);
|
|
13358
13570
|
}
|
|
13359
13571
|
|
|
13360
13572
|
tsParseTypeArgumentsInExpression() {
|
|
@@ -13461,8 +13673,7 @@
|
|
|
13461
13673
|
var bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : undefined;
|
|
13462
13674
|
|
|
13463
13675
|
if (bodilessType && !this.match(5) && this.isLineTerminator()) {
|
|
13464
|
-
this.finishNode(node, bodilessType);
|
|
13465
|
-
return;
|
|
13676
|
+
return this.finishNode(node, bodilessType);
|
|
13466
13677
|
}
|
|
13467
13678
|
|
|
13468
13679
|
if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
|
|
@@ -13471,19 +13682,18 @@
|
|
|
13471
13682
|
});
|
|
13472
13683
|
|
|
13473
13684
|
if (node.declare) {
|
|
13474
|
-
super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
13475
|
-
return;
|
|
13685
|
+
return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
13476
13686
|
}
|
|
13477
13687
|
}
|
|
13478
13688
|
|
|
13479
|
-
super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
13689
|
+
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
13480
13690
|
}
|
|
13481
13691
|
|
|
13482
13692
|
registerFunctionStatementId(node) {
|
|
13483
13693
|
if (!node.body && node.id) {
|
|
13484
13694
|
this.checkIdentifier(node.id, BIND_TS_AMBIENT);
|
|
13485
13695
|
} else {
|
|
13486
|
-
super.registerFunctionStatementId(
|
|
13696
|
+
super.registerFunctionStatementId(node);
|
|
13487
13697
|
}
|
|
13488
13698
|
}
|
|
13489
13699
|
|
|
@@ -13502,8 +13712,8 @@
|
|
|
13502
13712
|
return exprList;
|
|
13503
13713
|
}
|
|
13504
13714
|
|
|
13505
|
-
parseArrayLike() {
|
|
13506
|
-
var node = super.parseArrayLike(
|
|
13715
|
+
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
13716
|
+
var node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
|
|
13507
13717
|
|
|
13508
13718
|
if (node.type === "ArrayExpression") {
|
|
13509
13719
|
this.tsCheckForInvalidTypeCasts(node.elements);
|
|
@@ -13553,7 +13763,7 @@
|
|
|
13553
13763
|
}
|
|
13554
13764
|
|
|
13555
13765
|
if (tokenIsTemplate(this.state.type)) {
|
|
13556
|
-
var _result =
|
|
13766
|
+
var _result = super.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13557
13767
|
|
|
13558
13768
|
_result.typeParameters = typeArguments;
|
|
13559
13769
|
return _result;
|
|
@@ -13576,7 +13786,7 @@
|
|
|
13576
13786
|
|
|
13577
13787
|
var tokenType = this.state.type;
|
|
13578
13788
|
|
|
13579
|
-
if (tokenType === 48 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
13789
|
+
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
|
13580
13790
|
return;
|
|
13581
13791
|
}
|
|
13582
13792
|
|
|
@@ -13689,7 +13899,7 @@
|
|
|
13689
13899
|
return this.tsParseImportEqualsDeclaration(node, true);
|
|
13690
13900
|
} else if (this.eat(29)) {
|
|
13691
13901
|
var assign = node;
|
|
13692
|
-
assign.expression =
|
|
13902
|
+
assign.expression = super.parseExpression();
|
|
13693
13903
|
this.semicolon();
|
|
13694
13904
|
return this.finishNode(assign, "TSExportAssignment");
|
|
13695
13905
|
} else if (this.eatContextual(93)) {
|
|
@@ -13719,8 +13929,7 @@
|
|
|
13719
13929
|
var cls = this.startNode();
|
|
13720
13930
|
this.next();
|
|
13721
13931
|
cls.abstract = true;
|
|
13722
|
-
this.parseClass(cls, true, true);
|
|
13723
|
-
return cls;
|
|
13932
|
+
return this.parseClass(cls, true, true);
|
|
13724
13933
|
}
|
|
13725
13934
|
|
|
13726
13935
|
if (this.match(125)) {
|
|
@@ -13819,7 +14028,7 @@
|
|
|
13819
14028
|
});
|
|
13820
14029
|
}
|
|
13821
14030
|
|
|
13822
|
-
|
|
14031
|
+
super.parseClassStaticBlock(classBody, member);
|
|
13823
14032
|
} else {
|
|
13824
14033
|
this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
|
|
13825
14034
|
}
|
|
@@ -13978,7 +14187,7 @@
|
|
|
13978
14187
|
return declaration;
|
|
13979
14188
|
}
|
|
13980
14189
|
|
|
13981
|
-
parseClassId(node, isStatement, optionalId) {
|
|
14190
|
+
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
13982
14191
|
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
13983
14192
|
return;
|
|
13984
14193
|
}
|
|
@@ -14000,7 +14209,7 @@
|
|
|
14000
14209
|
parseClassProperty(node) {
|
|
14001
14210
|
this.parseClassPropertyAnnotation(node);
|
|
14002
14211
|
|
|
14003
|
-
if (this.state.isAmbientContext && this.match(29)) {
|
|
14212
|
+
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
|
|
14004
14213
|
this.raise(TSErrors.DeclareClassFieldHasInitializer, {
|
|
14005
14214
|
at: this.state.startLoc
|
|
14006
14215
|
});
|
|
@@ -14086,15 +14295,10 @@
|
|
|
14086
14295
|
}
|
|
14087
14296
|
}
|
|
14088
14297
|
|
|
14089
|
-
parseObjPropValue(prop) {
|
|
14298
|
+
parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
14090
14299
|
var typeParameters = this.tsTryParseTypeParameters();
|
|
14091
14300
|
if (typeParameters) prop.typeParameters = typeParameters;
|
|
14092
|
-
|
|
14093
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
14094
|
-
args[_key4 - 1] = arguments[_key4];
|
|
14095
|
-
}
|
|
14096
|
-
|
|
14097
|
-
super.parseObjPropValue(prop, ...args);
|
|
14301
|
+
return super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
|
|
14098
14302
|
}
|
|
14099
14303
|
|
|
14100
14304
|
parseFunctionParams(node, allowModifiers) {
|
|
@@ -14126,11 +14330,7 @@
|
|
|
14126
14330
|
return super.parseAsyncArrowFromCallExpression(node, call);
|
|
14127
14331
|
}
|
|
14128
14332
|
|
|
14129
|
-
parseMaybeAssign() {
|
|
14130
|
-
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
14131
|
-
args[_key5] = arguments[_key5];
|
|
14132
|
-
}
|
|
14133
|
-
|
|
14333
|
+
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
|
14134
14334
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
14135
14335
|
|
|
14136
14336
|
var state;
|
|
@@ -14139,7 +14339,7 @@
|
|
|
14139
14339
|
|
|
14140
14340
|
if (this.hasPlugin("jsx") && (this.match(138) || this.match(47))) {
|
|
14141
14341
|
state = this.state.clone();
|
|
14142
|
-
jsx = this.tryParse(() => super.parseMaybeAssign(
|
|
14342
|
+
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
14143
14343
|
if (!jsx.error) return jsx.node;
|
|
14144
14344
|
var {
|
|
14145
14345
|
context
|
|
@@ -14152,7 +14352,7 @@
|
|
|
14152
14352
|
}
|
|
14153
14353
|
|
|
14154
14354
|
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
|
|
14155
|
-
return super.parseMaybeAssign(
|
|
14355
|
+
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
14156
14356
|
}
|
|
14157
14357
|
|
|
14158
14358
|
if (!state || state === this.state) state = this.state.clone();
|
|
@@ -14161,7 +14361,7 @@
|
|
|
14161
14361
|
var _expr$extra, _typeParameters;
|
|
14162
14362
|
|
|
14163
14363
|
typeParameters = this.tsParseTypeParameters();
|
|
14164
|
-
var expr = super.parseMaybeAssign(
|
|
14364
|
+
var expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
14165
14365
|
|
|
14166
14366
|
if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
|
|
14167
14367
|
abort();
|
|
@@ -14182,7 +14382,7 @@
|
|
|
14182
14382
|
|
|
14183
14383
|
if (!jsx) {
|
|
14184
14384
|
assert(!this.hasPlugin("jsx"));
|
|
14185
|
-
typeCast = this.tryParse(() => super.parseMaybeAssign(
|
|
14385
|
+
typeCast = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
14186
14386
|
if (!typeCast.error) return typeCast.node;
|
|
14187
14387
|
}
|
|
14188
14388
|
|
|
@@ -14218,11 +14418,11 @@
|
|
|
14218
14418
|
}
|
|
14219
14419
|
}
|
|
14220
14420
|
|
|
14221
|
-
parseMaybeUnary(refExpressionErrors) {
|
|
14421
|
+
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
14222
14422
|
if (!this.hasPlugin("jsx") && this.match(47)) {
|
|
14223
14423
|
return this.tsParseTypeAssertion();
|
|
14224
14424
|
} else {
|
|
14225
|
-
return super.parseMaybeUnary(refExpressionErrors);
|
|
14425
|
+
return super.parseMaybeUnary(refExpressionErrors, sawUnary);
|
|
14226
14426
|
}
|
|
14227
14427
|
}
|
|
14228
14428
|
|
|
@@ -14388,8 +14588,8 @@
|
|
|
14388
14588
|
return this.match(35) || this.match(14) || super.isClassProperty();
|
|
14389
14589
|
}
|
|
14390
14590
|
|
|
14391
|
-
parseMaybeDefault() {
|
|
14392
|
-
var node = super.parseMaybeDefault(
|
|
14591
|
+
parseMaybeDefault(startPos, startLoc, left) {
|
|
14592
|
+
var node = super.parseMaybeDefault(startPos, startLoc, left);
|
|
14393
14593
|
|
|
14394
14594
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
14395
14595
|
this.raise(TSErrors.TypeAnnotationAfterAssign, {
|
|
@@ -14442,7 +14642,7 @@
|
|
|
14442
14642
|
return type;
|
|
14443
14643
|
}
|
|
14444
14644
|
|
|
14445
|
-
toAssignableList(exprList) {
|
|
14645
|
+
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
14446
14646
|
for (var i = 0; i < exprList.length; i++) {
|
|
14447
14647
|
var expr = exprList[i];
|
|
14448
14648
|
|
|
@@ -14451,7 +14651,7 @@
|
|
|
14451
14651
|
}
|
|
14452
14652
|
}
|
|
14453
14653
|
|
|
14454
|
-
super.toAssignableList(
|
|
14654
|
+
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
14455
14655
|
}
|
|
14456
14656
|
|
|
14457
14657
|
typeCastToParameter(node) {
|
|
@@ -14516,16 +14716,12 @@
|
|
|
14516
14716
|
}
|
|
14517
14717
|
}
|
|
14518
14718
|
|
|
14519
|
-
parseClass(node) {
|
|
14719
|
+
parseClass(node, isStatement, optionalId) {
|
|
14520
14720
|
var oldInAbstractClass = this.state.inAbstractClass;
|
|
14521
14721
|
this.state.inAbstractClass = !!node.abstract;
|
|
14522
14722
|
|
|
14523
14723
|
try {
|
|
14524
|
-
|
|
14525
|
-
args[_key6 - 1] = arguments[_key6];
|
|
14526
|
-
}
|
|
14527
|
-
|
|
14528
|
-
return super.parseClass(node, ...args);
|
|
14724
|
+
return super.parseClass(node, isStatement, optionalId);
|
|
14529
14725
|
} finally {
|
|
14530
14726
|
this.state.inAbstractClass = oldInAbstractClass;
|
|
14531
14727
|
}
|
|
@@ -14548,8 +14744,8 @@
|
|
|
14548
14744
|
}
|
|
14549
14745
|
}
|
|
14550
14746
|
|
|
14551
|
-
parseMethod() {
|
|
14552
|
-
var method = super.parseMethod(
|
|
14747
|
+
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
|
|
14748
|
+
var method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
|
14553
14749
|
|
|
14554
14750
|
if (method.abstract) {
|
|
14555
14751
|
var hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
|
|
@@ -14603,14 +14799,14 @@
|
|
|
14603
14799
|
return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
|
|
14604
14800
|
}
|
|
14605
14801
|
|
|
14606
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
14802
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
14607
14803
|
if (!importedIsString && isMaybeTypeOnly) {
|
|
14608
14804
|
this.parseTypeOnlyImportExportSpecifier(specifier, true, isInTypeOnlyImport);
|
|
14609
14805
|
return this.finishNode(specifier, "ImportSpecifier");
|
|
14610
14806
|
}
|
|
14611
14807
|
|
|
14612
14808
|
specifier.importKind = "value";
|
|
14613
|
-
return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly);
|
|
14809
|
+
return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, isInTypeOnlyImport ? BIND_TS_TYPE_IMPORT : BIND_FLAGS_TS_IMPORT);
|
|
14614
14810
|
}
|
|
14615
14811
|
|
|
14616
14812
|
parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) {
|
|
@@ -14678,7 +14874,7 @@
|
|
|
14678
14874
|
}
|
|
14679
14875
|
|
|
14680
14876
|
if (isImport) {
|
|
14681
|
-
this.checkIdentifier(node[rightOfAsKey],
|
|
14877
|
+
this.checkIdentifier(node[rightOfAsKey], hasTypeSpecifier ? BIND_TS_TYPE_IMPORT : BIND_FLAGS_TS_IMPORT);
|
|
14682
14878
|
}
|
|
14683
14879
|
}
|
|
14684
14880
|
|
|
@@ -14705,12 +14901,12 @@
|
|
|
14705
14901
|
return isUncomputedMemberExpressionChain(expression.object);
|
|
14706
14902
|
}
|
|
14707
14903
|
|
|
14708
|
-
var PlaceholderErrors = ParseErrorEnum(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["placeholders"])))(
|
|
14709
|
-
ClassNameIsRequired:
|
|
14710
|
-
UnexpectedSpace:
|
|
14711
|
-
})
|
|
14904
|
+
var PlaceholderErrors = ParseErrorEnum(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["placeholders"])))({
|
|
14905
|
+
ClassNameIsRequired: "A class name is required.",
|
|
14906
|
+
UnexpectedSpace: "Unexpected space in placeholder."
|
|
14907
|
+
});
|
|
14712
14908
|
|
|
14713
|
-
var placeholders = superClass => class extends superClass {
|
|
14909
|
+
var placeholders = superClass => class PlaceholdersParserMixin extends superClass {
|
|
14714
14910
|
parsePlaceholder(expectedNode) {
|
|
14715
14911
|
if (this.match(140)) {
|
|
14716
14912
|
var node = this.startNode();
|
|
@@ -14734,38 +14930,36 @@
|
|
|
14734
14930
|
return this.finishOp(140, 2);
|
|
14735
14931
|
}
|
|
14736
14932
|
|
|
14737
|
-
return super.getTokenFromCode(
|
|
14933
|
+
return super.getTokenFromCode(code);
|
|
14738
14934
|
}
|
|
14739
14935
|
|
|
14740
|
-
parseExprAtom() {
|
|
14741
|
-
return this.parsePlaceholder("Expression") || super.parseExprAtom(
|
|
14936
|
+
parseExprAtom(refExpressionErrors) {
|
|
14937
|
+
return this.parsePlaceholder("Expression") || super.parseExprAtom(refExpressionErrors);
|
|
14742
14938
|
}
|
|
14743
14939
|
|
|
14744
|
-
parseIdentifier() {
|
|
14745
|
-
return this.parsePlaceholder("Identifier") || super.parseIdentifier(
|
|
14940
|
+
parseIdentifier(liberal) {
|
|
14941
|
+
return this.parsePlaceholder("Identifier") || super.parseIdentifier(liberal);
|
|
14746
14942
|
}
|
|
14747
14943
|
|
|
14748
|
-
checkReservedWord(word) {
|
|
14749
|
-
if (word !== undefined)
|
|
14944
|
+
checkReservedWord(word, startLoc, checkKeywords, isBinding) {
|
|
14945
|
+
if (word !== undefined) {
|
|
14946
|
+
super.checkReservedWord(word, startLoc, checkKeywords, isBinding);
|
|
14947
|
+
}
|
|
14750
14948
|
}
|
|
14751
14949
|
|
|
14752
14950
|
parseBindingAtom() {
|
|
14753
|
-
return this.parsePlaceholder("Pattern") || super.parseBindingAtom(
|
|
14951
|
+
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
|
|
14754
14952
|
}
|
|
14755
14953
|
|
|
14756
|
-
isValidLVal(type) {
|
|
14757
|
-
|
|
14758
|
-
rest[_key7 - 1] = arguments[_key7];
|
|
14759
|
-
}
|
|
14760
|
-
|
|
14761
|
-
return type === "Placeholder" || super.isValidLVal(type, ...rest);
|
|
14954
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
14955
|
+
return type === "Placeholder" || super.isValidLVal(type, isParenthesized, binding);
|
|
14762
14956
|
}
|
|
14763
14957
|
|
|
14764
|
-
toAssignable(node) {
|
|
14958
|
+
toAssignable(node, isLHS) {
|
|
14765
14959
|
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
|
14766
14960
|
node.expectedNode = "Pattern";
|
|
14767
14961
|
} else {
|
|
14768
|
-
super.toAssignable(
|
|
14962
|
+
super.toAssignable(node, isLHS);
|
|
14769
14963
|
}
|
|
14770
14964
|
}
|
|
14771
14965
|
|
|
@@ -14788,21 +14982,21 @@
|
|
|
14788
14982
|
return false;
|
|
14789
14983
|
}
|
|
14790
14984
|
|
|
14791
|
-
verifyBreakContinue(node) {
|
|
14985
|
+
verifyBreakContinue(node, isBreak) {
|
|
14792
14986
|
if (node.label && node.label.type === "Placeholder") return;
|
|
14793
|
-
super.verifyBreakContinue(
|
|
14987
|
+
super.verifyBreakContinue(node, isBreak);
|
|
14794
14988
|
}
|
|
14795
14989
|
|
|
14796
14990
|
parseExpressionStatement(node, expr) {
|
|
14797
14991
|
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
|
|
14798
|
-
return super.parseExpressionStatement(
|
|
14992
|
+
return super.parseExpressionStatement(node, expr);
|
|
14799
14993
|
}
|
|
14800
14994
|
|
|
14801
14995
|
if (this.match(14)) {
|
|
14802
14996
|
var stmt = node;
|
|
14803
14997
|
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
|
14804
14998
|
this.next();
|
|
14805
|
-
stmt.body =
|
|
14999
|
+
stmt.body = super.parseStatement("label");
|
|
14806
15000
|
return this.finishNode(stmt, "LabeledStatement");
|
|
14807
15001
|
}
|
|
14808
15002
|
|
|
@@ -14811,12 +15005,12 @@
|
|
|
14811
15005
|
return this.finishPlaceholder(node, "Statement");
|
|
14812
15006
|
}
|
|
14813
15007
|
|
|
14814
|
-
parseBlock() {
|
|
14815
|
-
return this.parsePlaceholder("BlockStatement") || super.parseBlock(
|
|
15008
|
+
parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
|
|
15009
|
+
return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
|
|
14816
15010
|
}
|
|
14817
15011
|
|
|
14818
|
-
parseFunctionId() {
|
|
14819
|
-
return this.parsePlaceholder("Identifier") || super.parseFunctionId(
|
|
15012
|
+
parseFunctionId(requireId) {
|
|
15013
|
+
return this.parsePlaceholder("Identifier") || super.parseFunctionId(requireId);
|
|
14820
15014
|
}
|
|
14821
15015
|
|
|
14822
15016
|
parseClass(node, isStatement, optionalId) {
|
|
@@ -14842,14 +15036,14 @@
|
|
|
14842
15036
|
this.parseClassId(node, isStatement, optionalId);
|
|
14843
15037
|
}
|
|
14844
15038
|
|
|
14845
|
-
|
|
14846
|
-
node.body = this.parsePlaceholder("ClassBody") ||
|
|
15039
|
+
super.parseClassSuper(node);
|
|
15040
|
+
node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict);
|
|
14847
15041
|
return this.finishNode(node, type);
|
|
14848
15042
|
}
|
|
14849
15043
|
|
|
14850
15044
|
parseExport(node) {
|
|
14851
15045
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
14852
|
-
if (!placeholder) return super.parseExport(
|
|
15046
|
+
if (!placeholder) return super.parseExport(node);
|
|
14853
15047
|
|
|
14854
15048
|
if (!this.isContextual(97) && !this.match(12)) {
|
|
14855
15049
|
node.specifiers = [];
|
|
@@ -14884,7 +15078,7 @@
|
|
|
14884
15078
|
return true;
|
|
14885
15079
|
}
|
|
14886
15080
|
|
|
14887
|
-
return super.maybeParseExportDefaultSpecifier(
|
|
15081
|
+
return super.maybeParseExportDefaultSpecifier(node);
|
|
14888
15082
|
}
|
|
14889
15083
|
|
|
14890
15084
|
checkExport(node) {
|
|
@@ -14902,7 +15096,7 @@
|
|
|
14902
15096
|
|
|
14903
15097
|
parseImport(node) {
|
|
14904
15098
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
14905
|
-
if (!placeholder) return super.parseImport(
|
|
15099
|
+
if (!placeholder) return super.parseImport(node);
|
|
14906
15100
|
node.specifiers = [];
|
|
14907
15101
|
|
|
14908
15102
|
if (!this.isContextual(97) && !this.match(12)) {
|
|
@@ -14913,8 +15107,7 @@
|
|
|
14913
15107
|
|
|
14914
15108
|
var specifier = this.startNodeAtNode(placeholder);
|
|
14915
15109
|
specifier.local = placeholder;
|
|
14916
|
-
this.finishNode(specifier, "ImportDefaultSpecifier");
|
|
14917
|
-
node.specifiers.push(specifier);
|
|
15110
|
+
node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
|
|
14918
15111
|
|
|
14919
15112
|
if (this.eat(12)) {
|
|
14920
15113
|
var hasStarImport = this.maybeParseStarImportSpecifier(node);
|
|
@@ -14928,7 +15121,7 @@
|
|
|
14928
15121
|
}
|
|
14929
15122
|
|
|
14930
15123
|
parseImportSource() {
|
|
14931
|
-
return this.parsePlaceholder("StringLiteral") || super.parseImportSource(
|
|
15124
|
+
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
|
|
14932
15125
|
}
|
|
14933
15126
|
|
|
14934
15127
|
assertNoSpace() {
|
|
@@ -14941,7 +15134,7 @@
|
|
|
14941
15134
|
|
|
14942
15135
|
};
|
|
14943
15136
|
|
|
14944
|
-
var v8intrinsic = superClass => class extends superClass {
|
|
15137
|
+
var v8intrinsic = superClass => class V8IntrinsicMixin extends superClass {
|
|
14945
15138
|
parseV8Intrinsic() {
|
|
14946
15139
|
if (this.match(54)) {
|
|
14947
15140
|
var v8IntrinsicStartLoc = this.state.startLoc;
|
|
@@ -14962,8 +15155,8 @@
|
|
|
14962
15155
|
}
|
|
14963
15156
|
}
|
|
14964
15157
|
|
|
14965
|
-
parseExprAtom() {
|
|
14966
|
-
return this.parseV8Intrinsic() || super.parseExprAtom(
|
|
15158
|
+
parseExprAtom(refExpressionErrors) {
|
|
15159
|
+
return this.parseV8Intrinsic() || super.parseExprAtom(refExpressionErrors);
|
|
14967
15160
|
}
|
|
14968
15161
|
|
|
14969
15162
|
};
|
|
@@ -15002,7 +15195,7 @@
|
|
|
15002
15195
|
}
|
|
15003
15196
|
});
|
|
15004
15197
|
|
|
15005
|
-
if (plugin && Array.isArray(plugin)) {
|
|
15198
|
+
if (plugin && Array.isArray(plugin) && plugin.length > 1) {
|
|
15006
15199
|
return plugin[1][option];
|
|
15007
15200
|
}
|
|
15008
15201
|
|
|
@@ -15021,11 +15214,15 @@
|
|
|
15021
15214
|
|
|
15022
15215
|
var decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");
|
|
15023
15216
|
|
|
15024
|
-
if (decoratorsBeforeExport
|
|
15025
|
-
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'.");
|
|
15026
|
-
} else if (typeof decoratorsBeforeExport !== "boolean") {
|
|
15217
|
+
if (decoratorsBeforeExport != null && typeof decoratorsBeforeExport !== "boolean") {
|
|
15027
15218
|
throw new Error("'decoratorsBeforeExport' must be a boolean.");
|
|
15028
15219
|
}
|
|
15220
|
+
|
|
15221
|
+
var allowCallParenthesized = getPluginOption(plugins, "decorators", "allowCallParenthesized");
|
|
15222
|
+
|
|
15223
|
+
if (allowCallParenthesized != null && typeof allowCallParenthesized !== "boolean") {
|
|
15224
|
+
throw new Error("'allowCallParenthesized' must be a boolean.");
|
|
15225
|
+
}
|
|
15029
15226
|
}
|
|
15030
15227
|
|
|
15031
15228
|
if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
|
|
@@ -15086,8 +15283,8 @@
|
|
|
15086
15283
|
}
|
|
15087
15284
|
}
|
|
15088
15285
|
|
|
15089
|
-
if (hasPlugin(plugins, "recordAndTuple") && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
|
|
15090
|
-
throw new Error("
|
|
15286
|
+
if (hasPlugin(plugins, "recordAndTuple") && getPluginOption(plugins, "recordAndTuple", "syntaxType") != null && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
|
|
15287
|
+
throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => "'".concat(p, "'")).join(", "));
|
|
15091
15288
|
}
|
|
15092
15289
|
|
|
15093
15290
|
if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
|
|
@@ -15345,10 +15542,10 @@
|
|
|
15345
15542
|
}
|
|
15346
15543
|
}
|
|
15347
15544
|
|
|
15348
|
-
parseSpread(refExpressionErrors
|
|
15545
|
+
parseSpread(refExpressionErrors) {
|
|
15349
15546
|
var node = this.startNode();
|
|
15350
15547
|
this.next();
|
|
15351
|
-
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined
|
|
15548
|
+
node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, undefined);
|
|
15352
15549
|
return this.finishNode(node, "SpreadElement");
|
|
15353
15550
|
}
|
|
15354
15551
|
|
|
@@ -15444,8 +15641,7 @@
|
|
|
15444
15641
|
}
|
|
15445
15642
|
|
|
15446
15643
|
prop.method = false;
|
|
15447
|
-
this.parseObjPropValue(prop, startPos, startLoc, false, false, true, false);
|
|
15448
|
-
return prop;
|
|
15644
|
+
return this.parseObjPropValue(prop, startPos, startLoc, false, false, true, false);
|
|
15449
15645
|
}
|
|
15450
15646
|
|
|
15451
15647
|
parseAssignableListItem(allowModifiers, decorators) {
|
|
@@ -15488,7 +15684,7 @@
|
|
|
15488
15684
|
}, type);
|
|
15489
15685
|
}
|
|
15490
15686
|
|
|
15491
|
-
checkLVal(expression,
|
|
15687
|
+
checkLVal(expression, _ref89) {
|
|
15492
15688
|
var {
|
|
15493
15689
|
in: ancestor,
|
|
15494
15690
|
binding = BIND_NONE,
|
|
@@ -15496,7 +15692,7 @@
|
|
|
15496
15692
|
strictModeChanged = false,
|
|
15497
15693
|
allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
|
|
15498
15694
|
hasParenthesizedAncestor = false
|
|
15499
|
-
} =
|
|
15695
|
+
} = _ref89;
|
|
15500
15696
|
|
|
15501
15697
|
var _expression$extra;
|
|
15502
15698
|
|
|
@@ -15905,7 +16101,7 @@
|
|
|
15905
16101
|
}
|
|
15906
16102
|
|
|
15907
16103
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
15908
|
-
this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
16104
|
+
var finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
15909
16105
|
var nextOp = this.state.type;
|
|
15910
16106
|
|
|
15911
16107
|
if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
|
|
@@ -15914,7 +16110,7 @@
|
|
|
15914
16110
|
});
|
|
15915
16111
|
}
|
|
15916
16112
|
|
|
15917
|
-
return this.parseExprOp(
|
|
16113
|
+
return this.parseExprOp(finishedNode, leftStartPos, leftStartLoc, minPrec);
|
|
15918
16114
|
}
|
|
15919
16115
|
}
|
|
15920
16116
|
|
|
@@ -16039,7 +16235,10 @@
|
|
|
16039
16235
|
}
|
|
16040
16236
|
|
|
16041
16237
|
if (!update) {
|
|
16042
|
-
if (!sawUnary)
|
|
16238
|
+
if (!sawUnary) {
|
|
16239
|
+
this.checkExponentialAfterUnary(node);
|
|
16240
|
+
}
|
|
16241
|
+
|
|
16043
16242
|
return this.finishNode(node, "UnaryExpression");
|
|
16044
16243
|
}
|
|
16045
16244
|
}
|
|
@@ -16066,8 +16265,9 @@
|
|
|
16066
16265
|
|
|
16067
16266
|
parseUpdate(node, update, refExpressionErrors) {
|
|
16068
16267
|
if (update) {
|
|
16069
|
-
|
|
16070
|
-
|
|
16268
|
+
var updateExpressionNode = node;
|
|
16269
|
+
this.checkLVal(updateExpressionNode.argument, {
|
|
16270
|
+
in: this.finishNode(updateExpressionNode, "UpdateExpression")
|
|
16071
16271
|
});
|
|
16072
16272
|
return node;
|
|
16073
16273
|
}
|
|
@@ -16222,25 +16422,25 @@
|
|
|
16222
16422
|
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
|
|
16223
16423
|
}
|
|
16224
16424
|
|
|
16225
|
-
this.finishCallExpression(node, optionalChainMember);
|
|
16425
|
+
var finishedNode = this.finishCallExpression(node, optionalChainMember);
|
|
16226
16426
|
|
|
16227
16427
|
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
|
|
16228
16428
|
state.stop = true;
|
|
16229
16429
|
this.checkDestructuringPrivate(refExpressionErrors);
|
|
16230
16430
|
this.expressionScope.validateAsPattern();
|
|
16231
16431
|
this.expressionScope.exit();
|
|
16232
|
-
|
|
16432
|
+
finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), finishedNode);
|
|
16233
16433
|
} else {
|
|
16234
16434
|
if (maybeAsyncArrow) {
|
|
16235
16435
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
16236
16436
|
this.expressionScope.exit();
|
|
16237
16437
|
}
|
|
16238
16438
|
|
|
16239
|
-
this.toReferencedArguments(
|
|
16439
|
+
this.toReferencedArguments(finishedNode);
|
|
16240
16440
|
}
|
|
16241
16441
|
|
|
16242
16442
|
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
|
16243
|
-
return
|
|
16443
|
+
return finishedNode;
|
|
16244
16444
|
}
|
|
16245
16445
|
|
|
16246
16446
|
toReferencedArguments(node, isParenthesizedExpr) {
|
|
@@ -16652,8 +16852,7 @@
|
|
|
16652
16852
|
}
|
|
16653
16853
|
|
|
16654
16854
|
this.expect(19);
|
|
16655
|
-
this.parseArrowExpression(node, params, true);
|
|
16656
|
-
return node;
|
|
16855
|
+
return this.parseArrowExpression(node, params, true);
|
|
16657
16856
|
}
|
|
16658
16857
|
|
|
16659
16858
|
parseDo(node, isAsync) {
|
|
@@ -16905,8 +17104,7 @@
|
|
|
16905
17104
|
|
|
16906
17105
|
var parenExpression = this.startNodeAt(startPos, startLoc);
|
|
16907
17106
|
parenExpression.expression = expression;
|
|
16908
|
-
this.finishNode(parenExpression, "ParenthesizedExpression");
|
|
16909
|
-
return parenExpression;
|
|
17107
|
+
return this.finishNode(parenExpression, "ParenthesizedExpression");
|
|
16910
17108
|
}
|
|
16911
17109
|
|
|
16912
17110
|
shouldParseArrow(params) {
|
|
@@ -16989,7 +17187,7 @@
|
|
|
16989
17187
|
if (value === null) {
|
|
16990
17188
|
if (!isTagged) {
|
|
16991
17189
|
this.raise(Errors.InvalidEscapeSequenceTemplate, {
|
|
16992
|
-
at: createPositionWithColumnOffset(
|
|
17190
|
+
at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
|
|
16993
17191
|
});
|
|
16994
17192
|
}
|
|
16995
17193
|
}
|
|
@@ -17003,9 +17201,9 @@
|
|
|
17003
17201
|
};
|
|
17004
17202
|
elem.tail = isTail;
|
|
17005
17203
|
this.next();
|
|
17006
|
-
this.finishNode(elem, "TemplateElement");
|
|
17007
|
-
this.resetEndLocation(
|
|
17008
|
-
return
|
|
17204
|
+
var finishedNode = this.finishNode(elem, "TemplateElement");
|
|
17205
|
+
this.resetEndLocation(finishedNode, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
|
|
17206
|
+
return finishedNode;
|
|
17009
17207
|
}
|
|
17010
17208
|
|
|
17011
17209
|
parseTemplate(isTagged) {
|
|
@@ -17167,8 +17365,7 @@
|
|
|
17167
17365
|
}
|
|
17168
17366
|
}
|
|
17169
17367
|
|
|
17170
|
-
this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors);
|
|
17171
|
-
return prop;
|
|
17368
|
+
return this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, false, isAccessor, refExpressionErrors);
|
|
17172
17369
|
}
|
|
17173
17370
|
|
|
17174
17371
|
getGetterSetterExpectedParamCount(method) {
|
|
@@ -17200,9 +17397,9 @@
|
|
|
17200
17397
|
|
|
17201
17398
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
17202
17399
|
if (isAccessor) {
|
|
17203
|
-
this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
|
|
17204
|
-
this.checkGetterSetterParams(
|
|
17205
|
-
return
|
|
17400
|
+
var finishedProp = this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
|
|
17401
|
+
this.checkGetterSetterParams(finishedProp);
|
|
17402
|
+
return finishedProp;
|
|
17206
17403
|
}
|
|
17207
17404
|
|
|
17208
17405
|
if (isAsync || isGenerator || this.match(10)) {
|
|
@@ -17334,10 +17531,10 @@
|
|
|
17334
17531
|
this.scope.enter(SCOPE_FUNCTION | SCOPE_SUPER | (inClassScope ? SCOPE_CLASS : 0) | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
17335
17532
|
this.prodParam.enter(functionFlags(isAsync, node.generator));
|
|
17336
17533
|
this.parseFunctionParams(node, allowModifiers);
|
|
17337
|
-
this.parseFunctionBodyAndFinish(node, type, true);
|
|
17534
|
+
var finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
|
|
17338
17535
|
this.prodParam.exit();
|
|
17339
17536
|
this.scope.exit();
|
|
17340
|
-
return
|
|
17537
|
+
return finishedNode;
|
|
17341
17538
|
}
|
|
17342
17539
|
|
|
17343
17540
|
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
|
|
@@ -17387,7 +17584,7 @@
|
|
|
17387
17584
|
parseFunctionBodyAndFinish(node, type) {
|
|
17388
17585
|
var isMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
17389
17586
|
this.parseFunctionBody(node, false, isMethod);
|
|
17390
|
-
this.finishNode(node, type);
|
|
17587
|
+
return this.finishNode(node, type);
|
|
17391
17588
|
}
|
|
17392
17589
|
|
|
17393
17590
|
parseFunctionBody(node, allowExpression) {
|
|
@@ -17707,15 +17904,16 @@
|
|
|
17707
17904
|
}
|
|
17708
17905
|
|
|
17709
17906
|
parseSmartPipelineBodyInStyle(childExpr, startPos, startLoc) {
|
|
17710
|
-
var bodyNode = this.startNodeAt(startPos, startLoc);
|
|
17711
|
-
|
|
17712
17907
|
if (this.isSimpleReference(childExpr)) {
|
|
17908
|
+
var bodyNode = this.startNodeAt(startPos, startLoc);
|
|
17713
17909
|
bodyNode.callee = childExpr;
|
|
17714
17910
|
return this.finishNode(bodyNode, "PipelineBareFunction");
|
|
17715
17911
|
} else {
|
|
17912
|
+
var _bodyNode2 = this.startNodeAt(startPos, startLoc);
|
|
17913
|
+
|
|
17716
17914
|
this.checkSmartPipeTopicBodyEarlyErrors(startLoc);
|
|
17717
|
-
|
|
17718
|
-
return this.finishNode(
|
|
17915
|
+
_bodyNode2.expression = childExpr;
|
|
17916
|
+
return this.finishNode(_bodyNode2, "PipelineTopicExpression");
|
|
17719
17917
|
}
|
|
17720
17918
|
}
|
|
17721
17919
|
|
|
@@ -17852,7 +18050,7 @@
|
|
|
17852
18050
|
this.expectPlugin("moduleBlocks");
|
|
17853
18051
|
var node = this.startNode();
|
|
17854
18052
|
this.next();
|
|
17855
|
-
this.
|
|
18053
|
+
this.expect(5);
|
|
17856
18054
|
var revertScopes = this.initializeScopes(true);
|
|
17857
18055
|
this.enterInitialScopes();
|
|
17858
18056
|
var program = this.startNode();
|
|
@@ -18030,6 +18228,10 @@
|
|
|
18030
18228
|
}
|
|
18031
18229
|
}
|
|
18032
18230
|
|
|
18231
|
+
if (end === 135) {
|
|
18232
|
+
this.next();
|
|
18233
|
+
}
|
|
18234
|
+
|
|
18033
18235
|
return this.finishNode(program, "Program");
|
|
18034
18236
|
}
|
|
18035
18237
|
|
|
@@ -18224,7 +18426,7 @@
|
|
|
18224
18426
|
}
|
|
18225
18427
|
}
|
|
18226
18428
|
|
|
18227
|
-
this.assertModuleNodeAllowed(
|
|
18429
|
+
this.assertModuleNodeAllowed(result);
|
|
18228
18430
|
return result;
|
|
18229
18431
|
}
|
|
18230
18432
|
|
|
@@ -18318,6 +18520,14 @@
|
|
|
18318
18520
|
expr = this.parseExpression();
|
|
18319
18521
|
this.expect(11);
|
|
18320
18522
|
expr = this.wrapParenthesis(_startPos2, _startLoc2, expr);
|
|
18523
|
+
var paramsStartLoc = this.state.startLoc;
|
|
18524
|
+
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
18525
|
+
|
|
18526
|
+
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
18527
|
+
this.raise(Errors.DecoratorArgumentsOutsideParentheses, {
|
|
18528
|
+
at: paramsStartLoc
|
|
18529
|
+
});
|
|
18530
|
+
}
|
|
18321
18531
|
} else {
|
|
18322
18532
|
expr = this.parseIdentifier(false);
|
|
18323
18533
|
|
|
@@ -18325,13 +18535,21 @@
|
|
|
18325
18535
|
var _node11 = this.startNodeAt(startPos, startLoc);
|
|
18326
18536
|
|
|
18327
18537
|
_node11.object = expr;
|
|
18328
|
-
|
|
18538
|
+
|
|
18539
|
+
if (this.match(134)) {
|
|
18540
|
+
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
18541
|
+
_node11.property = this.parsePrivateName();
|
|
18542
|
+
} else {
|
|
18543
|
+
_node11.property = this.parseIdentifier(true);
|
|
18544
|
+
}
|
|
18545
|
+
|
|
18329
18546
|
_node11.computed = false;
|
|
18330
18547
|
expr = this.finishNode(_node11, "MemberExpression");
|
|
18331
18548
|
}
|
|
18549
|
+
|
|
18550
|
+
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
18332
18551
|
}
|
|
18333
18552
|
|
|
18334
|
-
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
18335
18553
|
this.state.decoratorStack.pop();
|
|
18336
18554
|
} else {
|
|
18337
18555
|
node.expression = this.parseExprSubscripts();
|
|
@@ -18435,12 +18653,12 @@
|
|
|
18435
18653
|
var isLet = startsWithLet && this.isLetKeyword();
|
|
18436
18654
|
|
|
18437
18655
|
if (this.match(74) || this.match(75) || isLet) {
|
|
18438
|
-
var
|
|
18439
|
-
|
|
18656
|
+
var initNode = this.startNode();
|
|
18440
18657
|
var kind = isLet ? "let" : this.state.value;
|
|
18441
18658
|
this.next();
|
|
18442
|
-
this.parseVar(
|
|
18443
|
-
|
|
18659
|
+
this.parseVar(initNode, true, kind);
|
|
18660
|
+
|
|
18661
|
+
var _init = this.finishNode(initNode, "VariableDeclaration");
|
|
18444
18662
|
|
|
18445
18663
|
if ((this.match(58) || this.isContextual(101)) && _init.declarations.length === 1) {
|
|
18446
18664
|
return this.parseForIn(node, _init, awaitAt);
|
|
@@ -18726,6 +18944,7 @@
|
|
|
18726
18944
|
}
|
|
18727
18945
|
|
|
18728
18946
|
this.parseBlockBody(node, allowDirectives, false, 8, afterBlockParse);
|
|
18947
|
+
this.next();
|
|
18729
18948
|
|
|
18730
18949
|
if (createNewLexicalScope) {
|
|
18731
18950
|
this.scope.exit();
|
|
@@ -18779,8 +18998,6 @@
|
|
|
18779
18998
|
if (!oldStrict) {
|
|
18780
18999
|
this.setStrict(false);
|
|
18781
19000
|
}
|
|
18782
|
-
|
|
18783
|
-
this.next();
|
|
18784
19001
|
}
|
|
18785
19002
|
|
|
18786
19003
|
parseFor(node, init) {
|
|
@@ -19229,6 +19446,7 @@
|
|
|
19229
19446
|
this.prodParam.enter(PARAM);
|
|
19230
19447
|
var body = member.body = [];
|
|
19231
19448
|
this.parseBlockOrModuleBlockBody(body, undefined, false, 8);
|
|
19449
|
+
this.next();
|
|
19232
19450
|
this.prodParam.exit();
|
|
19233
19451
|
this.scope.exit();
|
|
19234
19452
|
this.state.labels = oldLabels;
|
|
@@ -19736,11 +19954,11 @@
|
|
|
19736
19954
|
|
|
19737
19955
|
isJSONModuleImport(node) {
|
|
19738
19956
|
if (node.assertions != null) {
|
|
19739
|
-
return node.assertions.some(
|
|
19957
|
+
return node.assertions.some(_ref90 => {
|
|
19740
19958
|
var {
|
|
19741
19959
|
key,
|
|
19742
19960
|
value
|
|
19743
|
-
} =
|
|
19961
|
+
} = _ref90;
|
|
19744
19962
|
return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type");
|
|
19745
19963
|
});
|
|
19746
19964
|
}
|
|
@@ -19754,7 +19972,7 @@
|
|
|
19754
19972
|
specifiers
|
|
19755
19973
|
} = node;
|
|
19756
19974
|
|
|
19757
|
-
if (
|
|
19975
|
+
if (specifiers != null) {
|
|
19758
19976
|
var nonDefaultNamedSpecifier = specifiers.find(specifier => {
|
|
19759
19977
|
var imported;
|
|
19760
19978
|
|
|
@@ -19822,9 +20040,10 @@
|
|
|
19822
20040
|
}
|
|
19823
20041
|
|
|
19824
20042
|
finishImportSpecifier(specifier, type) {
|
|
20043
|
+
var bindingType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : BIND_LEXICAL;
|
|
19825
20044
|
this.checkLVal(specifier.local, {
|
|
19826
20045
|
in: specifier,
|
|
19827
|
-
binding:
|
|
20046
|
+
binding: bindingType
|
|
19828
20047
|
});
|
|
19829
20048
|
return this.finishNode(specifier, type);
|
|
19830
20049
|
}
|
|
@@ -19865,8 +20084,7 @@
|
|
|
19865
20084
|
}
|
|
19866
20085
|
|
|
19867
20086
|
node.value = this.parseStringLiteral(this.state.value);
|
|
19868
|
-
this.finishNode(node, "ImportAttribute");
|
|
19869
|
-
attrs.push(node);
|
|
20087
|
+
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
19870
20088
|
} while (this.eat(12));
|
|
19871
20089
|
|
|
19872
20090
|
return attrs;
|
|
@@ -19976,12 +20194,12 @@
|
|
|
19976
20194
|
var importedIsString = this.match(129);
|
|
19977
20195
|
var isMaybeTypeOnly = this.isContextual(126);
|
|
19978
20196
|
specifier.imported = this.parseModuleExportName();
|
|
19979
|
-
var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
|
|
20197
|
+
var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, undefined);
|
|
19980
20198
|
node.specifiers.push(importSpecifier);
|
|
19981
20199
|
}
|
|
19982
20200
|
}
|
|
19983
20201
|
|
|
19984
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
20202
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
19985
20203
|
if (this.eatContextual(93)) {
|
|
19986
20204
|
specifier.local = this.parseIdentifier();
|
|
19987
20205
|
} else {
|
|
@@ -20003,7 +20221,7 @@
|
|
|
20003
20221
|
}
|
|
20004
20222
|
}
|
|
20005
20223
|
|
|
20006
|
-
return this.finishImportSpecifier(specifier, "ImportSpecifier");
|
|
20224
|
+
return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType);
|
|
20007
20225
|
}
|
|
20008
20226
|
|
|
20009
20227
|
isThisParam(param) {
|