@vue/compiler-sfc 3.4.14 → 3.4.16
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/compiler-sfc.cjs.js +12 -8
- package/dist/compiler-sfc.d.ts +2 -0
- package/dist/compiler-sfc.esm-browser.js +604 -1054
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.4.
|
|
2
|
+
* @vue/compiler-sfc v3.4.16
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2266,8 +2266,10 @@ const ErrorCodes = {
|
|
|
2266
2266
|
"50": "X_SCOPE_ID_NOT_SUPPORTED",
|
|
2267
2267
|
"X_VNODE_HOOKS": 51,
|
|
2268
2268
|
"51": "X_VNODE_HOOKS",
|
|
2269
|
-
"
|
|
2270
|
-
"52": "
|
|
2269
|
+
"X_V_BIND_INVALID_SAME_NAME_ARGUMENT": 52,
|
|
2270
|
+
"52": "X_V_BIND_INVALID_SAME_NAME_ARGUMENT",
|
|
2271
|
+
"__EXTEND_POINT__": 53,
|
|
2272
|
+
"53": "__EXTEND_POINT__"
|
|
2271
2273
|
};
|
|
2272
2274
|
const errorMessages$1 = {
|
|
2273
2275
|
// parse errors
|
|
@@ -2308,6 +2310,7 @@ const errorMessages$1 = {
|
|
|
2308
2310
|
[32]: `v-for has invalid expression.`,
|
|
2309
2311
|
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
2310
2312
|
[34]: `v-bind is missing expression.`,
|
|
2313
|
+
[52]: `v-bind with same-name shorthand only allows static argument.`,
|
|
2311
2314
|
[35]: `v-on is missing expression.`,
|
|
2312
2315
|
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
2313
2316
|
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
@@ -2328,7 +2331,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2328
2331
|
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
2329
2332
|
[50]: `"scopeId" option is only supported in module mode.`,
|
|
2330
2333
|
// just to fulfill types
|
|
2331
|
-
[
|
|
2334
|
+
[53]: ``
|
|
2332
2335
|
};
|
|
2333
2336
|
|
|
2334
2337
|
function getDefaultExportFromCjs (x) {
|
|
@@ -2697,8 +2700,8 @@ var PipelineOperatorErrors = {
|
|
|
2697
2700
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
2698
2701
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
2699
2702
|
};
|
|
2700
|
-
const _excluded
|
|
2701
|
-
_excluded2
|
|
2703
|
+
const _excluded = ["toMessage"],
|
|
2704
|
+
_excluded2 = ["message"];
|
|
2702
2705
|
function defineHidden(obj, key, value) {
|
|
2703
2706
|
Object.defineProperty(obj, key, {
|
|
2704
2707
|
enumerable: false,
|
|
@@ -2710,11 +2713,8 @@ function toParseErrorConstructor(_ref) {
|
|
|
2710
2713
|
let {
|
|
2711
2714
|
toMessage
|
|
2712
2715
|
} = _ref,
|
|
2713
|
-
properties = _objectWithoutPropertiesLoose(_ref, _excluded
|
|
2714
|
-
return function constructor({
|
|
2715
|
-
loc,
|
|
2716
|
-
details
|
|
2717
|
-
}) {
|
|
2716
|
+
properties = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
2717
|
+
return function constructor(loc, details) {
|
|
2718
2718
|
const error = new SyntaxError();
|
|
2719
2719
|
Object.assign(error, properties, {
|
|
2720
2720
|
loc,
|
|
@@ -2732,10 +2732,7 @@ function toParseErrorConstructor(_ref) {
|
|
|
2732
2732
|
column,
|
|
2733
2733
|
index
|
|
2734
2734
|
} = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
|
|
2735
|
-
return constructor({
|
|
2736
|
-
loc: new Position(line, column, index),
|
|
2737
|
-
details: Object.assign({}, details, overrides.details)
|
|
2738
|
-
});
|
|
2735
|
+
return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
|
|
2739
2736
|
});
|
|
2740
2737
|
defineHidden(error, "details", details);
|
|
2741
2738
|
Object.defineProperty(error, "message", {
|
|
@@ -2770,7 +2767,7 @@ function ParseErrorEnum(argument, syntaxPlugin) {
|
|
|
2770
2767
|
{
|
|
2771
2768
|
message
|
|
2772
2769
|
} = _ref2,
|
|
2773
|
-
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2
|
|
2770
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
2774
2771
|
const toMessage = typeof message === "string" ? () => message : message;
|
|
2775
2772
|
ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
|
|
2776
2773
|
code: "BABEL_PARSER_SYNTAX_ERROR",
|
|
@@ -3015,13 +3012,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
|
3015
3012
|
}
|
|
3016
3013
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
3017
3014
|
if (prop.kind === "get" || prop.kind === "set") {
|
|
3018
|
-
this.raise(Errors.PatternHasAccessor,
|
|
3019
|
-
at: prop.key
|
|
3020
|
-
});
|
|
3015
|
+
this.raise(Errors.PatternHasAccessor, prop.key);
|
|
3021
3016
|
} else if (prop.method) {
|
|
3022
|
-
this.raise(Errors.PatternHasMethod,
|
|
3023
|
-
at: prop.key
|
|
3024
|
-
});
|
|
3017
|
+
this.raise(Errors.PatternHasMethod, prop.key);
|
|
3025
3018
|
} else {
|
|
3026
3019
|
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
3027
3020
|
}
|
|
@@ -3757,9 +3750,9 @@ function canBeReservedWord(word) {
|
|
|
3757
3750
|
}
|
|
3758
3751
|
class Scope {
|
|
3759
3752
|
constructor(flags) {
|
|
3760
|
-
this.
|
|
3761
|
-
this.
|
|
3762
|
-
this.
|
|
3753
|
+
this.flags = 0;
|
|
3754
|
+
this.names = new Map();
|
|
3755
|
+
this.firstLexicalName = "";
|
|
3763
3756
|
this.flags = flags;
|
|
3764
3757
|
}
|
|
3765
3758
|
}
|
|
@@ -3827,11 +3820,16 @@ class ScopeHandler {
|
|
|
3827
3820
|
let scope = this.currentScope();
|
|
3828
3821
|
if (bindingType & 8 || bindingType & 16) {
|
|
3829
3822
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
3823
|
+
let type = scope.names.get(name) || 0;
|
|
3830
3824
|
if (bindingType & 16) {
|
|
3831
|
-
|
|
3825
|
+
type = type | 4;
|
|
3832
3826
|
} else {
|
|
3833
|
-
scope.
|
|
3827
|
+
if (!scope.firstLexicalName) {
|
|
3828
|
+
scope.firstLexicalName = name;
|
|
3829
|
+
}
|
|
3830
|
+
type = type | 2;
|
|
3834
3831
|
}
|
|
3832
|
+
scope.names.set(name, type);
|
|
3835
3833
|
if (bindingType & 8) {
|
|
3836
3834
|
this.maybeExportDefined(scope, name);
|
|
3837
3835
|
}
|
|
@@ -3839,7 +3837,7 @@ class ScopeHandler {
|
|
|
3839
3837
|
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
3840
3838
|
scope = this.scopeStack[i];
|
|
3841
3839
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
3842
|
-
scope.
|
|
3840
|
+
scope.names.set(name, (scope.names.get(name) || 0) | 1);
|
|
3843
3841
|
this.maybeExportDefined(scope, name);
|
|
3844
3842
|
if (scope.flags & 387) break;
|
|
3845
3843
|
}
|
|
@@ -3855,8 +3853,7 @@ class ScopeHandler {
|
|
|
3855
3853
|
}
|
|
3856
3854
|
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
3857
3855
|
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
3858
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
3859
|
-
at: loc,
|
|
3856
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
3860
3857
|
identifierName: name
|
|
3861
3858
|
});
|
|
3862
3859
|
}
|
|
@@ -3864,19 +3861,20 @@ class ScopeHandler {
|
|
|
3864
3861
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
3865
3862
|
if (!(bindingType & 1)) return false;
|
|
3866
3863
|
if (bindingType & 8) {
|
|
3867
|
-
return scope.
|
|
3864
|
+
return scope.names.has(name);
|
|
3868
3865
|
}
|
|
3866
|
+
const type = scope.names.get(name);
|
|
3869
3867
|
if (bindingType & 16) {
|
|
3870
|
-
return
|
|
3868
|
+
return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
|
|
3871
3869
|
}
|
|
3872
|
-
return
|
|
3870
|
+
return (type & 2) > 0 && !(scope.flags & 8 && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & 4) > 0;
|
|
3873
3871
|
}
|
|
3874
3872
|
checkLocalExport(id) {
|
|
3875
3873
|
const {
|
|
3876
3874
|
name
|
|
3877
3875
|
} = id;
|
|
3878
3876
|
const topLevelScope = this.scopeStack[0];
|
|
3879
|
-
if (!topLevelScope.
|
|
3877
|
+
if (!topLevelScope.names.has(name)) {
|
|
3880
3878
|
this.undefinedExports.set(name, id.loc.start);
|
|
3881
3879
|
}
|
|
3882
3880
|
}
|
|
@@ -3926,8 +3924,9 @@ class FlowScopeHandler extends ScopeHandler {
|
|
|
3926
3924
|
}
|
|
3927
3925
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
3928
3926
|
if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
|
|
3929
|
-
if (bindingType & 2048) {
|
|
3930
|
-
|
|
3927
|
+
if (bindingType & 2048 && !scope.declareFunctions.has(name)) {
|
|
3928
|
+
const type = scope.names.get(name);
|
|
3929
|
+
return (type & 4) > 0 || (type & 2) > 0;
|
|
3931
3930
|
}
|
|
3932
3931
|
return false;
|
|
3933
3932
|
}
|
|
@@ -4000,7 +3999,12 @@ function adjustInnerComments(node, elements, commentWS) {
|
|
|
4000
3999
|
class CommentsParser extends BaseParser {
|
|
4001
4000
|
addComment(comment) {
|
|
4002
4001
|
if (this.filename) comment.loc.filename = this.filename;
|
|
4003
|
-
|
|
4002
|
+
const {
|
|
4003
|
+
commentsLen
|
|
4004
|
+
} = this.state;
|
|
4005
|
+
if (this.comments.length != commentsLen) this.comments.length = commentsLen;
|
|
4006
|
+
this.comments.push(comment);
|
|
4007
|
+
this.state.commentsLen++;
|
|
4004
4008
|
}
|
|
4005
4009
|
processComment(node) {
|
|
4006
4010
|
const {
|
|
@@ -4189,7 +4193,7 @@ function isWhitespace(code) {
|
|
|
4189
4193
|
}
|
|
4190
4194
|
class State {
|
|
4191
4195
|
constructor() {
|
|
4192
|
-
this.
|
|
4196
|
+
this.flags = 1024;
|
|
4193
4197
|
this.curLine = void 0;
|
|
4194
4198
|
this.lineStart = void 0;
|
|
4195
4199
|
this.startLoc = void 0;
|
|
@@ -4198,21 +4202,12 @@ class State {
|
|
|
4198
4202
|
this.potentialArrowAt = -1;
|
|
4199
4203
|
this.noArrowAt = [];
|
|
4200
4204
|
this.noArrowParamsConversionAt = [];
|
|
4201
|
-
this.maybeInArrowParameters = false;
|
|
4202
|
-
this.inType = false;
|
|
4203
|
-
this.noAnonFunctionType = false;
|
|
4204
|
-
this.hasFlowComment = false;
|
|
4205
|
-
this.isAmbientContext = false;
|
|
4206
|
-
this.inAbstractClass = false;
|
|
4207
|
-
this.inDisallowConditionalTypesContext = false;
|
|
4208
4205
|
this.topicContext = {
|
|
4209
4206
|
maxNumOfResolvableTopics: 0,
|
|
4210
4207
|
maxTopicIndex: null
|
|
4211
4208
|
};
|
|
4212
|
-
this.soloAwait = false;
|
|
4213
|
-
this.inFSharpPipelineDirectBody = false;
|
|
4214
4209
|
this.labels = [];
|
|
4215
|
-
this.
|
|
4210
|
+
this.commentsLen = 0;
|
|
4216
4211
|
this.commentStack = [];
|
|
4217
4212
|
this.pos = 0;
|
|
4218
4213
|
this.type = 139;
|
|
@@ -4221,14 +4216,21 @@ class State {
|
|
|
4221
4216
|
this.end = 0;
|
|
4222
4217
|
this.lastTokEndLoc = null;
|
|
4223
4218
|
this.lastTokStartLoc = null;
|
|
4224
|
-
this.lastTokStart = 0;
|
|
4225
4219
|
this.context = [types$1.brace];
|
|
4226
|
-
this.canStartJSXElement = true;
|
|
4227
|
-
this.containsEsc = false;
|
|
4228
4220
|
this.firstInvalidTemplateEscapePos = null;
|
|
4229
4221
|
this.strictErrors = new Map();
|
|
4230
4222
|
this.tokensLength = 0;
|
|
4231
4223
|
}
|
|
4224
|
+
get strict() {
|
|
4225
|
+
return (this.flags & 1) > 0;
|
|
4226
|
+
}
|
|
4227
|
+
set strict(value) {
|
|
4228
|
+
if (value) {
|
|
4229
|
+
this.flags |= 1;
|
|
4230
|
+
} else {
|
|
4231
|
+
this.flags &= ~1;
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4232
4234
|
init({
|
|
4233
4235
|
strictMode,
|
|
4234
4236
|
sourceType,
|
|
@@ -4240,20 +4242,145 @@ class State {
|
|
|
4240
4242
|
this.lineStart = -startColumn;
|
|
4241
4243
|
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
4242
4244
|
}
|
|
4245
|
+
get maybeInArrowParameters() {
|
|
4246
|
+
return (this.flags & 2) > 0;
|
|
4247
|
+
}
|
|
4248
|
+
set maybeInArrowParameters(value) {
|
|
4249
|
+
if (value) {
|
|
4250
|
+
this.flags |= 2;
|
|
4251
|
+
} else {
|
|
4252
|
+
this.flags &= ~2;
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
get inType() {
|
|
4256
|
+
return (this.flags & 4) > 0;
|
|
4257
|
+
}
|
|
4258
|
+
set inType(value) {
|
|
4259
|
+
if (value) {
|
|
4260
|
+
this.flags |= 4;
|
|
4261
|
+
} else {
|
|
4262
|
+
this.flags &= ~4;
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
get noAnonFunctionType() {
|
|
4266
|
+
return (this.flags & 8) > 0;
|
|
4267
|
+
}
|
|
4268
|
+
set noAnonFunctionType(value) {
|
|
4269
|
+
if (value) {
|
|
4270
|
+
this.flags |= 8;
|
|
4271
|
+
} else {
|
|
4272
|
+
this.flags &= ~8;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
get hasFlowComment() {
|
|
4276
|
+
return (this.flags & 16) > 0;
|
|
4277
|
+
}
|
|
4278
|
+
set hasFlowComment(value) {
|
|
4279
|
+
if (value) {
|
|
4280
|
+
this.flags |= 16;
|
|
4281
|
+
} else {
|
|
4282
|
+
this.flags &= ~16;
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
get isAmbientContext() {
|
|
4286
|
+
return (this.flags & 32) > 0;
|
|
4287
|
+
}
|
|
4288
|
+
set isAmbientContext(value) {
|
|
4289
|
+
if (value) {
|
|
4290
|
+
this.flags |= 32;
|
|
4291
|
+
} else {
|
|
4292
|
+
this.flags &= ~32;
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
get inAbstractClass() {
|
|
4296
|
+
return (this.flags & 64) > 0;
|
|
4297
|
+
}
|
|
4298
|
+
set inAbstractClass(value) {
|
|
4299
|
+
if (value) {
|
|
4300
|
+
this.flags |= 64;
|
|
4301
|
+
} else {
|
|
4302
|
+
this.flags &= ~64;
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
get inDisallowConditionalTypesContext() {
|
|
4306
|
+
return (this.flags & 128) > 0;
|
|
4307
|
+
}
|
|
4308
|
+
set inDisallowConditionalTypesContext(value) {
|
|
4309
|
+
if (value) {
|
|
4310
|
+
this.flags |= 128;
|
|
4311
|
+
} else {
|
|
4312
|
+
this.flags &= ~128;
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
get soloAwait() {
|
|
4316
|
+
return (this.flags & 256) > 0;
|
|
4317
|
+
}
|
|
4318
|
+
set soloAwait(value) {
|
|
4319
|
+
if (value) {
|
|
4320
|
+
this.flags |= 256;
|
|
4321
|
+
} else {
|
|
4322
|
+
this.flags &= ~256;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
get inFSharpPipelineDirectBody() {
|
|
4326
|
+
return (this.flags & 512) > 0;
|
|
4327
|
+
}
|
|
4328
|
+
set inFSharpPipelineDirectBody(value) {
|
|
4329
|
+
if (value) {
|
|
4330
|
+
this.flags |= 512;
|
|
4331
|
+
} else {
|
|
4332
|
+
this.flags &= ~512;
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
get canStartJSXElement() {
|
|
4336
|
+
return (this.flags & 1024) > 0;
|
|
4337
|
+
}
|
|
4338
|
+
set canStartJSXElement(value) {
|
|
4339
|
+
if (value) {
|
|
4340
|
+
this.flags |= 1024;
|
|
4341
|
+
} else {
|
|
4342
|
+
this.flags &= ~1024;
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
get containsEsc() {
|
|
4346
|
+
return (this.flags & 2048) > 0;
|
|
4347
|
+
}
|
|
4348
|
+
set containsEsc(value) {
|
|
4349
|
+
if (value) {
|
|
4350
|
+
this.flags |= 2048;
|
|
4351
|
+
} else {
|
|
4352
|
+
this.flags &= ~2048;
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4243
4355
|
curPosition() {
|
|
4244
4356
|
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
|
|
4245
4357
|
}
|
|
4246
|
-
clone(
|
|
4358
|
+
clone() {
|
|
4247
4359
|
const state = new State();
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4360
|
+
state.flags = this.flags;
|
|
4361
|
+
state.curLine = this.curLine;
|
|
4362
|
+
state.lineStart = this.lineStart;
|
|
4363
|
+
state.startLoc = this.startLoc;
|
|
4364
|
+
state.endLoc = this.endLoc;
|
|
4365
|
+
state.errors = this.errors.slice();
|
|
4366
|
+
state.potentialArrowAt = this.potentialArrowAt;
|
|
4367
|
+
state.noArrowAt = this.noArrowAt.slice();
|
|
4368
|
+
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
4369
|
+
state.topicContext = this.topicContext;
|
|
4370
|
+
state.labels = this.labels.slice();
|
|
4371
|
+
state.commentsLen = this.commentsLen;
|
|
4372
|
+
state.commentStack = this.commentStack.slice();
|
|
4373
|
+
state.pos = this.pos;
|
|
4374
|
+
state.type = this.type;
|
|
4375
|
+
state.value = this.value;
|
|
4376
|
+
state.start = this.start;
|
|
4377
|
+
state.end = this.end;
|
|
4378
|
+
state.lastTokEndLoc = this.lastTokEndLoc;
|
|
4379
|
+
state.lastTokStartLoc = this.lastTokStartLoc;
|
|
4380
|
+
state.context = this.context.slice();
|
|
4381
|
+
state.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos;
|
|
4382
|
+
state.strictErrors = this.strictErrors;
|
|
4383
|
+
state.tokensLength = this.tokensLength;
|
|
4257
4384
|
return state;
|
|
4258
4385
|
}
|
|
4259
4386
|
}
|
|
@@ -4542,8 +4669,6 @@ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
|
4542
4669
|
pos
|
|
4543
4670
|
};
|
|
4544
4671
|
}
|
|
4545
|
-
const _excluded = ["at"],
|
|
4546
|
-
_excluded2 = ["at"];
|
|
4547
4672
|
function buildPosition(pos, lineStart, curLine) {
|
|
4548
4673
|
return new Position(curLine, pos - lineStart, pos);
|
|
4549
4674
|
}
|
|
@@ -4565,8 +4690,7 @@ class Tokenizer extends CommentsParser {
|
|
|
4565
4690
|
this.errorHandlers_readInt = {
|
|
4566
4691
|
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
4567
4692
|
if (!this.options.errorRecovery) return false;
|
|
4568
|
-
this.raise(Errors.InvalidDigit, {
|
|
4569
|
-
at: buildPosition(pos, lineStart, curLine),
|
|
4693
|
+
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
|
|
4570
4694
|
radix
|
|
4571
4695
|
});
|
|
4572
4696
|
return true;
|
|
@@ -4580,28 +4704,23 @@ class Tokenizer extends CommentsParser {
|
|
|
4580
4704
|
});
|
|
4581
4705
|
this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
4582
4706
|
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
4583
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape,
|
|
4584
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
4585
|
-
});
|
|
4707
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
|
|
4586
4708
|
},
|
|
4587
4709
|
unterminated: (pos, lineStart, curLine) => {
|
|
4588
|
-
throw this.raise(Errors.UnterminatedString,
|
|
4589
|
-
at: buildPosition(pos - 1, lineStart, curLine)
|
|
4590
|
-
});
|
|
4710
|
+
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
|
|
4591
4711
|
}
|
|
4592
4712
|
});
|
|
4593
4713
|
this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
4594
4714
|
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
4595
4715
|
unterminated: (pos, lineStart, curLine) => {
|
|
4596
|
-
throw this.raise(Errors.UnterminatedTemplate,
|
|
4597
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
4598
|
-
});
|
|
4716
|
+
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
|
|
4599
4717
|
}
|
|
4600
4718
|
});
|
|
4601
4719
|
this.state = new State();
|
|
4602
4720
|
this.state.init(options);
|
|
4603
4721
|
this.input = input;
|
|
4604
4722
|
this.length = input.length;
|
|
4723
|
+
this.comments = [];
|
|
4605
4724
|
this.isLookahead = false;
|
|
4606
4725
|
}
|
|
4607
4726
|
pushToken(token) {
|
|
@@ -4614,7 +4733,6 @@ class Tokenizer extends CommentsParser {
|
|
|
4614
4733
|
if (this.options.tokens) {
|
|
4615
4734
|
this.pushToken(new Token(this.state));
|
|
4616
4735
|
}
|
|
4617
|
-
this.state.lastTokStart = this.state.start;
|
|
4618
4736
|
this.state.lastTokEndLoc = this.state.endLoc;
|
|
4619
4737
|
this.state.lastTokStartLoc = this.state.startLoc;
|
|
4620
4738
|
this.nextToken();
|
|
@@ -4689,9 +4807,7 @@ class Tokenizer extends CommentsParser {
|
|
|
4689
4807
|
setStrict(strict) {
|
|
4690
4808
|
this.state.strict = strict;
|
|
4691
4809
|
if (strict) {
|
|
4692
|
-
this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError,
|
|
4693
|
-
at
|
|
4694
|
-
}));
|
|
4810
|
+
this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
|
|
4695
4811
|
this.state.strictErrors.clear();
|
|
4696
4812
|
}
|
|
4697
4813
|
}
|
|
@@ -4714,9 +4830,7 @@ class Tokenizer extends CommentsParser {
|
|
|
4714
4830
|
const start = this.state.pos;
|
|
4715
4831
|
const end = this.input.indexOf(commentEnd, start + 2);
|
|
4716
4832
|
if (end === -1) {
|
|
4717
|
-
throw this.raise(Errors.UnterminatedComment,
|
|
4718
|
-
at: this.state.curPosition()
|
|
4719
|
-
});
|
|
4833
|
+
throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
4720
4834
|
}
|
|
4721
4835
|
this.state.pos = end + commentEnd.length;
|
|
4722
4836
|
lineBreakG.lastIndex = start + 2;
|
|
@@ -4868,16 +4982,12 @@ class Tokenizer extends CommentsParser {
|
|
|
4868
4982
|
const nextPos = this.state.pos + 1;
|
|
4869
4983
|
const next = this.codePointAtPos(nextPos);
|
|
4870
4984
|
if (next >= 48 && next <= 57) {
|
|
4871
|
-
throw this.raise(Errors.UnexpectedDigitAfterHash,
|
|
4872
|
-
at: this.state.curPosition()
|
|
4873
|
-
});
|
|
4985
|
+
throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
4874
4986
|
}
|
|
4875
4987
|
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
|
|
4876
4988
|
this.expectPlugin("recordAndTuple");
|
|
4877
4989
|
if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
|
|
4878
|
-
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType,
|
|
4879
|
-
at: this.state.curPosition()
|
|
4880
|
-
});
|
|
4990
|
+
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
|
|
4881
4991
|
}
|
|
4882
4992
|
this.state.pos += 2;
|
|
4883
4993
|
if (next === 123) {
|
|
@@ -4962,9 +5072,7 @@ class Tokenizer extends CommentsParser {
|
|
|
4962
5072
|
}
|
|
4963
5073
|
if (this.hasPlugin("recordAndTuple") && next === 125) {
|
|
4964
5074
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
4965
|
-
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType,
|
|
4966
|
-
at: this.state.curPosition()
|
|
4967
|
-
});
|
|
5075
|
+
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
|
|
4968
5076
|
}
|
|
4969
5077
|
this.state.pos += 2;
|
|
4970
5078
|
this.finishToken(9);
|
|
@@ -4972,9 +5080,7 @@ class Tokenizer extends CommentsParser {
|
|
|
4972
5080
|
}
|
|
4973
5081
|
if (this.hasPlugin("recordAndTuple") && next === 93) {
|
|
4974
5082
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
4975
|
-
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType,
|
|
4976
|
-
at: this.state.curPosition()
|
|
4977
|
-
});
|
|
5083
|
+
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
|
|
4978
5084
|
}
|
|
4979
5085
|
this.state.pos += 2;
|
|
4980
5086
|
this.finishToken(4);
|
|
@@ -5120,9 +5226,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5120
5226
|
case 91:
|
|
5121
5227
|
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
|
5122
5228
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
5123
|
-
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType,
|
|
5124
|
-
at: this.state.curPosition()
|
|
5125
|
-
});
|
|
5229
|
+
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
|
|
5126
5230
|
}
|
|
5127
5231
|
this.state.pos += 2;
|
|
5128
5232
|
this.finishToken(2);
|
|
@@ -5138,9 +5242,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5138
5242
|
case 123:
|
|
5139
5243
|
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
|
5140
5244
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
5141
|
-
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType,
|
|
5142
|
-
at: this.state.curPosition()
|
|
5143
|
-
});
|
|
5245
|
+
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
|
|
5144
5246
|
}
|
|
5145
5247
|
this.state.pos += 2;
|
|
5146
5248
|
this.finishToken(6);
|
|
@@ -5244,8 +5346,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5244
5346
|
return;
|
|
5245
5347
|
}
|
|
5246
5348
|
}
|
|
5247
|
-
throw this.raise(Errors.InvalidOrUnexpectedToken, {
|
|
5248
|
-
at: this.state.curPosition(),
|
|
5349
|
+
throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
|
|
5249
5350
|
unexpected: String.fromCodePoint(code)
|
|
5250
5351
|
});
|
|
5251
5352
|
}
|
|
@@ -5263,15 +5364,11 @@ class Tokenizer extends CommentsParser {
|
|
|
5263
5364
|
} = this.state;
|
|
5264
5365
|
for (;; ++pos) {
|
|
5265
5366
|
if (pos >= this.length) {
|
|
5266
|
-
throw this.raise(Errors.UnterminatedRegExp,
|
|
5267
|
-
at: createPositionWithColumnOffset(startLoc, 1)
|
|
5268
|
-
});
|
|
5367
|
+
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
5269
5368
|
}
|
|
5270
5369
|
const ch = this.input.charCodeAt(pos);
|
|
5271
5370
|
if (isNewLine(ch)) {
|
|
5272
|
-
throw this.raise(Errors.UnterminatedRegExp,
|
|
5273
|
-
at: createPositionWithColumnOffset(startLoc, 1)
|
|
5274
|
-
});
|
|
5371
|
+
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
5275
5372
|
}
|
|
5276
5373
|
if (escaped) {
|
|
5277
5374
|
escaped = false;
|
|
@@ -5296,26 +5393,18 @@ class Tokenizer extends CommentsParser {
|
|
|
5296
5393
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
5297
5394
|
if (cp === 118) {
|
|
5298
5395
|
if (mods.includes("u")) {
|
|
5299
|
-
this.raise(Errors.IncompatibleRegExpUVFlags,
|
|
5300
|
-
at: nextPos()
|
|
5301
|
-
});
|
|
5396
|
+
this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
5302
5397
|
}
|
|
5303
5398
|
} else if (cp === 117) {
|
|
5304
5399
|
if (mods.includes("v")) {
|
|
5305
|
-
this.raise(Errors.IncompatibleRegExpUVFlags,
|
|
5306
|
-
at: nextPos()
|
|
5307
|
-
});
|
|
5400
|
+
this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
5308
5401
|
}
|
|
5309
5402
|
}
|
|
5310
5403
|
if (mods.includes(char)) {
|
|
5311
|
-
this.raise(Errors.DuplicateRegExpFlags,
|
|
5312
|
-
at: nextPos()
|
|
5313
|
-
});
|
|
5404
|
+
this.raise(Errors.DuplicateRegExpFlags, nextPos());
|
|
5314
5405
|
}
|
|
5315
5406
|
} else if (isIdentifierChar(cp) || cp === 92) {
|
|
5316
|
-
this.raise(Errors.MalformedRegExpFlags,
|
|
5317
|
-
at: nextPos()
|
|
5318
|
-
});
|
|
5407
|
+
this.raise(Errors.MalformedRegExpFlags, nextPos());
|
|
5319
5408
|
} else {
|
|
5320
5409
|
break;
|
|
5321
5410
|
}
|
|
@@ -5342,8 +5431,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5342
5431
|
this.state.pos += 2;
|
|
5343
5432
|
const val = this.readInt(radix);
|
|
5344
5433
|
if (val == null) {
|
|
5345
|
-
this.raise(Errors.InvalidDigit, {
|
|
5346
|
-
at: createPositionWithColumnOffset(startLoc, 2),
|
|
5434
|
+
this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
|
|
5347
5435
|
radix
|
|
5348
5436
|
});
|
|
5349
5437
|
}
|
|
@@ -5352,14 +5440,10 @@ class Tokenizer extends CommentsParser {
|
|
|
5352
5440
|
++this.state.pos;
|
|
5353
5441
|
isBigInt = true;
|
|
5354
5442
|
} else if (next === 109) {
|
|
5355
|
-
throw this.raise(Errors.InvalidDecimal,
|
|
5356
|
-
at: startLoc
|
|
5357
|
-
});
|
|
5443
|
+
throw this.raise(Errors.InvalidDecimal, startLoc);
|
|
5358
5444
|
}
|
|
5359
5445
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
|
|
5360
|
-
throw this.raise(Errors.NumberIdentifier,
|
|
5361
|
-
at: this.state.curPosition()
|
|
5362
|
-
});
|
|
5446
|
+
throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
5363
5447
|
}
|
|
5364
5448
|
if (isBigInt) {
|
|
5365
5449
|
const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
|
|
@@ -5377,22 +5461,16 @@ class Tokenizer extends CommentsParser {
|
|
|
5377
5461
|
let hasExponent = false;
|
|
5378
5462
|
let isOctal = false;
|
|
5379
5463
|
if (!startsWithDot && this.readInt(10) === null) {
|
|
5380
|
-
this.raise(Errors.InvalidNumber,
|
|
5381
|
-
at: this.state.curPosition()
|
|
5382
|
-
});
|
|
5464
|
+
this.raise(Errors.InvalidNumber, this.state.curPosition());
|
|
5383
5465
|
}
|
|
5384
5466
|
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
5385
5467
|
if (hasLeadingZero) {
|
|
5386
5468
|
const integer = this.input.slice(start, this.state.pos);
|
|
5387
|
-
this.recordStrictModeErrors(Errors.StrictOctalLiteral,
|
|
5388
|
-
at: startLoc
|
|
5389
|
-
});
|
|
5469
|
+
this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
|
|
5390
5470
|
if (!this.state.strict) {
|
|
5391
5471
|
const underscorePos = integer.indexOf("_");
|
|
5392
5472
|
if (underscorePos > 0) {
|
|
5393
|
-
this.raise(Errors.ZeroDigitNumericSeparator,
|
|
5394
|
-
at: createPositionWithColumnOffset(startLoc, underscorePos)
|
|
5395
|
-
});
|
|
5473
|
+
this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
|
|
5396
5474
|
}
|
|
5397
5475
|
}
|
|
5398
5476
|
isOctal = hasLeadingZero && !/[89]/.test(integer);
|
|
@@ -5410,9 +5488,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5410
5488
|
++this.state.pos;
|
|
5411
5489
|
}
|
|
5412
5490
|
if (this.readInt(10) === null) {
|
|
5413
|
-
this.raise(Errors.InvalidOrMissingExponent,
|
|
5414
|
-
at: startLoc
|
|
5415
|
-
});
|
|
5491
|
+
this.raise(Errors.InvalidOrMissingExponent, startLoc);
|
|
5416
5492
|
}
|
|
5417
5493
|
isFloat = true;
|
|
5418
5494
|
hasExponent = true;
|
|
@@ -5420,9 +5496,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5420
5496
|
}
|
|
5421
5497
|
if (next === 110) {
|
|
5422
5498
|
if (isFloat || hasLeadingZero) {
|
|
5423
|
-
this.raise(Errors.InvalidBigIntLiteral,
|
|
5424
|
-
at: startLoc
|
|
5425
|
-
});
|
|
5499
|
+
this.raise(Errors.InvalidBigIntLiteral, startLoc);
|
|
5426
5500
|
}
|
|
5427
5501
|
++this.state.pos;
|
|
5428
5502
|
isBigInt = true;
|
|
@@ -5430,17 +5504,13 @@ class Tokenizer extends CommentsParser {
|
|
|
5430
5504
|
if (next === 109) {
|
|
5431
5505
|
this.expectPlugin("decimal", this.state.curPosition());
|
|
5432
5506
|
if (hasExponent || hasLeadingZero) {
|
|
5433
|
-
this.raise(Errors.InvalidDecimal,
|
|
5434
|
-
at: startLoc
|
|
5435
|
-
});
|
|
5507
|
+
this.raise(Errors.InvalidDecimal, startLoc);
|
|
5436
5508
|
}
|
|
5437
5509
|
++this.state.pos;
|
|
5438
5510
|
isDecimal = true;
|
|
5439
5511
|
}
|
|
5440
5512
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
|
|
5441
|
-
throw this.raise(Errors.NumberIdentifier,
|
|
5442
|
-
at: this.state.curPosition()
|
|
5443
|
-
});
|
|
5513
|
+
throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
5444
5514
|
}
|
|
5445
5515
|
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
5446
5516
|
if (isBigInt) {
|
|
@@ -5503,14 +5573,10 @@ class Tokenizer extends CommentsParser {
|
|
|
5503
5573
|
this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
|
|
5504
5574
|
}
|
|
5505
5575
|
}
|
|
5506
|
-
recordStrictModeErrors(toParseError, {
|
|
5507
|
-
at
|
|
5508
|
-
}) {
|
|
5576
|
+
recordStrictModeErrors(toParseError, at) {
|
|
5509
5577
|
const index = at.index;
|
|
5510
5578
|
if (this.state.strict && !this.state.strictErrors.has(index)) {
|
|
5511
|
-
this.raise(toParseError,
|
|
5512
|
-
at
|
|
5513
|
-
});
|
|
5579
|
+
this.raise(toParseError, at);
|
|
5514
5580
|
} else {
|
|
5515
5581
|
this.state.strictErrors.set(index, [toParseError, at]);
|
|
5516
5582
|
}
|
|
@@ -5533,9 +5599,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5533
5599
|
const escStart = this.state.curPosition();
|
|
5534
5600
|
const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
|
|
5535
5601
|
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
|
5536
|
-
this.raise(Errors.MissingUnicodeEscape,
|
|
5537
|
-
at: this.state.curPosition()
|
|
5538
|
-
});
|
|
5602
|
+
this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
|
|
5539
5603
|
chunkStart = this.state.pos - 1;
|
|
5540
5604
|
continue;
|
|
5541
5605
|
}
|
|
@@ -5543,9 +5607,7 @@ class Tokenizer extends CommentsParser {
|
|
|
5543
5607
|
const esc = this.readCodePoint(true);
|
|
5544
5608
|
if (esc !== null) {
|
|
5545
5609
|
if (!identifierCheck(esc)) {
|
|
5546
|
-
this.raise(Errors.EscapedCharNotAnIdentifier,
|
|
5547
|
-
at: escStart
|
|
5548
|
-
});
|
|
5610
|
+
this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
|
|
5549
5611
|
}
|
|
5550
5612
|
word += String.fromCodePoint(esc);
|
|
5551
5613
|
}
|
|
@@ -5570,75 +5632,55 @@ class Tokenizer extends CommentsParser {
|
|
|
5570
5632
|
type
|
|
5571
5633
|
} = this.state;
|
|
5572
5634
|
if (tokenIsKeyword(type) && this.state.containsEsc) {
|
|
5573
|
-
this.raise(Errors.InvalidEscapedReservedWord, {
|
|
5574
|
-
at: this.state.startLoc,
|
|
5635
|
+
this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
|
|
5575
5636
|
reservedWord: tokenLabelName(type)
|
|
5576
5637
|
});
|
|
5577
5638
|
}
|
|
5578
5639
|
}
|
|
5579
|
-
raise(toParseError,
|
|
5580
|
-
const {
|
|
5581
|
-
at
|
|
5582
|
-
} = raiseProperties,
|
|
5583
|
-
details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
|
|
5640
|
+
raise(toParseError, at, details = {}) {
|
|
5584
5641
|
const loc = at instanceof Position ? at : at.loc.start;
|
|
5585
|
-
const error = toParseError(
|
|
5586
|
-
loc,
|
|
5587
|
-
details
|
|
5588
|
-
});
|
|
5642
|
+
const error = toParseError(loc, details);
|
|
5589
5643
|
if (!this.options.errorRecovery) throw error;
|
|
5590
5644
|
if (!this.isLookahead) this.state.errors.push(error);
|
|
5591
5645
|
return error;
|
|
5592
5646
|
}
|
|
5593
|
-
raiseOverwrite(toParseError,
|
|
5594
|
-
const {
|
|
5595
|
-
at
|
|
5596
|
-
} = raiseProperties,
|
|
5597
|
-
details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
|
|
5647
|
+
raiseOverwrite(toParseError, at, details = {}) {
|
|
5598
5648
|
const loc = at instanceof Position ? at : at.loc.start;
|
|
5599
5649
|
const pos = loc.index;
|
|
5600
5650
|
const errors = this.state.errors;
|
|
5601
5651
|
for (let i = errors.length - 1; i >= 0; i--) {
|
|
5602
5652
|
const error = errors[i];
|
|
5603
5653
|
if (error.loc.index === pos) {
|
|
5604
|
-
return errors[i] = toParseError(
|
|
5605
|
-
loc,
|
|
5606
|
-
details
|
|
5607
|
-
});
|
|
5654
|
+
return errors[i] = toParseError(loc, details);
|
|
5608
5655
|
}
|
|
5609
5656
|
if (error.loc.index < pos) break;
|
|
5610
5657
|
}
|
|
5611
|
-
return this.raise(toParseError,
|
|
5658
|
+
return this.raise(toParseError, at, details);
|
|
5612
5659
|
}
|
|
5613
5660
|
updateContext(prevType) {}
|
|
5614
5661
|
unexpected(loc, type) {
|
|
5615
|
-
throw this.raise(Errors.UnexpectedToken, {
|
|
5616
|
-
expected: type ? tokenLabelName(type) : null
|
|
5617
|
-
at: loc != null ? loc : this.state.startLoc
|
|
5662
|
+
throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, {
|
|
5663
|
+
expected: type ? tokenLabelName(type) : null
|
|
5618
5664
|
});
|
|
5619
5665
|
}
|
|
5620
5666
|
expectPlugin(pluginName, loc) {
|
|
5621
5667
|
if (this.hasPlugin(pluginName)) {
|
|
5622
5668
|
return true;
|
|
5623
5669
|
}
|
|
5624
|
-
throw this.raise(Errors.MissingPlugin, {
|
|
5625
|
-
at: loc != null ? loc : this.state.startLoc,
|
|
5670
|
+
throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
|
|
5626
5671
|
missingPlugin: [pluginName]
|
|
5627
5672
|
});
|
|
5628
5673
|
}
|
|
5629
5674
|
expectOnePlugin(pluginNames) {
|
|
5630
5675
|
if (!pluginNames.some(name => this.hasPlugin(name))) {
|
|
5631
|
-
throw this.raise(Errors.MissingOneOfPlugins, {
|
|
5632
|
-
at: this.state.startLoc,
|
|
5676
|
+
throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
|
|
5633
5677
|
missingPlugin: pluginNames
|
|
5634
5678
|
});
|
|
5635
5679
|
}
|
|
5636
5680
|
}
|
|
5637
5681
|
errorBuilder(error) {
|
|
5638
5682
|
return (pos, lineStart, curLine) => {
|
|
5639
|
-
this.raise(error,
|
|
5640
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
5641
|
-
});
|
|
5683
|
+
this.raise(error, buildPosition(pos, lineStart, curLine));
|
|
5642
5684
|
};
|
|
5643
5685
|
}
|
|
5644
5686
|
}
|
|
@@ -5671,8 +5713,7 @@ class ClassScopeHandler {
|
|
|
5671
5713
|
current.undefinedPrivateNames.set(name, loc);
|
|
5672
5714
|
}
|
|
5673
5715
|
} else {
|
|
5674
|
-
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
|
|
5675
|
-
at: loc,
|
|
5716
|
+
this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
|
|
5676
5717
|
identifierName: name
|
|
5677
5718
|
});
|
|
5678
5719
|
}
|
|
@@ -5699,8 +5740,7 @@ class ClassScopeHandler {
|
|
|
5699
5740
|
}
|
|
5700
5741
|
}
|
|
5701
5742
|
if (redefined) {
|
|
5702
|
-
this.parser.raise(Errors.PrivateNameRedeclaration, {
|
|
5703
|
-
at: loc,
|
|
5743
|
+
this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
|
|
5704
5744
|
identifierName: name
|
|
5705
5745
|
});
|
|
5706
5746
|
}
|
|
@@ -5715,8 +5755,7 @@ class ClassScopeHandler {
|
|
|
5715
5755
|
if (classScope) {
|
|
5716
5756
|
classScope.undefinedPrivateNames.set(name, loc);
|
|
5717
5757
|
} else {
|
|
5718
|
-
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
|
|
5719
|
-
at: loc,
|
|
5758
|
+
this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
|
|
5720
5759
|
identifierName: name
|
|
5721
5760
|
});
|
|
5722
5761
|
}
|
|
@@ -5738,9 +5777,7 @@ class ArrowHeadParsingScope extends ExpressionScope {
|
|
|
5738
5777
|
super(type);
|
|
5739
5778
|
this.declarationErrors = new Map();
|
|
5740
5779
|
}
|
|
5741
|
-
recordDeclarationError(ParsingErrorClass, {
|
|
5742
|
-
at
|
|
5743
|
-
}) {
|
|
5780
|
+
recordDeclarationError(ParsingErrorClass, at) {
|
|
5744
5781
|
const index = at.index;
|
|
5745
5782
|
this.declarationErrors.set(index, [ParsingErrorClass, at]);
|
|
5746
5783
|
}
|
|
@@ -5763,12 +5800,8 @@ class ExpressionScopeHandler {
|
|
|
5763
5800
|
exit() {
|
|
5764
5801
|
this.stack.pop();
|
|
5765
5802
|
}
|
|
5766
|
-
recordParameterInitializerError(toParseError, {
|
|
5767
|
-
|
|
5768
|
-
}) {
|
|
5769
|
-
const origin = {
|
|
5770
|
-
at: node.loc.start
|
|
5771
|
-
};
|
|
5803
|
+
recordParameterInitializerError(toParseError, node) {
|
|
5804
|
+
const origin = node.loc.start;
|
|
5772
5805
|
const {
|
|
5773
5806
|
stack
|
|
5774
5807
|
} = this;
|
|
@@ -5784,16 +5817,12 @@ class ExpressionScopeHandler {
|
|
|
5784
5817
|
}
|
|
5785
5818
|
this.parser.raise(toParseError, origin);
|
|
5786
5819
|
}
|
|
5787
|
-
recordArrowParameterBindingError(error, {
|
|
5788
|
-
at: node
|
|
5789
|
-
}) {
|
|
5820
|
+
recordArrowParameterBindingError(error, node) {
|
|
5790
5821
|
const {
|
|
5791
5822
|
stack
|
|
5792
5823
|
} = this;
|
|
5793
5824
|
const scope = stack[stack.length - 1];
|
|
5794
|
-
const origin =
|
|
5795
|
-
at: node.loc.start
|
|
5796
|
-
};
|
|
5825
|
+
const origin = node.loc.start;
|
|
5797
5826
|
if (scope.isCertainlyParameterDeclaration()) {
|
|
5798
5827
|
this.parser.raise(error, origin);
|
|
5799
5828
|
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
@@ -5802,9 +5831,7 @@ class ExpressionScopeHandler {
|
|
|
5802
5831
|
return;
|
|
5803
5832
|
}
|
|
5804
5833
|
}
|
|
5805
|
-
recordAsyncArrowParametersError({
|
|
5806
|
-
at
|
|
5807
|
-
}) {
|
|
5834
|
+
recordAsyncArrowParametersError(at) {
|
|
5808
5835
|
const {
|
|
5809
5836
|
stack
|
|
5810
5837
|
} = this;
|
|
@@ -5812,9 +5839,7 @@ class ExpressionScopeHandler {
|
|
|
5812
5839
|
let scope = stack[i];
|
|
5813
5840
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
5814
5841
|
if (scope.type === 2) {
|
|
5815
|
-
scope.recordDeclarationError(Errors.AwaitBindingIdentifier,
|
|
5816
|
-
at
|
|
5817
|
-
});
|
|
5842
|
+
scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
5818
5843
|
}
|
|
5819
5844
|
scope = stack[--i];
|
|
5820
5845
|
}
|
|
@@ -5826,9 +5851,7 @@ class ExpressionScopeHandler {
|
|
|
5826
5851
|
const currentScope = stack[stack.length - 1];
|
|
5827
5852
|
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
5828
5853
|
currentScope.iterateErrors(([toParseError, loc]) => {
|
|
5829
|
-
this.parser.raise(toParseError,
|
|
5830
|
-
at: loc
|
|
5831
|
-
});
|
|
5854
|
+
this.parser.raise(toParseError, loc);
|
|
5832
5855
|
let i = stack.length - 2;
|
|
5833
5856
|
let scope = stack[i];
|
|
5834
5857
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
@@ -5917,9 +5940,7 @@ class UtilParser extends Tokenizer {
|
|
|
5917
5940
|
expectContextual(token, toParseError) {
|
|
5918
5941
|
if (!this.eatContextual(token)) {
|
|
5919
5942
|
if (toParseError != null) {
|
|
5920
|
-
throw this.raise(toParseError,
|
|
5921
|
-
at: this.state.startLoc
|
|
5922
|
-
});
|
|
5943
|
+
throw this.raise(toParseError, this.state.startLoc);
|
|
5923
5944
|
}
|
|
5924
5945
|
this.unexpected(null, token);
|
|
5925
5946
|
}
|
|
@@ -5939,9 +5960,7 @@ class UtilParser extends Tokenizer {
|
|
|
5939
5960
|
}
|
|
5940
5961
|
semicolon(allowAsi = true) {
|
|
5941
5962
|
if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
|
|
5942
|
-
this.raise(Errors.MissingSemicolon,
|
|
5943
|
-
at: this.state.lastTokEndLoc
|
|
5944
|
-
});
|
|
5963
|
+
this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
|
|
5945
5964
|
}
|
|
5946
5965
|
expect(type, loc) {
|
|
5947
5966
|
this.eat(type) || this.unexpected(loc, type);
|
|
@@ -6011,19 +6030,13 @@ class UtilParser extends Tokenizer {
|
|
|
6011
6030
|
return hasErrors;
|
|
6012
6031
|
}
|
|
6013
6032
|
if (shorthandAssignLoc != null) {
|
|
6014
|
-
this.raise(Errors.InvalidCoverInitializedName,
|
|
6015
|
-
at: shorthandAssignLoc
|
|
6016
|
-
});
|
|
6033
|
+
this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
6017
6034
|
}
|
|
6018
6035
|
if (doubleProtoLoc != null) {
|
|
6019
|
-
this.raise(Errors.DuplicateProto,
|
|
6020
|
-
at: doubleProtoLoc
|
|
6021
|
-
});
|
|
6036
|
+
this.raise(Errors.DuplicateProto, doubleProtoLoc);
|
|
6022
6037
|
}
|
|
6023
6038
|
if (privateKeyLoc != null) {
|
|
6024
|
-
this.raise(Errors.UnexpectedPrivateField,
|
|
6025
|
-
at: privateKeyLoc
|
|
6026
|
-
});
|
|
6039
|
+
this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
6027
6040
|
}
|
|
6028
6041
|
if (optionalParametersLoc != null) {
|
|
6029
6042
|
this.unexpected(optionalParametersLoc);
|
|
@@ -6176,7 +6189,8 @@ function cloneStringLiteral(node) {
|
|
|
6176
6189
|
}
|
|
6177
6190
|
class NodeUtils extends UtilParser {
|
|
6178
6191
|
startNode() {
|
|
6179
|
-
|
|
6192
|
+
const loc = this.state.startLoc;
|
|
6193
|
+
return new Node$5(this, loc.index, loc);
|
|
6180
6194
|
}
|
|
6181
6195
|
startNodeAt(loc) {
|
|
6182
6196
|
return new Node$5(this, loc.index, loc);
|
|
@@ -6372,10 +6386,8 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6372
6386
|
const moduloLoc = this.state.startLoc;
|
|
6373
6387
|
this.next();
|
|
6374
6388
|
this.expectContextual(110);
|
|
6375
|
-
if (this.state.
|
|
6376
|
-
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks,
|
|
6377
|
-
at: moduloLoc
|
|
6378
|
-
});
|
|
6389
|
+
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
|
|
6390
|
+
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
6379
6391
|
}
|
|
6380
6392
|
if (this.eat(10)) {
|
|
6381
6393
|
node.value = super.parseExpression();
|
|
@@ -6444,9 +6456,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6444
6456
|
return this.flowParseDeclareModuleExports(node);
|
|
6445
6457
|
} else {
|
|
6446
6458
|
if (insideModule) {
|
|
6447
|
-
this.raise(FlowErrors.NestedDeclareModule,
|
|
6448
|
-
at: this.state.lastTokStartLoc
|
|
6449
|
-
});
|
|
6459
|
+
this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
6450
6460
|
}
|
|
6451
6461
|
return this.flowParseDeclareModule(node);
|
|
6452
6462
|
}
|
|
@@ -6484,9 +6494,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6484
6494
|
if (this.match(83)) {
|
|
6485
6495
|
this.next();
|
|
6486
6496
|
if (!this.isContextual(130) && !this.match(87)) {
|
|
6487
|
-
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule,
|
|
6488
|
-
at: this.state.lastTokStartLoc
|
|
6489
|
-
});
|
|
6497
|
+
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
6490
6498
|
}
|
|
6491
6499
|
super.parseImport(bodyNode);
|
|
6492
6500
|
} else {
|
|
@@ -6503,21 +6511,15 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6503
6511
|
body.forEach(bodyElement => {
|
|
6504
6512
|
if (isEsModuleType(bodyElement)) {
|
|
6505
6513
|
if (kind === "CommonJS") {
|
|
6506
|
-
this.raise(FlowErrors.AmbiguousDeclareModuleKind,
|
|
6507
|
-
at: bodyElement
|
|
6508
|
-
});
|
|
6514
|
+
this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
6509
6515
|
}
|
|
6510
6516
|
kind = "ES";
|
|
6511
6517
|
} else if (bodyElement.type === "DeclareModuleExports") {
|
|
6512
6518
|
if (hasModuleExport) {
|
|
6513
|
-
this.raise(FlowErrors.DuplicateDeclareModuleExports,
|
|
6514
|
-
at: bodyElement
|
|
6515
|
-
});
|
|
6519
|
+
this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
|
|
6516
6520
|
}
|
|
6517
6521
|
if (kind === "ES") {
|
|
6518
|
-
this.raise(FlowErrors.AmbiguousDeclareModuleKind,
|
|
6519
|
-
at: bodyElement
|
|
6520
|
-
});
|
|
6522
|
+
this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
6521
6523
|
}
|
|
6522
6524
|
kind = "CommonJS";
|
|
6523
6525
|
hasModuleExport = true;
|
|
@@ -6540,8 +6542,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6540
6542
|
} else {
|
|
6541
6543
|
if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
|
|
6542
6544
|
const label = this.state.value;
|
|
6543
|
-
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
|
|
6544
|
-
at: this.state.startLoc,
|
|
6545
|
+
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
6545
6546
|
unsupportedExportKind: label,
|
|
6546
6547
|
suggestion: exportSuggestions[label]
|
|
6547
6548
|
});
|
|
@@ -6639,15 +6640,12 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6639
6640
|
}
|
|
6640
6641
|
checkNotUnderscore(word) {
|
|
6641
6642
|
if (word === "_") {
|
|
6642
|
-
this.raise(FlowErrors.UnexpectedReservedUnderscore,
|
|
6643
|
-
at: this.state.startLoc
|
|
6644
|
-
});
|
|
6643
|
+
this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
|
|
6645
6644
|
}
|
|
6646
6645
|
}
|
|
6647
6646
|
checkReservedType(word, startLoc, declaration) {
|
|
6648
6647
|
if (!reservedTypes.has(word)) return;
|
|
6649
|
-
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
|
|
6650
|
-
at: startLoc,
|
|
6648
|
+
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
|
|
6651
6649
|
reservedType: word
|
|
6652
6650
|
});
|
|
6653
6651
|
}
|
|
@@ -6700,9 +6698,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6700
6698
|
node.default = this.flowParseType();
|
|
6701
6699
|
} else {
|
|
6702
6700
|
if (requireDefault) {
|
|
6703
|
-
this.raise(FlowErrors.MissingTypeParamDefault,
|
|
6704
|
-
at: nodeStartLoc
|
|
6705
|
-
});
|
|
6701
|
+
this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
|
|
6706
6702
|
}
|
|
6707
6703
|
}
|
|
6708
6704
|
return this.finishNode(node, "TypeParameter");
|
|
@@ -6942,9 +6938,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6942
6938
|
}
|
|
6943
6939
|
this.flowObjectTypeSemicolon();
|
|
6944
6940
|
if (inexactStartLoc && !this.match(8) && !this.match(9)) {
|
|
6945
|
-
this.raise(FlowErrors.UnexpectedExplicitInexactInObject,
|
|
6946
|
-
at: inexactStartLoc
|
|
6947
|
-
});
|
|
6941
|
+
this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
|
|
6948
6942
|
}
|
|
6949
6943
|
}
|
|
6950
6944
|
this.expect(endDelim);
|
|
@@ -6960,33 +6954,23 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
6960
6954
|
const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
|
|
6961
6955
|
if (isInexactToken) {
|
|
6962
6956
|
if (!allowSpread) {
|
|
6963
|
-
this.raise(FlowErrors.InexactInsideNonObject,
|
|
6964
|
-
at: this.state.lastTokStartLoc
|
|
6965
|
-
});
|
|
6957
|
+
this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
|
|
6966
6958
|
} else if (!allowInexact) {
|
|
6967
|
-
this.raise(FlowErrors.InexactInsideExact,
|
|
6968
|
-
at: this.state.lastTokStartLoc
|
|
6969
|
-
});
|
|
6959
|
+
this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
|
|
6970
6960
|
}
|
|
6971
6961
|
if (variance) {
|
|
6972
|
-
this.raise(FlowErrors.InexactVariance,
|
|
6973
|
-
at: variance
|
|
6974
|
-
});
|
|
6962
|
+
this.raise(FlowErrors.InexactVariance, variance);
|
|
6975
6963
|
}
|
|
6976
6964
|
return null;
|
|
6977
6965
|
}
|
|
6978
6966
|
if (!allowSpread) {
|
|
6979
|
-
this.raise(FlowErrors.UnexpectedSpreadType,
|
|
6980
|
-
at: this.state.lastTokStartLoc
|
|
6981
|
-
});
|
|
6967
|
+
this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
|
|
6982
6968
|
}
|
|
6983
6969
|
if (protoStartLoc != null) {
|
|
6984
6970
|
this.unexpected(protoStartLoc);
|
|
6985
6971
|
}
|
|
6986
6972
|
if (variance) {
|
|
6987
|
-
this.raise(FlowErrors.SpreadVariance,
|
|
6988
|
-
at: variance
|
|
6989
|
-
});
|
|
6973
|
+
this.raise(FlowErrors.SpreadVariance, variance);
|
|
6990
6974
|
}
|
|
6991
6975
|
node.argument = this.flowParseType();
|
|
6992
6976
|
return this.finishNode(node, "ObjectTypeSpreadProperty");
|
|
@@ -7009,9 +6993,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7009
6993
|
this.flowCheckGetterSetterParams(node);
|
|
7010
6994
|
}
|
|
7011
6995
|
if (!allowSpread && node.key.name === "constructor" && node.value.this) {
|
|
7012
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
7013
|
-
at: node.value.this
|
|
7014
|
-
});
|
|
6996
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
|
|
7015
6997
|
}
|
|
7016
6998
|
} else {
|
|
7017
6999
|
if (kind !== "init") this.unexpected();
|
|
@@ -7030,19 +7012,13 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7030
7012
|
const paramCount = property.kind === "get" ? 0 : 1;
|
|
7031
7013
|
const length = property.value.params.length + (property.value.rest ? 1 : 0);
|
|
7032
7014
|
if (property.value.this) {
|
|
7033
|
-
this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam,
|
|
7034
|
-
at: property.value.this
|
|
7035
|
-
});
|
|
7015
|
+
this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
|
|
7036
7016
|
}
|
|
7037
7017
|
if (length !== paramCount) {
|
|
7038
|
-
this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity,
|
|
7039
|
-
at: property
|
|
7040
|
-
});
|
|
7018
|
+
this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
|
|
7041
7019
|
}
|
|
7042
7020
|
if (property.kind === "set" && property.value.rest) {
|
|
7043
|
-
this.raise(Errors.BadSetterRestParameter,
|
|
7044
|
-
at: property
|
|
7045
|
-
});
|
|
7021
|
+
this.raise(Errors.BadSetterRestParameter, property);
|
|
7046
7022
|
}
|
|
7047
7023
|
}
|
|
7048
7024
|
flowObjectTypeSemicolon() {
|
|
@@ -7098,17 +7074,13 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7098
7074
|
const isThis = this.state.type === 78;
|
|
7099
7075
|
if (lh.type === 14 || lh.type === 17) {
|
|
7100
7076
|
if (isThis && !first) {
|
|
7101
|
-
this.raise(FlowErrors.ThisParamMustBeFirst,
|
|
7102
|
-
at: node
|
|
7103
|
-
});
|
|
7077
|
+
this.raise(FlowErrors.ThisParamMustBeFirst, node);
|
|
7104
7078
|
}
|
|
7105
7079
|
name = this.parseIdentifier(isThis);
|
|
7106
7080
|
if (this.eat(17)) {
|
|
7107
7081
|
optional = true;
|
|
7108
7082
|
if (isThis) {
|
|
7109
|
-
this.raise(FlowErrors.ThisParamMayNotBeOptional,
|
|
7110
|
-
at: node
|
|
7111
|
-
});
|
|
7083
|
+
this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
|
|
7112
7084
|
}
|
|
7113
7085
|
}
|
|
7114
7086
|
typeAnnotation = this.flowParseTypeInitialiser();
|
|
@@ -7264,9 +7236,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7264
7236
|
if (this.match(135)) {
|
|
7265
7237
|
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
7266
7238
|
}
|
|
7267
|
-
throw this.raise(FlowErrors.UnexpectedSubtractionOperand,
|
|
7268
|
-
at: this.state.startLoc
|
|
7269
|
-
});
|
|
7239
|
+
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
7270
7240
|
}
|
|
7271
7241
|
this.unexpected();
|
|
7272
7242
|
return;
|
|
@@ -7530,9 +7500,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7530
7500
|
[valid, invalid] = this.getArrowLikeExpressions(consequent);
|
|
7531
7501
|
}
|
|
7532
7502
|
if (failed && valid.length > 1) {
|
|
7533
|
-
this.raise(FlowErrors.AmbiguousConditionalArrow,
|
|
7534
|
-
at: state.startLoc
|
|
7535
|
-
});
|
|
7503
|
+
this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
|
|
7536
7504
|
}
|
|
7537
7505
|
if (failed && valid.length === 1) {
|
|
7538
7506
|
this.state = state;
|
|
@@ -7693,13 +7661,9 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7693
7661
|
super.parseClassMember(classBody, member, state);
|
|
7694
7662
|
if (member.declare) {
|
|
7695
7663
|
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
|
|
7696
|
-
this.raise(FlowErrors.DeclareClassElement,
|
|
7697
|
-
at: startLoc
|
|
7698
|
-
});
|
|
7664
|
+
this.raise(FlowErrors.DeclareClassElement, startLoc);
|
|
7699
7665
|
} else if (member.value) {
|
|
7700
|
-
this.raise(FlowErrors.DeclareClassFieldInitializer,
|
|
7701
|
-
at: member.value
|
|
7702
|
-
});
|
|
7666
|
+
this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
|
|
7703
7667
|
}
|
|
7704
7668
|
}
|
|
7705
7669
|
}
|
|
@@ -7710,8 +7674,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7710
7674
|
const word = super.readWord1();
|
|
7711
7675
|
const fullWord = "@@" + word;
|
|
7712
7676
|
if (!this.isIterator(word) || !this.state.inType) {
|
|
7713
|
-
this.raise(Errors.InvalidIdentifier, {
|
|
7714
|
-
at: this.state.curPosition(),
|
|
7677
|
+
this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
|
|
7715
7678
|
identifierName: fullWord
|
|
7716
7679
|
});
|
|
7717
7680
|
}
|
|
@@ -7763,9 +7726,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7763
7726
|
var _expr$extra;
|
|
7764
7727
|
const expr = exprList[i];
|
|
7765
7728
|
if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
|
|
7766
|
-
this.raise(FlowErrors.TypeCastInPattern,
|
|
7767
|
-
at: expr.typeAnnotation
|
|
7768
|
-
});
|
|
7729
|
+
this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
|
|
7769
7730
|
}
|
|
7770
7731
|
}
|
|
7771
7732
|
return exprList;
|
|
@@ -7813,16 +7774,12 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7813
7774
|
if (method.params && isConstructor) {
|
|
7814
7775
|
const params = method.params;
|
|
7815
7776
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
7816
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
7817
|
-
at: method
|
|
7818
|
-
});
|
|
7777
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
7819
7778
|
}
|
|
7820
7779
|
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
|
|
7821
7780
|
const params = method.value.params;
|
|
7822
7781
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
7823
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
7824
|
-
at: method
|
|
7825
|
-
});
|
|
7782
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
7826
7783
|
}
|
|
7827
7784
|
}
|
|
7828
7785
|
}
|
|
@@ -7862,13 +7819,9 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7862
7819
|
if (params.length > 0) {
|
|
7863
7820
|
const param = params[0];
|
|
7864
7821
|
if (this.isThisParam(param) && method.kind === "get") {
|
|
7865
|
-
this.raise(FlowErrors.GetterMayNotHaveThisParam,
|
|
7866
|
-
at: param
|
|
7867
|
-
});
|
|
7822
|
+
this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
|
|
7868
7823
|
} else if (this.isThisParam(param)) {
|
|
7869
|
-
this.raise(FlowErrors.SetterMayNotHaveThisParam,
|
|
7870
|
-
at: param
|
|
7871
|
-
});
|
|
7824
|
+
this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
|
|
7872
7825
|
}
|
|
7873
7826
|
}
|
|
7874
7827
|
}
|
|
@@ -7894,28 +7847,20 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7894
7847
|
parseAssignableListItemTypes(param) {
|
|
7895
7848
|
if (this.eat(17)) {
|
|
7896
7849
|
if (param.type !== "Identifier") {
|
|
7897
|
-
this.raise(FlowErrors.PatternIsOptional,
|
|
7898
|
-
at: param
|
|
7899
|
-
});
|
|
7850
|
+
this.raise(FlowErrors.PatternIsOptional, param);
|
|
7900
7851
|
}
|
|
7901
7852
|
if (this.isThisParam(param)) {
|
|
7902
|
-
this.raise(FlowErrors.ThisParamMayNotBeOptional,
|
|
7903
|
-
at: param
|
|
7904
|
-
});
|
|
7853
|
+
this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
|
|
7905
7854
|
}
|
|
7906
7855
|
param.optional = true;
|
|
7907
7856
|
}
|
|
7908
7857
|
if (this.match(14)) {
|
|
7909
7858
|
param.typeAnnotation = this.flowParseTypeAnnotation();
|
|
7910
7859
|
} else if (this.isThisParam(param)) {
|
|
7911
|
-
this.raise(FlowErrors.ThisParamAnnotationRequired,
|
|
7912
|
-
at: param
|
|
7913
|
-
});
|
|
7860
|
+
this.raise(FlowErrors.ThisParamAnnotationRequired, param);
|
|
7914
7861
|
}
|
|
7915
7862
|
if (this.match(29) && this.isThisParam(param)) {
|
|
7916
|
-
this.raise(FlowErrors.ThisParamNoDefault,
|
|
7917
|
-
at: param
|
|
7918
|
-
});
|
|
7863
|
+
this.raise(FlowErrors.ThisParamNoDefault, param);
|
|
7919
7864
|
}
|
|
7920
7865
|
this.resetEndLocation(param);
|
|
7921
7866
|
return param;
|
|
@@ -7923,18 +7868,14 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7923
7868
|
parseMaybeDefault(startLoc, left) {
|
|
7924
7869
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
7925
7870
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
7926
|
-
this.raise(FlowErrors.TypeBeforeInitializer,
|
|
7927
|
-
at: node.typeAnnotation
|
|
7928
|
-
});
|
|
7871
|
+
this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
|
|
7929
7872
|
}
|
|
7930
7873
|
return node;
|
|
7931
7874
|
}
|
|
7932
7875
|
checkImportReflection(node) {
|
|
7933
7876
|
super.checkImportReflection(node);
|
|
7934
7877
|
if (node.module && node.importKind !== "value") {
|
|
7935
|
-
this.raise(FlowErrors.ImportReflectionHasImportType,
|
|
7936
|
-
at: node.specifiers[0].loc.start
|
|
7937
|
-
});
|
|
7878
|
+
this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
|
|
7938
7879
|
}
|
|
7939
7880
|
}
|
|
7940
7881
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -7990,8 +7931,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7990
7931
|
specifier.importKind = specifierTypeKind;
|
|
7991
7932
|
} else {
|
|
7992
7933
|
if (importedIsString) {
|
|
7993
|
-
throw this.raise(Errors.ImportBindingIsString, {
|
|
7994
|
-
at: specifier,
|
|
7934
|
+
throw this.raise(Errors.ImportBindingIsString, specifier, {
|
|
7995
7935
|
importName: firstIdent.value
|
|
7996
7936
|
});
|
|
7997
7937
|
}
|
|
@@ -8007,9 +7947,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8007
7947
|
}
|
|
8008
7948
|
const specifierIsTypeImport = hasTypeImportKind(specifier);
|
|
8009
7949
|
if (isInTypeOnlyImport && specifierIsTypeImport) {
|
|
8010
|
-
this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport,
|
|
8011
|
-
at: specifier
|
|
8012
|
-
});
|
|
7950
|
+
this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
|
|
8013
7951
|
}
|
|
8014
7952
|
if (isInTypeOnlyImport || specifierIsTypeImport) {
|
|
8015
7953
|
this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
|
|
@@ -8092,9 +8030,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8092
8030
|
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
8093
8031
|
if (!arrow.error && !arrow.aborted) {
|
|
8094
8032
|
if (arrow.node.async) {
|
|
8095
|
-
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction,
|
|
8096
|
-
at: typeParameters
|
|
8097
|
-
});
|
|
8033
|
+
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
|
|
8098
8034
|
}
|
|
8099
8035
|
return arrow.node;
|
|
8100
8036
|
}
|
|
@@ -8110,9 +8046,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8110
8046
|
}
|
|
8111
8047
|
if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
|
|
8112
8048
|
if (arrow.thrown) throw arrow.error;
|
|
8113
|
-
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter,
|
|
8114
|
-
at: typeParameters
|
|
8115
|
-
});
|
|
8049
|
+
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
|
|
8116
8050
|
}
|
|
8117
8051
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
8118
8052
|
}
|
|
@@ -8150,9 +8084,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8150
8084
|
}
|
|
8151
8085
|
for (let i = 0; i < node.params.length; i++) {
|
|
8152
8086
|
if (this.isThisParam(node.params[i]) && i > 0) {
|
|
8153
|
-
this.raise(FlowErrors.ThisParamMustBeFirst,
|
|
8154
|
-
at: node.params[i]
|
|
8155
|
-
});
|
|
8087
|
+
this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
|
|
8156
8088
|
}
|
|
8157
8089
|
}
|
|
8158
8090
|
super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
|
|
@@ -8254,18 +8186,14 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8254
8186
|
parseTopLevel(file, program) {
|
|
8255
8187
|
const fileNode = super.parseTopLevel(file, program);
|
|
8256
8188
|
if (this.state.hasFlowComment) {
|
|
8257
|
-
this.raise(FlowErrors.UnterminatedFlowComment,
|
|
8258
|
-
at: this.state.curPosition()
|
|
8259
|
-
});
|
|
8189
|
+
this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
|
|
8260
8190
|
}
|
|
8261
8191
|
return fileNode;
|
|
8262
8192
|
}
|
|
8263
8193
|
skipBlockComment() {
|
|
8264
8194
|
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
|
|
8265
8195
|
if (this.state.hasFlowComment) {
|
|
8266
|
-
throw this.raise(FlowErrors.NestedFlowComment,
|
|
8267
|
-
at: this.state.startLoc
|
|
8268
|
-
});
|
|
8196
|
+
throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
|
|
8269
8197
|
}
|
|
8270
8198
|
this.hasFlowCommentCompletion();
|
|
8271
8199
|
const commentSkip = this.skipFlowComment();
|
|
@@ -8301,43 +8229,26 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8301
8229
|
hasFlowCommentCompletion() {
|
|
8302
8230
|
const end = this.input.indexOf("*/", this.state.pos);
|
|
8303
8231
|
if (end === -1) {
|
|
8304
|
-
throw this.raise(Errors.UnterminatedComment,
|
|
8305
|
-
at: this.state.curPosition()
|
|
8306
|
-
});
|
|
8232
|
+
throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
8307
8233
|
}
|
|
8308
8234
|
}
|
|
8309
8235
|
flowEnumErrorBooleanMemberNotInitialized(loc, {
|
|
8310
8236
|
enumName,
|
|
8311
8237
|
memberName
|
|
8312
8238
|
}) {
|
|
8313
|
-
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
|
|
8314
|
-
at: loc,
|
|
8239
|
+
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
|
|
8315
8240
|
memberName,
|
|
8316
8241
|
enumName
|
|
8317
8242
|
});
|
|
8318
8243
|
}
|
|
8319
8244
|
flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
|
|
8320
|
-
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType,
|
|
8321
|
-
at: loc
|
|
8322
|
-
}, enumContext));
|
|
8245
|
+
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
|
|
8323
8246
|
}
|
|
8324
|
-
flowEnumErrorNumberMemberNotInitialized(loc, {
|
|
8325
|
-
|
|
8326
|
-
memberName
|
|
8327
|
-
}) {
|
|
8328
|
-
this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
|
|
8329
|
-
at: loc,
|
|
8330
|
-
enumName,
|
|
8331
|
-
memberName
|
|
8332
|
-
});
|
|
8247
|
+
flowEnumErrorNumberMemberNotInitialized(loc, details) {
|
|
8248
|
+
this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
|
|
8333
8249
|
}
|
|
8334
|
-
flowEnumErrorStringMemberInconsistentlyInitialized(node, {
|
|
8335
|
-
|
|
8336
|
-
}) {
|
|
8337
|
-
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, {
|
|
8338
|
-
at: node,
|
|
8339
|
-
enumName
|
|
8340
|
-
});
|
|
8250
|
+
flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
|
|
8251
|
+
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
|
|
8341
8252
|
}
|
|
8342
8253
|
flowEnumMemberInit() {
|
|
8343
8254
|
const startLoc = this.state.startLoc;
|
|
@@ -8446,16 +8357,14 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8446
8357
|
continue;
|
|
8447
8358
|
}
|
|
8448
8359
|
if (/^[a-z]/.test(memberName)) {
|
|
8449
|
-
this.raise(FlowErrors.EnumInvalidMemberName, {
|
|
8450
|
-
at: id,
|
|
8360
|
+
this.raise(FlowErrors.EnumInvalidMemberName, id, {
|
|
8451
8361
|
memberName,
|
|
8452
8362
|
suggestion: memberName[0].toUpperCase() + memberName.slice(1),
|
|
8453
8363
|
enumName
|
|
8454
8364
|
});
|
|
8455
8365
|
}
|
|
8456
8366
|
if (seenNames.has(memberName)) {
|
|
8457
|
-
this.raise(FlowErrors.EnumDuplicateMemberName, {
|
|
8458
|
-
at: id,
|
|
8367
|
+
this.raise(FlowErrors.EnumDuplicateMemberName, id, {
|
|
8459
8368
|
memberName,
|
|
8460
8369
|
enumName
|
|
8461
8370
|
});
|
|
@@ -8544,8 +8453,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8544
8453
|
}) {
|
|
8545
8454
|
if (!this.eatContextual(102)) return null;
|
|
8546
8455
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
8547
|
-
throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
|
|
8548
|
-
at: this.state.startLoc,
|
|
8456
|
+
throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
|
|
8549
8457
|
enumName
|
|
8550
8458
|
});
|
|
8551
8459
|
}
|
|
@@ -8554,8 +8462,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8554
8462
|
} = this.state;
|
|
8555
8463
|
this.next();
|
|
8556
8464
|
if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
|
|
8557
|
-
this.raise(FlowErrors.EnumInvalidExplicitType, {
|
|
8558
|
-
at: this.state.startLoc,
|
|
8465
|
+
this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
|
|
8559
8466
|
enumName,
|
|
8560
8467
|
invalidEnumType: value
|
|
8561
8468
|
});
|
|
@@ -8640,8 +8547,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
8640
8547
|
this.expect(8);
|
|
8641
8548
|
return this.finishNode(node, "EnumNumberBody");
|
|
8642
8549
|
} else {
|
|
8643
|
-
this.raise(FlowErrors.EnumInconsistentMemberValues, {
|
|
8644
|
-
at: nameLoc,
|
|
8550
|
+
this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
|
|
8645
8551
|
enumName
|
|
8646
8552
|
});
|
|
8647
8553
|
return empty();
|
|
@@ -8959,9 +8865,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
8959
8865
|
let chunkStart = this.state.pos;
|
|
8960
8866
|
for (;;) {
|
|
8961
8867
|
if (this.state.pos >= this.length) {
|
|
8962
|
-
throw this.raise(JsxErrors.UnterminatedJsxContent,
|
|
8963
|
-
at: this.state.startLoc
|
|
8964
|
-
});
|
|
8868
|
+
throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
|
|
8965
8869
|
}
|
|
8966
8870
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
8967
8871
|
switch (ch) {
|
|
@@ -9016,9 +8920,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9016
8920
|
let chunkStart = ++this.state.pos;
|
|
9017
8921
|
for (;;) {
|
|
9018
8922
|
if (this.state.pos >= this.length) {
|
|
9019
|
-
throw this.raise(Errors.UnterminatedString,
|
|
9020
|
-
at: this.state.startLoc
|
|
9021
|
-
});
|
|
8923
|
+
throw this.raise(Errors.UnterminatedString, this.state.startLoc);
|
|
9022
8924
|
}
|
|
9023
8925
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
9024
8926
|
if (ch === quote) break;
|
|
@@ -9121,18 +9023,14 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9121
9023
|
this.next();
|
|
9122
9024
|
node = this.jsxParseExpressionContainer(node, types$1.j_oTag);
|
|
9123
9025
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
9124
|
-
this.raise(JsxErrors.AttributeIsEmpty,
|
|
9125
|
-
at: node
|
|
9126
|
-
});
|
|
9026
|
+
this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
9127
9027
|
}
|
|
9128
9028
|
return node;
|
|
9129
9029
|
case 142:
|
|
9130
9030
|
case 133:
|
|
9131
9031
|
return this.parseExprAtom();
|
|
9132
9032
|
default:
|
|
9133
|
-
throw this.raise(JsxErrors.UnsupportedJsxValue,
|
|
9134
|
-
at: this.state.startLoc
|
|
9135
|
-
});
|
|
9033
|
+
throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
9136
9034
|
}
|
|
9137
9035
|
}
|
|
9138
9036
|
jsxParseEmptyExpression() {
|
|
@@ -9239,18 +9137,14 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9239
9137
|
}
|
|
9240
9138
|
}
|
|
9241
9139
|
if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
|
|
9242
|
-
this.raise(JsxErrors.MissingClosingTagFragment,
|
|
9243
|
-
at: closingElement
|
|
9244
|
-
});
|
|
9140
|
+
this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
|
|
9245
9141
|
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
|
9246
|
-
this.raise(JsxErrors.MissingClosingTagElement, {
|
|
9247
|
-
at: closingElement,
|
|
9142
|
+
this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
|
|
9248
9143
|
openingTagName: getQualifiedJSXName(openingElement.name)
|
|
9249
9144
|
});
|
|
9250
9145
|
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
|
9251
9146
|
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
|
9252
|
-
this.raise(JsxErrors.MissingClosingTagElement, {
|
|
9253
|
-
at: closingElement,
|
|
9147
|
+
this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
|
|
9254
9148
|
openingTagName: getQualifiedJSXName(openingElement.name)
|
|
9255
9149
|
});
|
|
9256
9150
|
}
|
|
@@ -9265,9 +9159,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9265
9159
|
}
|
|
9266
9160
|
node.children = children;
|
|
9267
9161
|
if (this.match(47)) {
|
|
9268
|
-
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements,
|
|
9269
|
-
at: this.state.startLoc
|
|
9270
|
-
});
|
|
9162
|
+
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
|
|
9271
9163
|
}
|
|
9272
9164
|
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
|
9273
9165
|
}
|
|
@@ -9353,11 +9245,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9353
9245
|
class TypeScriptScope extends Scope {
|
|
9354
9246
|
constructor(...args) {
|
|
9355
9247
|
super(...args);
|
|
9356
|
-
this.
|
|
9357
|
-
this.enums = new Set();
|
|
9358
|
-
this.constEnums = new Set();
|
|
9359
|
-
this.classes = new Set();
|
|
9360
|
-
this.exportOnlyBindings = new Set();
|
|
9248
|
+
this.tsNames = new Map();
|
|
9361
9249
|
}
|
|
9362
9250
|
}
|
|
9363
9251
|
class TypeScriptScopeHandler extends ScopeHandler {
|
|
@@ -9397,8 +9285,7 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
9397
9285
|
declareName(name, bindingType, loc) {
|
|
9398
9286
|
if (bindingType & 4096) {
|
|
9399
9287
|
if (this.hasImport(name, true)) {
|
|
9400
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
9401
|
-
at: loc,
|
|
9288
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
9402
9289
|
identifierName: name
|
|
9403
9290
|
});
|
|
9404
9291
|
}
|
|
@@ -9406,9 +9293,10 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
9406
9293
|
return;
|
|
9407
9294
|
}
|
|
9408
9295
|
const scope = this.currentScope();
|
|
9296
|
+
let type = scope.tsNames.get(name) || 0;
|
|
9409
9297
|
if (bindingType & 1024) {
|
|
9410
9298
|
this.maybeExportDefined(scope, name);
|
|
9411
|
-
scope.
|
|
9299
|
+
scope.tsNames.set(name, type | 16);
|
|
9412
9300
|
return;
|
|
9413
9301
|
}
|
|
9414
9302
|
super.declareName(name, bindingType, loc);
|
|
@@ -9417,31 +9305,37 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
9417
9305
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
9418
9306
|
this.maybeExportDefined(scope, name);
|
|
9419
9307
|
}
|
|
9420
|
-
|
|
9308
|
+
type = type | 1;
|
|
9309
|
+
}
|
|
9310
|
+
if (bindingType & 256) {
|
|
9311
|
+
type = type | 2;
|
|
9421
9312
|
}
|
|
9422
|
-
if (bindingType & 256) scope.enums.add(name);
|
|
9423
9313
|
if (bindingType & 512) {
|
|
9424
|
-
|
|
9314
|
+
type = type | 4;
|
|
9315
|
+
}
|
|
9316
|
+
if (bindingType & 128) {
|
|
9317
|
+
type = type | 8;
|
|
9425
9318
|
}
|
|
9426
|
-
if (
|
|
9319
|
+
if (type) scope.tsNames.set(name, type);
|
|
9427
9320
|
}
|
|
9428
9321
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
9429
|
-
|
|
9322
|
+
const type = scope.tsNames.get(name);
|
|
9323
|
+
if ((type & 2) > 0) {
|
|
9430
9324
|
if (bindingType & 256) {
|
|
9431
9325
|
const isConst = !!(bindingType & 512);
|
|
9432
|
-
const wasConst =
|
|
9326
|
+
const wasConst = (type & 4) > 0;
|
|
9433
9327
|
return isConst !== wasConst;
|
|
9434
9328
|
}
|
|
9435
9329
|
return true;
|
|
9436
9330
|
}
|
|
9437
|
-
if (bindingType & 128 &&
|
|
9438
|
-
if (scope.
|
|
9331
|
+
if (bindingType & 128 && (type & 8) > 0) {
|
|
9332
|
+
if (scope.names.get(name) & 2) {
|
|
9439
9333
|
return !!(bindingType & 1);
|
|
9440
9334
|
} else {
|
|
9441
9335
|
return false;
|
|
9442
9336
|
}
|
|
9443
9337
|
}
|
|
9444
|
-
if (bindingType & 2 &&
|
|
9338
|
+
if (bindingType & 2 && (type & 1) > 0) {
|
|
9445
9339
|
return true;
|
|
9446
9340
|
}
|
|
9447
9341
|
return super.isRedeclaredInScope(scope, name, bindingType);
|
|
@@ -9454,7 +9348,10 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
9454
9348
|
const len = this.scopeStack.length;
|
|
9455
9349
|
for (let i = len - 1; i >= 0; i--) {
|
|
9456
9350
|
const scope = this.scopeStack[i];
|
|
9457
|
-
|
|
9351
|
+
const type = scope.tsNames.get(name);
|
|
9352
|
+
if ((type & 1) > 0 || (type & 16) > 0) {
|
|
9353
|
+
return;
|
|
9354
|
+
}
|
|
9458
9355
|
}
|
|
9459
9356
|
super.checkLocalExport(id);
|
|
9460
9357
|
}
|
|
@@ -9471,18 +9368,12 @@ class LValParser extends NodeUtils {
|
|
|
9471
9368
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
9472
9369
|
if (isLHS) {
|
|
9473
9370
|
if (parenthesized.type === "Identifier") {
|
|
9474
|
-
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment,
|
|
9475
|
-
at: node
|
|
9476
|
-
});
|
|
9371
|
+
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
|
|
9477
9372
|
} else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
|
|
9478
|
-
this.raise(Errors.InvalidParenthesizedAssignment,
|
|
9479
|
-
at: node
|
|
9480
|
-
});
|
|
9373
|
+
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
9481
9374
|
}
|
|
9482
9375
|
} else {
|
|
9483
|
-
this.raise(Errors.InvalidParenthesizedAssignment,
|
|
9484
|
-
at: node
|
|
9485
|
-
});
|
|
9376
|
+
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
9486
9377
|
}
|
|
9487
9378
|
}
|
|
9488
9379
|
switch (node.type) {
|
|
@@ -9500,9 +9391,7 @@ class LValParser extends NodeUtils {
|
|
|
9500
9391
|
const isLast = i === last;
|
|
9501
9392
|
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
9502
9393
|
if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
|
|
9503
|
-
this.raise(Errors.RestTrailingComma,
|
|
9504
|
-
at: node.extra.trailingCommaLoc
|
|
9505
|
-
});
|
|
9394
|
+
this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
|
|
9506
9395
|
}
|
|
9507
9396
|
}
|
|
9508
9397
|
break;
|
|
@@ -9528,9 +9417,7 @@ class LValParser extends NodeUtils {
|
|
|
9528
9417
|
break;
|
|
9529
9418
|
case "AssignmentExpression":
|
|
9530
9419
|
if (node.operator !== "=") {
|
|
9531
|
-
this.raise(Errors.MissingEqInAssignment,
|
|
9532
|
-
at: node.left.loc.end
|
|
9533
|
-
});
|
|
9420
|
+
this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
|
|
9534
9421
|
}
|
|
9535
9422
|
node.type = "AssignmentPattern";
|
|
9536
9423
|
delete node.operator;
|
|
@@ -9543,18 +9430,14 @@ class LValParser extends NodeUtils {
|
|
|
9543
9430
|
}
|
|
9544
9431
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
9545
9432
|
if (prop.type === "ObjectMethod") {
|
|
9546
|
-
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod,
|
|
9547
|
-
at: prop.key
|
|
9548
|
-
});
|
|
9433
|
+
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
|
|
9549
9434
|
} else if (prop.type === "SpreadElement") {
|
|
9550
9435
|
prop.type = "RestElement";
|
|
9551
9436
|
const arg = prop.argument;
|
|
9552
9437
|
this.checkToRestConversion(arg, false);
|
|
9553
9438
|
this.toAssignable(arg, isLHS);
|
|
9554
9439
|
if (!isLast) {
|
|
9555
|
-
this.raise(Errors.RestTrailingComma,
|
|
9556
|
-
at: prop
|
|
9557
|
-
});
|
|
9440
|
+
this.raise(Errors.RestTrailingComma, prop);
|
|
9558
9441
|
}
|
|
9559
9442
|
} else {
|
|
9560
9443
|
this.toAssignable(prop, isLHS);
|
|
@@ -9575,13 +9458,9 @@ class LValParser extends NodeUtils {
|
|
|
9575
9458
|
}
|
|
9576
9459
|
if (elt.type === "RestElement") {
|
|
9577
9460
|
if (i < end) {
|
|
9578
|
-
this.raise(Errors.RestTrailingComma,
|
|
9579
|
-
at: elt
|
|
9580
|
-
});
|
|
9461
|
+
this.raise(Errors.RestTrailingComma, elt);
|
|
9581
9462
|
} else if (trailingCommaLoc) {
|
|
9582
|
-
this.raise(Errors.RestTrailingComma,
|
|
9583
|
-
at: trailingCommaLoc
|
|
9584
|
-
});
|
|
9463
|
+
this.raise(Errors.RestTrailingComma, trailingCommaLoc);
|
|
9585
9464
|
}
|
|
9586
9465
|
}
|
|
9587
9466
|
}
|
|
@@ -9678,9 +9557,7 @@ class LValParser extends NodeUtils {
|
|
|
9678
9557
|
} else {
|
|
9679
9558
|
const decorators = [];
|
|
9680
9559
|
if (this.match(26) && this.hasPlugin("decorators")) {
|
|
9681
|
-
this.raise(Errors.UnsupportedParameterDecorator,
|
|
9682
|
-
at: this.state.startLoc
|
|
9683
|
-
});
|
|
9560
|
+
this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
|
|
9684
9561
|
}
|
|
9685
9562
|
while (this.match(26)) {
|
|
9686
9563
|
decorators.push(this.parseDecorator());
|
|
@@ -9764,16 +9641,13 @@ class LValParser extends NodeUtils {
|
|
|
9764
9641
|
if (isOptionalMemberExpression) {
|
|
9765
9642
|
this.expectPlugin("optionalChainingAssign", expression.loc.start);
|
|
9766
9643
|
if (ancestor.type !== "AssignmentExpression") {
|
|
9767
|
-
this.raise(Errors.InvalidLhsOptionalChaining, {
|
|
9768
|
-
at: expression,
|
|
9644
|
+
this.raise(Errors.InvalidLhsOptionalChaining, expression, {
|
|
9769
9645
|
ancestor
|
|
9770
9646
|
});
|
|
9771
9647
|
}
|
|
9772
9648
|
}
|
|
9773
9649
|
if (binding !== 64) {
|
|
9774
|
-
this.raise(Errors.InvalidPropertyBindingPattern,
|
|
9775
|
-
at: expression
|
|
9776
|
-
});
|
|
9650
|
+
this.raise(Errors.InvalidPropertyBindingPattern, expression);
|
|
9777
9651
|
}
|
|
9778
9652
|
return;
|
|
9779
9653
|
}
|
|
@@ -9784,9 +9658,7 @@ class LValParser extends NodeUtils {
|
|
|
9784
9658
|
} = expression;
|
|
9785
9659
|
if (checkClashes) {
|
|
9786
9660
|
if (checkClashes.has(name)) {
|
|
9787
|
-
this.raise(Errors.ParamDupe,
|
|
9788
|
-
at: expression
|
|
9789
|
-
});
|
|
9661
|
+
this.raise(Errors.ParamDupe, expression);
|
|
9790
9662
|
} else {
|
|
9791
9663
|
checkClashes.add(name);
|
|
9792
9664
|
}
|
|
@@ -9797,8 +9669,7 @@ class LValParser extends NodeUtils {
|
|
|
9797
9669
|
if (validity === true) return;
|
|
9798
9670
|
if (validity === false) {
|
|
9799
9671
|
const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
|
|
9800
|
-
this.raise(ParseErrorClass, {
|
|
9801
|
-
at: expression,
|
|
9672
|
+
this.raise(ParseErrorClass, expression, {
|
|
9802
9673
|
ancestor
|
|
9803
9674
|
});
|
|
9804
9675
|
return;
|
|
@@ -9822,21 +9693,17 @@ class LValParser extends NodeUtils {
|
|
|
9822
9693
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
9823
9694
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
9824
9695
|
if (bindingType === 64) {
|
|
9825
|
-
this.raise(Errors.StrictEvalArguments, {
|
|
9826
|
-
at,
|
|
9696
|
+
this.raise(Errors.StrictEvalArguments, at, {
|
|
9827
9697
|
referenceName: at.name
|
|
9828
9698
|
});
|
|
9829
9699
|
} else {
|
|
9830
|
-
this.raise(Errors.StrictEvalArgumentsBinding, {
|
|
9831
|
-
at,
|
|
9700
|
+
this.raise(Errors.StrictEvalArgumentsBinding, at, {
|
|
9832
9701
|
bindingName: at.name
|
|
9833
9702
|
});
|
|
9834
9703
|
}
|
|
9835
9704
|
}
|
|
9836
9705
|
if (bindingType & 8192 && at.name === "let") {
|
|
9837
|
-
this.raise(Errors.LetInLexicalBinding,
|
|
9838
|
-
at
|
|
9839
|
-
});
|
|
9706
|
+
this.raise(Errors.LetInLexicalBinding, at);
|
|
9840
9707
|
}
|
|
9841
9708
|
if (!(bindingType & 64)) {
|
|
9842
9709
|
this.declareNameFromIdentifier(at, bindingType);
|
|
@@ -9857,18 +9724,14 @@ class LValParser extends NodeUtils {
|
|
|
9857
9724
|
case "ObjectExpression":
|
|
9858
9725
|
if (allowPattern) break;
|
|
9859
9726
|
default:
|
|
9860
|
-
this.raise(Errors.InvalidRestAssignmentPattern,
|
|
9861
|
-
at: node
|
|
9862
|
-
});
|
|
9727
|
+
this.raise(Errors.InvalidRestAssignmentPattern, node);
|
|
9863
9728
|
}
|
|
9864
9729
|
}
|
|
9865
9730
|
checkCommaAfterRest(close) {
|
|
9866
9731
|
if (!this.match(12)) {
|
|
9867
9732
|
return false;
|
|
9868
9733
|
}
|
|
9869
|
-
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest,
|
|
9870
|
-
at: this.state.startLoc
|
|
9871
|
-
});
|
|
9734
|
+
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
|
|
9872
9735
|
return true;
|
|
9873
9736
|
}
|
|
9874
9737
|
}
|
|
@@ -10064,16 +9927,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10064
9927
|
}, modified) {
|
|
10065
9928
|
const enforceOrder = (loc, modifier, before, after) => {
|
|
10066
9929
|
if (modifier === before && modified[after]) {
|
|
10067
|
-
this.raise(TSErrors.InvalidModifiersOrder, {
|
|
10068
|
-
at: loc,
|
|
9930
|
+
this.raise(TSErrors.InvalidModifiersOrder, loc, {
|
|
10069
9931
|
orderedModifiers: [before, after]
|
|
10070
9932
|
});
|
|
10071
9933
|
}
|
|
10072
9934
|
};
|
|
10073
9935
|
const incompatible = (loc, modifier, mod1, mod2) => {
|
|
10074
9936
|
if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
|
|
10075
|
-
this.raise(TSErrors.IncompatibleModifiers, {
|
|
10076
|
-
at: loc,
|
|
9937
|
+
this.raise(TSErrors.IncompatibleModifiers, loc, {
|
|
10077
9938
|
modifiers: [mod1, mod2]
|
|
10078
9939
|
});
|
|
10079
9940
|
}
|
|
@@ -10086,8 +9947,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10086
9947
|
if (!modifier) break;
|
|
10087
9948
|
if (tsIsAccessModifier(modifier)) {
|
|
10088
9949
|
if (modified.accessibility) {
|
|
10089
|
-
this.raise(TSErrors.DuplicateAccessibilityModifier, {
|
|
10090
|
-
at: startLoc,
|
|
9950
|
+
this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
|
|
10091
9951
|
modifier
|
|
10092
9952
|
});
|
|
10093
9953
|
} else {
|
|
@@ -10098,8 +9958,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10098
9958
|
}
|
|
10099
9959
|
} else if (tsIsVarianceAnnotations(modifier)) {
|
|
10100
9960
|
if (modified[modifier]) {
|
|
10101
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
10102
|
-
at: startLoc,
|
|
9961
|
+
this.raise(TSErrors.DuplicateModifier, startLoc, {
|
|
10103
9962
|
modifier
|
|
10104
9963
|
});
|
|
10105
9964
|
}
|
|
@@ -10107,8 +9966,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10107
9966
|
enforceOrder(startLoc, modifier, "in", "out");
|
|
10108
9967
|
} else {
|
|
10109
9968
|
if (Object.hasOwnProperty.call(modified, modifier)) {
|
|
10110
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
10111
|
-
at: startLoc,
|
|
9969
|
+
this.raise(TSErrors.DuplicateModifier, startLoc, {
|
|
10112
9970
|
modifier
|
|
10113
9971
|
});
|
|
10114
9972
|
} else {
|
|
@@ -10122,8 +9980,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10122
9980
|
modified[modifier] = true;
|
|
10123
9981
|
}
|
|
10124
9982
|
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
|
|
10125
|
-
this.raise(errorTemplate, {
|
|
10126
|
-
at: startLoc,
|
|
9983
|
+
this.raise(errorTemplate, startLoc, {
|
|
10127
9984
|
modifier
|
|
10128
9985
|
});
|
|
10129
9986
|
}
|
|
@@ -10166,7 +10023,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10166
10023
|
}
|
|
10167
10024
|
result.push(element);
|
|
10168
10025
|
if (this.eat(12)) {
|
|
10169
|
-
trailingCommaPos = this.state.
|
|
10026
|
+
trailingCommaPos = this.state.lastTokStartLoc.index;
|
|
10170
10027
|
continue;
|
|
10171
10028
|
}
|
|
10172
10029
|
if (this.tsIsListTerminator(kind)) {
|
|
@@ -10203,9 +10060,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10203
10060
|
this.expect(83);
|
|
10204
10061
|
this.expect(10);
|
|
10205
10062
|
if (!this.match(133)) {
|
|
10206
|
-
this.raise(TSErrors.UnsupportedImportTypeArgument,
|
|
10207
|
-
at: this.state.startLoc
|
|
10208
|
-
});
|
|
10063
|
+
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
10209
10064
|
}
|
|
10210
10065
|
node.argument = super.parseExprAtom();
|
|
10211
10066
|
this.expect(11);
|
|
@@ -10286,9 +10141,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10286
10141
|
};
|
|
10287
10142
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
10288
10143
|
if (node.params.length === 0) {
|
|
10289
|
-
this.raise(TSErrors.EmptyTypeParameters,
|
|
10290
|
-
at: node
|
|
10291
|
-
});
|
|
10144
|
+
this.raise(TSErrors.EmptyTypeParameters, node);
|
|
10292
10145
|
}
|
|
10293
10146
|
if (refTrailingCommaPos.value !== -1) {
|
|
10294
10147
|
this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
|
|
@@ -10315,8 +10168,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10315
10168
|
type
|
|
10316
10169
|
} = pattern;
|
|
10317
10170
|
if (type === "AssignmentPattern" || type === "TSParameterProperty") {
|
|
10318
|
-
this.raise(TSErrors.UnsupportedSignatureParameterKind, {
|
|
10319
|
-
at: pattern,
|
|
10171
|
+
this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
|
|
10320
10172
|
type
|
|
10321
10173
|
});
|
|
10322
10174
|
}
|
|
@@ -10361,15 +10213,11 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10361
10213
|
const nodeAny = node;
|
|
10362
10214
|
if (this.match(10) || this.match(47)) {
|
|
10363
10215
|
if (readonly) {
|
|
10364
|
-
this.raise(TSErrors.ReadonlyForMethodSignature,
|
|
10365
|
-
at: node
|
|
10366
|
-
});
|
|
10216
|
+
this.raise(TSErrors.ReadonlyForMethodSignature, node);
|
|
10367
10217
|
}
|
|
10368
10218
|
const method = nodeAny;
|
|
10369
10219
|
if (method.kind && this.match(47)) {
|
|
10370
|
-
this.raise(TSErrors.AccesorCannotHaveTypeParameters,
|
|
10371
|
-
at: this.state.curPosition()
|
|
10372
|
-
});
|
|
10220
|
+
this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition());
|
|
10373
10221
|
}
|
|
10374
10222
|
this.tsFillSignature(14, method);
|
|
10375
10223
|
this.tsParseTypeMemberSemicolon();
|
|
@@ -10377,42 +10225,28 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10377
10225
|
const returnTypeKey = "typeAnnotation";
|
|
10378
10226
|
if (method.kind === "get") {
|
|
10379
10227
|
if (method[paramsKey].length > 0) {
|
|
10380
|
-
this.raise(Errors.BadGetterArity,
|
|
10381
|
-
at: this.state.curPosition()
|
|
10382
|
-
});
|
|
10228
|
+
this.raise(Errors.BadGetterArity, this.state.curPosition());
|
|
10383
10229
|
if (this.isThisParam(method[paramsKey][0])) {
|
|
10384
|
-
this.raise(TSErrors.AccesorCannotDeclareThisParameter,
|
|
10385
|
-
at: this.state.curPosition()
|
|
10386
|
-
});
|
|
10230
|
+
this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
|
|
10387
10231
|
}
|
|
10388
10232
|
}
|
|
10389
10233
|
} else if (method.kind === "set") {
|
|
10390
10234
|
if (method[paramsKey].length !== 1) {
|
|
10391
|
-
this.raise(Errors.BadSetterArity,
|
|
10392
|
-
at: this.state.curPosition()
|
|
10393
|
-
});
|
|
10235
|
+
this.raise(Errors.BadSetterArity, this.state.curPosition());
|
|
10394
10236
|
} else {
|
|
10395
10237
|
const firstParameter = method[paramsKey][0];
|
|
10396
10238
|
if (this.isThisParam(firstParameter)) {
|
|
10397
|
-
this.raise(TSErrors.AccesorCannotDeclareThisParameter,
|
|
10398
|
-
at: this.state.curPosition()
|
|
10399
|
-
});
|
|
10239
|
+
this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
|
|
10400
10240
|
}
|
|
10401
10241
|
if (firstParameter.type === "Identifier" && firstParameter.optional) {
|
|
10402
|
-
this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter,
|
|
10403
|
-
at: this.state.curPosition()
|
|
10404
|
-
});
|
|
10242
|
+
this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition());
|
|
10405
10243
|
}
|
|
10406
10244
|
if (firstParameter.type === "RestElement") {
|
|
10407
|
-
this.raise(TSErrors.SetAccesorCannotHaveRestParameter,
|
|
10408
|
-
at: this.state.curPosition()
|
|
10409
|
-
});
|
|
10245
|
+
this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
|
|
10410
10246
|
}
|
|
10411
10247
|
}
|
|
10412
10248
|
if (method[returnTypeKey]) {
|
|
10413
|
-
this.raise(TSErrors.SetAccesorCannotHaveReturnType,
|
|
10414
|
-
at: method[returnTypeKey]
|
|
10415
|
-
});
|
|
10249
|
+
this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
|
|
10416
10250
|
}
|
|
10417
10251
|
} else {
|
|
10418
10252
|
method.kind = "method";
|
|
@@ -10527,9 +10361,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10527
10361
|
type
|
|
10528
10362
|
} = elementNode;
|
|
10529
10363
|
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
|
|
10530
|
-
this.raise(TSErrors.OptionalTypeBeforeRequired,
|
|
10531
|
-
at: elementNode
|
|
10532
|
-
});
|
|
10364
|
+
this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
|
|
10533
10365
|
}
|
|
10534
10366
|
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
10535
10367
|
});
|
|
@@ -10582,16 +10414,12 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10582
10414
|
labeledNode.elementType = type;
|
|
10583
10415
|
if (this.eat(17)) {
|
|
10584
10416
|
labeledNode.optional = true;
|
|
10585
|
-
this.raise(TSErrors.TupleOptionalAfterType,
|
|
10586
|
-
at: this.state.lastTokStartLoc
|
|
10587
|
-
});
|
|
10417
|
+
this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
|
|
10588
10418
|
}
|
|
10589
10419
|
} else {
|
|
10590
10420
|
labeledNode = this.startNodeAtNode(type);
|
|
10591
10421
|
labeledNode.optional = optional;
|
|
10592
|
-
this.raise(TSErrors.InvalidTupleMemberLabel,
|
|
10593
|
-
at: type
|
|
10594
|
-
});
|
|
10422
|
+
this.raise(TSErrors.InvalidTupleMemberLabel, type);
|
|
10595
10423
|
labeledNode.label = type;
|
|
10596
10424
|
labeledNode.elementType = this.tsParseType();
|
|
10597
10425
|
}
|
|
@@ -10744,9 +10572,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10744
10572
|
case "TSArrayType":
|
|
10745
10573
|
return;
|
|
10746
10574
|
default:
|
|
10747
|
-
this.raise(TSErrors.UnexpectedReadonly,
|
|
10748
|
-
at: node
|
|
10749
|
-
});
|
|
10575
|
+
this.raise(TSErrors.UnexpectedReadonly, node);
|
|
10750
10576
|
}
|
|
10751
10577
|
}
|
|
10752
10578
|
tsParseInferType() {
|
|
@@ -10914,8 +10740,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10914
10740
|
return false;
|
|
10915
10741
|
}
|
|
10916
10742
|
if (containsEsc) {
|
|
10917
|
-
this.raise(Errors.InvalidEscapedReservedWord, {
|
|
10918
|
-
at: this.state.lastTokStartLoc,
|
|
10743
|
+
this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
|
|
10919
10744
|
reservedWord: "asserts"
|
|
10920
10745
|
});
|
|
10921
10746
|
}
|
|
@@ -10959,9 +10784,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10959
10784
|
}
|
|
10960
10785
|
tsParseTypeAssertion() {
|
|
10961
10786
|
if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
|
|
10962
|
-
this.raise(TSErrors.ReservedTypeAssertion,
|
|
10963
|
-
at: this.state.startLoc
|
|
10964
|
-
});
|
|
10787
|
+
this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
|
|
10965
10788
|
}
|
|
10966
10789
|
const node = this.startNode();
|
|
10967
10790
|
node.typeAnnotation = this.tsInType(() => {
|
|
@@ -10983,8 +10806,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10983
10806
|
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
10984
10807
|
});
|
|
10985
10808
|
if (!delimitedList.length) {
|
|
10986
|
-
this.raise(TSErrors.EmptyHeritageClauseType, {
|
|
10987
|
-
at: originalStartLoc,
|
|
10809
|
+
this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
|
10988
10810
|
token
|
|
10989
10811
|
});
|
|
10990
10812
|
}
|
|
@@ -10999,9 +10821,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
10999
10821
|
this.checkIdentifier(node.id, 130);
|
|
11000
10822
|
} else {
|
|
11001
10823
|
node.id = null;
|
|
11002
|
-
this.raise(TSErrors.MissingInterfaceName,
|
|
11003
|
-
at: this.state.startLoc
|
|
11004
|
-
});
|
|
10824
|
+
this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
|
|
11005
10825
|
}
|
|
11006
10826
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
|
|
11007
10827
|
if (this.eat(81)) {
|
|
@@ -11153,9 +10973,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11153
10973
|
this.expect(29);
|
|
11154
10974
|
const moduleReference = this.tsParseModuleReference();
|
|
11155
10975
|
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
|
|
11156
|
-
this.raise(TSErrors.ImportAliasHasImportType,
|
|
11157
|
-
at: moduleReference
|
|
11158
|
-
});
|
|
10976
|
+
this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
|
|
11159
10977
|
}
|
|
11160
10978
|
node.moduleReference = moduleReference;
|
|
11161
10979
|
this.semicolon();
|
|
@@ -11341,9 +11159,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11341
11159
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
11342
11160
|
}));
|
|
11343
11161
|
if (node.params.length === 0) {
|
|
11344
|
-
this.raise(TSErrors.EmptyTypeArguments,
|
|
11345
|
-
at: node
|
|
11346
|
-
});
|
|
11162
|
+
this.raise(TSErrors.EmptyTypeArguments, node);
|
|
11347
11163
|
} else if (!this.state.inType && this.curContext() === types$1.brace) {
|
|
11348
11164
|
this.reScan_lt_gt();
|
|
11349
11165
|
}
|
|
@@ -11367,9 +11183,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11367
11183
|
const override = modified.override;
|
|
11368
11184
|
const readonly = modified.readonly;
|
|
11369
11185
|
if (!(flags & 4) && (accessibility || readonly || override)) {
|
|
11370
|
-
this.raise(TSErrors.UnexpectedParameterModifier,
|
|
11371
|
-
at: startLoc
|
|
11372
|
-
});
|
|
11186
|
+
this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
|
|
11373
11187
|
}
|
|
11374
11188
|
const left = this.parseMaybeDefault();
|
|
11375
11189
|
this.parseAssignableListItemTypes(left, flags);
|
|
@@ -11383,9 +11197,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11383
11197
|
if (readonly) pp.readonly = readonly;
|
|
11384
11198
|
if (override) pp.override = override;
|
|
11385
11199
|
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
|
|
11386
|
-
this.raise(TSErrors.UnsupportedParameterPropertyKind,
|
|
11387
|
-
at: pp
|
|
11388
|
-
});
|
|
11200
|
+
this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
|
|
11389
11201
|
}
|
|
11390
11202
|
pp.parameter = elt;
|
|
11391
11203
|
return this.finishNode(pp, "TSParameterProperty");
|
|
@@ -11401,9 +11213,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11401
11213
|
tsDisallowOptionalPattern(node) {
|
|
11402
11214
|
for (const param of node.params) {
|
|
11403
11215
|
if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
|
|
11404
|
-
this.raise(TSErrors.PatternIsOptional,
|
|
11405
|
-
at: param
|
|
11406
|
-
});
|
|
11216
|
+
this.raise(TSErrors.PatternIsOptional, param);
|
|
11407
11217
|
}
|
|
11408
11218
|
}
|
|
11409
11219
|
}
|
|
@@ -11420,9 +11230,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11420
11230
|
return this.finishNode(node, bodilessType);
|
|
11421
11231
|
}
|
|
11422
11232
|
if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
|
|
11423
|
-
this.raise(TSErrors.DeclareFunctionHasImplementation,
|
|
11424
|
-
at: node
|
|
11425
|
-
});
|
|
11233
|
+
this.raise(TSErrors.DeclareFunctionHasImplementation, node);
|
|
11426
11234
|
if (node.declare) {
|
|
11427
11235
|
return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
11428
11236
|
}
|
|
@@ -11440,9 +11248,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11440
11248
|
tsCheckForInvalidTypeCasts(items) {
|
|
11441
11249
|
items.forEach(node => {
|
|
11442
11250
|
if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
|
|
11443
|
-
this.raise(TSErrors.UnexpectedTypeAnnotation,
|
|
11444
|
-
at: node.typeAnnotation
|
|
11445
|
-
});
|
|
11251
|
+
this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
|
|
11446
11252
|
}
|
|
11447
11253
|
});
|
|
11448
11254
|
}
|
|
@@ -11519,9 +11325,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11519
11325
|
}
|
|
11520
11326
|
if (result) {
|
|
11521
11327
|
if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
|
|
11522
|
-
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression,
|
|
11523
|
-
at: this.state.startLoc
|
|
11524
|
-
});
|
|
11328
|
+
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
|
|
11525
11329
|
}
|
|
11526
11330
|
return result;
|
|
11527
11331
|
}
|
|
@@ -11548,8 +11352,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11548
11352
|
this.next();
|
|
11549
11353
|
if (this.match(75)) {
|
|
11550
11354
|
if (isSatisfies) {
|
|
11551
|
-
this.raise(Errors.UnexpectedKeyword, {
|
|
11552
|
-
at: this.state.startLoc,
|
|
11355
|
+
this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
|
|
11553
11356
|
keyword: "const"
|
|
11554
11357
|
});
|
|
11555
11358
|
}
|
|
@@ -11571,9 +11374,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11571
11374
|
checkImportReflection(node) {
|
|
11572
11375
|
super.checkImportReflection(node);
|
|
11573
11376
|
if (node.module && node.importKind !== "value") {
|
|
11574
|
-
this.raise(TSErrors.ImportReflectionHasImportType,
|
|
11575
|
-
at: node.specifiers[0].loc.start
|
|
11576
|
-
});
|
|
11377
|
+
this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
|
|
11577
11378
|
}
|
|
11578
11379
|
}
|
|
11579
11380
|
checkDuplicateExports() {}
|
|
@@ -11613,9 +11414,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11613
11414
|
importNode = super.parseImport(node);
|
|
11614
11415
|
}
|
|
11615
11416
|
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
11616
|
-
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed,
|
|
11617
|
-
at: importNode
|
|
11618
|
-
});
|
|
11417
|
+
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
|
|
11619
11418
|
}
|
|
11620
11419
|
return importNode;
|
|
11621
11420
|
}
|
|
@@ -11673,13 +11472,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11673
11472
|
} of declaration.declarations) {
|
|
11674
11473
|
if (!init) continue;
|
|
11675
11474
|
if (kind !== "const" || !!id.typeAnnotation) {
|
|
11676
|
-
this.raise(TSErrors.InitializerNotAllowedInAmbientContext,
|
|
11677
|
-
at: init
|
|
11678
|
-
});
|
|
11475
|
+
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
|
|
11679
11476
|
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
11680
|
-
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference,
|
|
11681
|
-
at: init
|
|
11682
|
-
});
|
|
11477
|
+
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
|
|
11683
11478
|
}
|
|
11684
11479
|
}
|
|
11685
11480
|
return declaration;
|
|
@@ -11728,9 +11523,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11728
11523
|
this.next();
|
|
11729
11524
|
this.next();
|
|
11730
11525
|
if (this.tsHasSomeModifiers(member, modifiers)) {
|
|
11731
|
-
this.raise(TSErrors.StaticBlockCannotHaveModifier,
|
|
11732
|
-
at: this.state.curPosition()
|
|
11733
|
-
});
|
|
11526
|
+
this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
|
|
11734
11527
|
}
|
|
11735
11528
|
super.parseClassStaticBlock(classBody, member);
|
|
11736
11529
|
} else {
|
|
@@ -11748,38 +11541,27 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11748
11541
|
if (idx) {
|
|
11749
11542
|
classBody.body.push(idx);
|
|
11750
11543
|
if (member.abstract) {
|
|
11751
|
-
this.raise(TSErrors.IndexSignatureHasAbstract,
|
|
11752
|
-
at: member
|
|
11753
|
-
});
|
|
11544
|
+
this.raise(TSErrors.IndexSignatureHasAbstract, member);
|
|
11754
11545
|
}
|
|
11755
11546
|
if (member.accessibility) {
|
|
11756
|
-
this.raise(TSErrors.IndexSignatureHasAccessibility, {
|
|
11757
|
-
at: member,
|
|
11547
|
+
this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
|
|
11758
11548
|
modifier: member.accessibility
|
|
11759
11549
|
});
|
|
11760
11550
|
}
|
|
11761
11551
|
if (member.declare) {
|
|
11762
|
-
this.raise(TSErrors.IndexSignatureHasDeclare,
|
|
11763
|
-
at: member
|
|
11764
|
-
});
|
|
11552
|
+
this.raise(TSErrors.IndexSignatureHasDeclare, member);
|
|
11765
11553
|
}
|
|
11766
11554
|
if (member.override) {
|
|
11767
|
-
this.raise(TSErrors.IndexSignatureHasOverride,
|
|
11768
|
-
at: member
|
|
11769
|
-
});
|
|
11555
|
+
this.raise(TSErrors.IndexSignatureHasOverride, member);
|
|
11770
11556
|
}
|
|
11771
11557
|
return;
|
|
11772
11558
|
}
|
|
11773
11559
|
if (!this.state.inAbstractClass && member.abstract) {
|
|
11774
|
-
this.raise(TSErrors.NonAbstractClassHasAbstractMethod,
|
|
11775
|
-
at: member
|
|
11776
|
-
});
|
|
11560
|
+
this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
|
|
11777
11561
|
}
|
|
11778
11562
|
if (member.override) {
|
|
11779
11563
|
if (!state.hadSuperClass) {
|
|
11780
|
-
this.raise(TSErrors.OverrideNotInSubClass,
|
|
11781
|
-
at: member
|
|
11782
|
-
});
|
|
11564
|
+
this.raise(TSErrors.OverrideNotInSubClass, member);
|
|
11783
11565
|
}
|
|
11784
11566
|
}
|
|
11785
11567
|
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
@@ -11788,14 +11570,10 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11788
11570
|
const optional = this.eat(17);
|
|
11789
11571
|
if (optional) methodOrProp.optional = true;
|
|
11790
11572
|
if (methodOrProp.readonly && this.match(10)) {
|
|
11791
|
-
this.raise(TSErrors.ClassMethodHasReadonly,
|
|
11792
|
-
at: methodOrProp
|
|
11793
|
-
});
|
|
11573
|
+
this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
|
|
11794
11574
|
}
|
|
11795
11575
|
if (methodOrProp.declare && this.match(10)) {
|
|
11796
|
-
this.raise(TSErrors.ClassMethodHasDeclare,
|
|
11797
|
-
at: methodOrProp
|
|
11798
|
-
});
|
|
11576
|
+
this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
|
|
11799
11577
|
}
|
|
11800
11578
|
}
|
|
11801
11579
|
parseExpressionStatement(node, expr, decorators) {
|
|
@@ -11841,9 +11619,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11841
11619
|
const startLoc = this.state.startLoc;
|
|
11842
11620
|
const isDeclare = this.eatContextual(125);
|
|
11843
11621
|
if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
|
|
11844
|
-
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare,
|
|
11845
|
-
at: this.state.startLoc
|
|
11846
|
-
});
|
|
11622
|
+
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
11847
11623
|
}
|
|
11848
11624
|
const isIdentifier = tokenIsIdentifier(this.state.type);
|
|
11849
11625
|
const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
@@ -11879,16 +11655,13 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11879
11655
|
parseClassProperty(node) {
|
|
11880
11656
|
this.parseClassPropertyAnnotation(node);
|
|
11881
11657
|
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
|
|
11882
|
-
this.raise(TSErrors.DeclareClassFieldHasInitializer,
|
|
11883
|
-
at: this.state.startLoc
|
|
11884
|
-
});
|
|
11658
|
+
this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
|
|
11885
11659
|
}
|
|
11886
11660
|
if (node.abstract && this.match(29)) {
|
|
11887
11661
|
const {
|
|
11888
11662
|
key
|
|
11889
11663
|
} = node;
|
|
11890
|
-
this.raise(TSErrors.AbstractPropertyHasInitializer, {
|
|
11891
|
-
at: this.state.startLoc,
|
|
11664
|
+
this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
|
|
11892
11665
|
propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
|
|
11893
11666
|
});
|
|
11894
11667
|
}
|
|
@@ -11896,13 +11669,10 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11896
11669
|
}
|
|
11897
11670
|
parseClassPrivateProperty(node) {
|
|
11898
11671
|
if (node.abstract) {
|
|
11899
|
-
this.raise(TSErrors.PrivateElementHasAbstract,
|
|
11900
|
-
at: node
|
|
11901
|
-
});
|
|
11672
|
+
this.raise(TSErrors.PrivateElementHasAbstract, node);
|
|
11902
11673
|
}
|
|
11903
11674
|
if (node.accessibility) {
|
|
11904
|
-
this.raise(TSErrors.PrivateElementHasAccessibility, {
|
|
11905
|
-
at: node,
|
|
11675
|
+
this.raise(TSErrors.PrivateElementHasAccessibility, node, {
|
|
11906
11676
|
modifier: node.accessibility
|
|
11907
11677
|
});
|
|
11908
11678
|
}
|
|
@@ -11912,26 +11682,21 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11912
11682
|
parseClassAccessorProperty(node) {
|
|
11913
11683
|
this.parseClassPropertyAnnotation(node);
|
|
11914
11684
|
if (node.optional) {
|
|
11915
|
-
this.raise(TSErrors.AccessorCannotBeOptional,
|
|
11916
|
-
at: node
|
|
11917
|
-
});
|
|
11685
|
+
this.raise(TSErrors.AccessorCannotBeOptional, node);
|
|
11918
11686
|
}
|
|
11919
11687
|
return super.parseClassAccessorProperty(node);
|
|
11920
11688
|
}
|
|
11921
11689
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
11922
11690
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
11923
11691
|
if (typeParameters && isConstructor) {
|
|
11924
|
-
this.raise(TSErrors.ConstructorHasTypeParameters,
|
|
11925
|
-
at: typeParameters
|
|
11926
|
-
});
|
|
11692
|
+
this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
|
|
11927
11693
|
}
|
|
11928
11694
|
const {
|
|
11929
11695
|
declare = false,
|
|
11930
11696
|
kind
|
|
11931
11697
|
} = method;
|
|
11932
11698
|
if (declare && (kind === "get" || kind === "set")) {
|
|
11933
|
-
this.raise(TSErrors.DeclareAccessor, {
|
|
11934
|
-
at: method,
|
|
11699
|
+
this.raise(TSErrors.DeclareAccessor, method, {
|
|
11935
11700
|
kind
|
|
11936
11701
|
});
|
|
11937
11702
|
}
|
|
@@ -12046,9 +11811,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
12046
11811
|
reportReservedArrowTypeParam(node) {
|
|
12047
11812
|
var _node$extra;
|
|
12048
11813
|
if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
|
|
12049
|
-
this.raise(TSErrors.ReservedArrowTypeParam,
|
|
12050
|
-
at: node
|
|
12051
|
-
});
|
|
11814
|
+
this.raise(TSErrors.ReservedArrowTypeParam, node);
|
|
12052
11815
|
}
|
|
12053
11816
|
}
|
|
12054
11817
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
@@ -12102,13 +11865,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
12102
11865
|
case "TSNonNullExpression":
|
|
12103
11866
|
case "TSTypeAssertion":
|
|
12104
11867
|
if (isLHS) {
|
|
12105
|
-
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter,
|
|
12106
|
-
at: node
|
|
12107
|
-
});
|
|
11868
|
+
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
12108
11869
|
} else {
|
|
12109
|
-
this.raise(TSErrors.UnexpectedTypeCastInParameter,
|
|
12110
|
-
at: node
|
|
12111
|
-
});
|
|
11870
|
+
this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
12112
11871
|
}
|
|
12113
11872
|
this.toAssignable(node.expression, isLHS);
|
|
12114
11873
|
break;
|
|
@@ -12189,9 +11948,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
12189
11948
|
parseMaybeDefault(startLoc, left) {
|
|
12190
11949
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
12191
11950
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
12192
|
-
this.raise(TSErrors.TypeAnnotationAfterAssign,
|
|
12193
|
-
at: node.typeAnnotation
|
|
12194
|
-
});
|
|
11951
|
+
this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
|
|
12195
11952
|
}
|
|
12196
11953
|
return node;
|
|
12197
11954
|
}
|
|
@@ -12305,9 +12062,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
12305
12062
|
} else if (this.isContextual(129)) {
|
|
12306
12063
|
if (!this.hasFollowingLineBreak()) {
|
|
12307
12064
|
node.abstract = true;
|
|
12308
|
-
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer,
|
|
12309
|
-
at: node
|
|
12310
|
-
});
|
|
12065
|
+
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
|
|
12311
12066
|
return this.tsParseInterfaceDeclaration(node);
|
|
12312
12067
|
}
|
|
12313
12068
|
} else {
|
|
@@ -12322,8 +12077,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
12322
12077
|
const {
|
|
12323
12078
|
key
|
|
12324
12079
|
} = method;
|
|
12325
|
-
this.raise(TSErrors.AbstractMethodHasImplementation, {
|
|
12326
|
-
at: method,
|
|
12080
|
+
this.raise(TSErrors.AbstractMethodHasImplementation, method, {
|
|
12327
12081
|
methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
|
|
12328
12082
|
});
|
|
12329
12083
|
}
|
|
@@ -12405,9 +12159,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
12405
12159
|
}
|
|
12406
12160
|
}
|
|
12407
12161
|
if (hasTypeSpecifier && isInTypeOnlyImportExport) {
|
|
12408
|
-
this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports,
|
|
12409
|
-
at: loc
|
|
12410
|
-
});
|
|
12162
|
+
this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
|
|
12411
12163
|
}
|
|
12412
12164
|
node[leftOfAsKey] = leftOfAs;
|
|
12413
12165
|
node[rightOfAsKey] = rightOfAs;
|
|
@@ -12594,9 +12346,7 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
|
|
|
12594
12346
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
12595
12347
|
return this.finishNode(node, type);
|
|
12596
12348
|
} else {
|
|
12597
|
-
throw this.raise(PlaceholderErrors.ClassNameIsRequired,
|
|
12598
|
-
at: this.state.startLoc
|
|
12599
|
-
});
|
|
12349
|
+
throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
|
|
12600
12350
|
}
|
|
12601
12351
|
} else {
|
|
12602
12352
|
this.parseClassId(node, isStatement, optionalId);
|
|
@@ -12674,9 +12424,7 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
|
|
|
12674
12424
|
}
|
|
12675
12425
|
assertNoSpace() {
|
|
12676
12426
|
if (this.state.start > this.state.lastTokEndLoc.index) {
|
|
12677
|
-
this.raise(PlaceholderErrors.UnexpectedSpace,
|
|
12678
|
-
at: this.state.lastTokEndLoc
|
|
12679
|
-
});
|
|
12427
|
+
this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
|
|
12680
12428
|
}
|
|
12681
12429
|
}
|
|
12682
12430
|
};
|
|
@@ -12865,9 +12613,7 @@ class ExpressionParser extends LValParser {
|
|
|
12865
12613
|
const name = key.type === "Identifier" ? key.name : key.value;
|
|
12866
12614
|
if (name === "__proto__") {
|
|
12867
12615
|
if (isRecord) {
|
|
12868
|
-
this.raise(Errors.RecordNoProto,
|
|
12869
|
-
at: key
|
|
12870
|
-
});
|
|
12616
|
+
this.raise(Errors.RecordNoProto, key);
|
|
12871
12617
|
return;
|
|
12872
12618
|
}
|
|
12873
12619
|
if (protoRef.used) {
|
|
@@ -12876,9 +12622,7 @@ class ExpressionParser extends LValParser {
|
|
|
12876
12622
|
refExpressionErrors.doubleProtoLoc = key.loc.start;
|
|
12877
12623
|
}
|
|
12878
12624
|
} else {
|
|
12879
|
-
this.raise(Errors.DuplicateProto,
|
|
12880
|
-
at: key
|
|
12881
|
-
});
|
|
12625
|
+
this.raise(Errors.DuplicateProto, key);
|
|
12882
12626
|
}
|
|
12883
12627
|
}
|
|
12884
12628
|
protoRef.used = true;
|
|
@@ -12895,7 +12639,7 @@ class ExpressionParser extends LValParser {
|
|
|
12895
12639
|
this.unexpected();
|
|
12896
12640
|
}
|
|
12897
12641
|
this.finalizeRemainingComments();
|
|
12898
|
-
expr.comments = this.
|
|
12642
|
+
expr.comments = this.comments;
|
|
12899
12643
|
expr.errors = this.state.errors;
|
|
12900
12644
|
if (this.options.tokens) {
|
|
12901
12645
|
expr.tokens = this.tokens;
|
|
@@ -13028,8 +12772,7 @@ class ExpressionParser extends LValParser {
|
|
|
13028
12772
|
if (this.isPrivateName(left)) {
|
|
13029
12773
|
const value = this.getPrivateNameSV(left);
|
|
13030
12774
|
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
|
|
13031
|
-
this.raise(Errors.PrivateInExpectedIn, {
|
|
13032
|
-
at: left,
|
|
12775
|
+
this.raise(Errors.PrivateInExpectedIn, left, {
|
|
13033
12776
|
identifierName: value
|
|
13034
12777
|
});
|
|
13035
12778
|
}
|
|
@@ -13059,18 +12802,14 @@ class ExpressionParser extends LValParser {
|
|
|
13059
12802
|
proposal: "minimal"
|
|
13060
12803
|
}])) {
|
|
13061
12804
|
if (this.state.type === 96 && this.prodParam.hasAwait) {
|
|
13062
|
-
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody,
|
|
13063
|
-
at: this.state.startLoc
|
|
13064
|
-
});
|
|
12805
|
+
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
|
|
13065
12806
|
}
|
|
13066
12807
|
}
|
|
13067
12808
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
13068
12809
|
const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
13069
12810
|
const nextOp = this.state.type;
|
|
13070
12811
|
if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
|
|
13071
|
-
throw this.raise(Errors.MixingCoalesceWithLogical,
|
|
13072
|
-
at: this.state.startLoc
|
|
13073
|
-
});
|
|
12812
|
+
throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
|
|
13074
12813
|
}
|
|
13075
12814
|
return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
|
|
13076
12815
|
}
|
|
@@ -13089,9 +12828,7 @@ class ExpressionParser extends LValParser {
|
|
|
13089
12828
|
case "smart":
|
|
13090
12829
|
return this.withTopicBindingContext(() => {
|
|
13091
12830
|
if (this.prodParam.hasYield && this.isContextual(108)) {
|
|
13092
|
-
throw this.raise(Errors.PipeBodyIsTighter,
|
|
13093
|
-
at: this.state.startLoc
|
|
13094
|
-
});
|
|
12831
|
+
throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
|
|
13095
12832
|
}
|
|
13096
12833
|
return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
|
|
13097
12834
|
});
|
|
@@ -13116,23 +12853,18 @@ class ExpressionParser extends LValParser {
|
|
|
13116
12853
|
const body = this.parseMaybeAssign();
|
|
13117
12854
|
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
13118
12855
|
if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
|
|
13119
|
-
this.raise(Errors.PipeUnparenthesizedBody, {
|
|
13120
|
-
at: startLoc,
|
|
12856
|
+
this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
|
|
13121
12857
|
type: body.type
|
|
13122
12858
|
});
|
|
13123
12859
|
}
|
|
13124
12860
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
13125
|
-
this.raise(Errors.PipeTopicUnused,
|
|
13126
|
-
at: startLoc
|
|
13127
|
-
});
|
|
12861
|
+
this.raise(Errors.PipeTopicUnused, startLoc);
|
|
13128
12862
|
}
|
|
13129
12863
|
return body;
|
|
13130
12864
|
}
|
|
13131
12865
|
checkExponentialAfterUnary(node) {
|
|
13132
12866
|
if (this.match(57)) {
|
|
13133
|
-
this.raise(Errors.UnexpectedTokenUnaryExponentiation,
|
|
13134
|
-
at: node.argument
|
|
13135
|
-
});
|
|
12867
|
+
this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
|
|
13136
12868
|
}
|
|
13137
12869
|
}
|
|
13138
12870
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
@@ -13159,13 +12891,9 @@ class ExpressionParser extends LValParser {
|
|
|
13159
12891
|
if (this.state.strict && isDelete) {
|
|
13160
12892
|
const arg = node.argument;
|
|
13161
12893
|
if (arg.type === "Identifier") {
|
|
13162
|
-
this.raise(Errors.StrictDelete,
|
|
13163
|
-
at: node
|
|
13164
|
-
});
|
|
12894
|
+
this.raise(Errors.StrictDelete, node);
|
|
13165
12895
|
} else if (this.hasPropertyAsPrivateName(arg)) {
|
|
13166
|
-
this.raise(Errors.DeletePrivateField,
|
|
13167
|
-
at: node
|
|
13168
|
-
});
|
|
12896
|
+
this.raise(Errors.DeletePrivateField, node);
|
|
13169
12897
|
}
|
|
13170
12898
|
}
|
|
13171
12899
|
if (!update) {
|
|
@@ -13182,9 +12910,7 @@ class ExpressionParser extends LValParser {
|
|
|
13182
12910
|
} = this.state;
|
|
13183
12911
|
const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
|
|
13184
12912
|
if (startsExpr && !this.isAmbiguousAwait()) {
|
|
13185
|
-
this.raiseOverwrite(Errors.AwaitNotInAsyncContext,
|
|
13186
|
-
at: startLoc
|
|
13187
|
-
});
|
|
12913
|
+
this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
|
|
13188
12914
|
return this.parseAwait(startLoc);
|
|
13189
12915
|
}
|
|
13190
12916
|
}
|
|
@@ -13246,9 +12972,7 @@ class ExpressionParser extends LValParser {
|
|
|
13246
12972
|
let optional = false;
|
|
13247
12973
|
if (type === 18) {
|
|
13248
12974
|
if (noCalls) {
|
|
13249
|
-
this.raise(Errors.OptionalChainingNoNew,
|
|
13250
|
-
at: this.state.startLoc
|
|
13251
|
-
});
|
|
12975
|
+
this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
|
|
13252
12976
|
if (this.lookaheadCharCode() === 40) {
|
|
13253
12977
|
state.stop = true;
|
|
13254
12978
|
return base;
|
|
@@ -13278,9 +13002,7 @@ class ExpressionParser extends LValParser {
|
|
|
13278
13002
|
this.expect(3);
|
|
13279
13003
|
} else if (this.match(138)) {
|
|
13280
13004
|
if (base.type === "Super") {
|
|
13281
|
-
this.raise(Errors.SuperPrivateField,
|
|
13282
|
-
at: startLoc
|
|
13283
|
-
});
|
|
13005
|
+
this.raise(Errors.SuperPrivateField, startLoc);
|
|
13284
13006
|
}
|
|
13285
13007
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
13286
13008
|
node.property = this.parsePrivateName();
|
|
@@ -13350,9 +13072,7 @@ class ExpressionParser extends LValParser {
|
|
|
13350
13072
|
node.tag = base;
|
|
13351
13073
|
node.quasi = this.parseTemplate(true);
|
|
13352
13074
|
if (state.optionalChainMember) {
|
|
13353
|
-
this.raise(Errors.OptionalChainingNoTemplate,
|
|
13354
|
-
at: startLoc
|
|
13355
|
-
});
|
|
13075
|
+
this.raise(Errors.OptionalChainingNoTemplate, startLoc);
|
|
13356
13076
|
}
|
|
13357
13077
|
return this.finishNode(node, "TaggedTemplateExpression");
|
|
13358
13078
|
}
|
|
@@ -13374,16 +13094,13 @@ class ExpressionParser extends LValParser {
|
|
|
13374
13094
|
}
|
|
13375
13095
|
}
|
|
13376
13096
|
if (node.arguments.length === 0 || node.arguments.length > 2) {
|
|
13377
|
-
this.raise(Errors.ImportCallArity, {
|
|
13378
|
-
at: node,
|
|
13097
|
+
this.raise(Errors.ImportCallArity, node, {
|
|
13379
13098
|
maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
|
|
13380
13099
|
});
|
|
13381
13100
|
} else {
|
|
13382
13101
|
for (const arg of node.arguments) {
|
|
13383
13102
|
if (arg.type === "SpreadElement") {
|
|
13384
|
-
this.raise(Errors.ImportCallSpreadArgument,
|
|
13385
|
-
at: arg
|
|
13386
|
-
});
|
|
13103
|
+
this.raise(Errors.ImportCallSpreadArgument, arg);
|
|
13387
13104
|
}
|
|
13388
13105
|
}
|
|
13389
13106
|
}
|
|
@@ -13402,9 +13119,7 @@ class ExpressionParser extends LValParser {
|
|
|
13402
13119
|
this.expect(12);
|
|
13403
13120
|
if (this.match(close)) {
|
|
13404
13121
|
if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
|
|
13405
|
-
this.raise(Errors.ImportCallArgumentTrailingComma,
|
|
13406
|
-
at: this.state.lastTokStartLoc
|
|
13407
|
-
});
|
|
13122
|
+
this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
|
|
13408
13123
|
}
|
|
13409
13124
|
if (nodeForExtra) {
|
|
13410
13125
|
this.addTrailingCommaExtraToNode(nodeForExtra);
|
|
@@ -13460,9 +13175,7 @@ class ExpressionParser extends LValParser {
|
|
|
13460
13175
|
return this.finishNode(node, "Import");
|
|
13461
13176
|
}
|
|
13462
13177
|
} else {
|
|
13463
|
-
this.raise(Errors.UnsupportedImport,
|
|
13464
|
-
at: this.state.lastTokStartLoc
|
|
13465
|
-
});
|
|
13178
|
+
this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
|
|
13466
13179
|
return this.finishNode(node, "Import");
|
|
13467
13180
|
}
|
|
13468
13181
|
case 78:
|
|
@@ -13536,15 +13249,12 @@ class ExpressionParser extends LValParser {
|
|
|
13536
13249
|
if (callee.type === "MemberExpression") {
|
|
13537
13250
|
return this.finishNode(node, "BindExpression");
|
|
13538
13251
|
} else {
|
|
13539
|
-
throw this.raise(Errors.UnsupportedBind,
|
|
13540
|
-
at: callee
|
|
13541
|
-
});
|
|
13252
|
+
throw this.raise(Errors.UnsupportedBind, callee);
|
|
13542
13253
|
}
|
|
13543
13254
|
}
|
|
13544
13255
|
case 138:
|
|
13545
13256
|
{
|
|
13546
|
-
this.raise(Errors.PrivateInExpectedIn, {
|
|
13547
|
-
at: this.state.startLoc,
|
|
13257
|
+
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
|
|
13548
13258
|
identifierName: this.state.value
|
|
13549
13259
|
});
|
|
13550
13260
|
return this.parsePrivateName();
|
|
@@ -13644,15 +13354,12 @@ class ExpressionParser extends LValParser {
|
|
|
13644
13354
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
13645
13355
|
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
|
|
13646
13356
|
if (!this.topicReferenceIsAllowedInCurrentContext()) {
|
|
13647
|
-
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound,
|
|
13648
|
-
at: startLoc
|
|
13649
|
-
});
|
|
13357
|
+
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
|
|
13650
13358
|
}
|
|
13651
13359
|
this.registerTopicReference();
|
|
13652
13360
|
return this.finishNode(node, nodeType);
|
|
13653
13361
|
} else {
|
|
13654
|
-
throw this.raise(Errors.PipeTopicUnconfiguredToken, {
|
|
13655
|
-
at: startLoc,
|
|
13362
|
+
throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
|
|
13656
13363
|
token: tokenLabelName(tokenType)
|
|
13657
13364
|
});
|
|
13658
13365
|
}
|
|
@@ -13668,9 +13375,7 @@ class ExpressionParser extends LValParser {
|
|
|
13668
13375
|
case "smart":
|
|
13669
13376
|
return tokenType === 27;
|
|
13670
13377
|
default:
|
|
13671
|
-
throw this.raise(Errors.PipeTopicRequiresHackPipes,
|
|
13672
|
-
at: startLoc
|
|
13673
|
-
});
|
|
13378
|
+
throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
|
|
13674
13379
|
}
|
|
13675
13380
|
}
|
|
13676
13381
|
parseAsyncArrowUnaryFunction(node) {
|
|
@@ -13678,9 +13383,7 @@ class ExpressionParser extends LValParser {
|
|
|
13678
13383
|
const params = [this.parseIdentifier()];
|
|
13679
13384
|
this.prodParam.exit();
|
|
13680
13385
|
if (this.hasPrecedingLineBreak()) {
|
|
13681
|
-
this.raise(Errors.LineTerminatorBeforeArrow,
|
|
13682
|
-
at: this.state.curPosition()
|
|
13683
|
-
});
|
|
13386
|
+
this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
|
|
13684
13387
|
}
|
|
13685
13388
|
this.expect(19);
|
|
13686
13389
|
return this.parseArrowExpression(node, params, true);
|
|
@@ -13708,18 +13411,12 @@ class ExpressionParser extends LValParser {
|
|
|
13708
13411
|
const node = this.startNode();
|
|
13709
13412
|
this.next();
|
|
13710
13413
|
if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
|
|
13711
|
-
this.raise(Errors.SuperNotAllowed,
|
|
13712
|
-
at: node
|
|
13713
|
-
});
|
|
13414
|
+
this.raise(Errors.SuperNotAllowed, node);
|
|
13714
13415
|
} else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
|
|
13715
|
-
this.raise(Errors.UnexpectedSuper,
|
|
13716
|
-
at: node
|
|
13717
|
-
});
|
|
13416
|
+
this.raise(Errors.UnexpectedSuper, node);
|
|
13718
13417
|
}
|
|
13719
13418
|
if (!this.match(10) && !this.match(0) && !this.match(16)) {
|
|
13720
|
-
this.raise(Errors.UnsupportedSuper,
|
|
13721
|
-
at: node
|
|
13722
|
-
});
|
|
13419
|
+
this.raise(Errors.UnsupportedSuper, node);
|
|
13723
13420
|
}
|
|
13724
13421
|
return this.finishNode(node, "Super");
|
|
13725
13422
|
}
|
|
@@ -13751,8 +13448,7 @@ class ExpressionParser extends LValParser {
|
|
|
13751
13448
|
const containsEsc = this.state.containsEsc;
|
|
13752
13449
|
node.property = this.parseIdentifier(true);
|
|
13753
13450
|
if (node.property.name !== propertyName || containsEsc) {
|
|
13754
|
-
this.raise(Errors.UnsupportedMetaProperty, {
|
|
13755
|
-
at: node.property,
|
|
13451
|
+
this.raise(Errors.UnsupportedMetaProperty, node.property, {
|
|
13756
13452
|
target: meta.name,
|
|
13757
13453
|
onlyValidPropertyName: propertyName
|
|
13758
13454
|
});
|
|
@@ -13764,9 +13460,7 @@ class ExpressionParser extends LValParser {
|
|
|
13764
13460
|
this.next();
|
|
13765
13461
|
if (this.isContextual(101)) {
|
|
13766
13462
|
if (!this.inModule) {
|
|
13767
|
-
this.raise(Errors.ImportMetaOutsideModule,
|
|
13768
|
-
at: id
|
|
13769
|
-
});
|
|
13463
|
+
this.raise(Errors.ImportMetaOutsideModule, id);
|
|
13770
13464
|
}
|
|
13771
13465
|
this.sawUnambiguousESM = true;
|
|
13772
13466
|
} else if (this.isContextual(105) || this.isContextual(97)) {
|
|
@@ -13774,8 +13468,7 @@ class ExpressionParser extends LValParser {
|
|
|
13774
13468
|
if (!isSource) this.unexpected();
|
|
13775
13469
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
13776
13470
|
if (!this.options.createImportExpressions) {
|
|
13777
|
-
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, {
|
|
13778
|
-
at: this.state.startLoc,
|
|
13471
|
+
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
|
|
13779
13472
|
phase: this.state.value
|
|
13780
13473
|
});
|
|
13781
13474
|
}
|
|
@@ -13921,9 +13614,7 @@ class ExpressionParser extends LValParser {
|
|
|
13921
13614
|
this.next();
|
|
13922
13615
|
const metaProp = this.parseMetaProperty(node, meta, "target");
|
|
13923
13616
|
if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
|
|
13924
|
-
this.raise(Errors.UnexpectedNewTarget,
|
|
13925
|
-
at: metaProp
|
|
13926
|
-
});
|
|
13617
|
+
this.raise(Errors.UnexpectedNewTarget, metaProp);
|
|
13927
13618
|
}
|
|
13928
13619
|
return metaProp;
|
|
13929
13620
|
}
|
|
@@ -13945,9 +13636,7 @@ class ExpressionParser extends LValParser {
|
|
|
13945
13636
|
const callee = this.parseNoCallExpr();
|
|
13946
13637
|
node.callee = callee;
|
|
13947
13638
|
if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
|
|
13948
|
-
this.raise(Errors.ImportCallNotNewExpression,
|
|
13949
|
-
at: callee
|
|
13950
|
-
});
|
|
13639
|
+
this.raise(Errors.ImportCallNotNewExpression, callee);
|
|
13951
13640
|
}
|
|
13952
13641
|
}
|
|
13953
13642
|
parseTemplateElement(isTagged) {
|
|
@@ -13961,9 +13650,7 @@ class ExpressionParser extends LValParser {
|
|
|
13961
13650
|
const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
|
|
13962
13651
|
if (value === null) {
|
|
13963
13652
|
if (!isTagged) {
|
|
13964
|
-
this.raise(Errors.InvalidEscapeSequenceTemplate,
|
|
13965
|
-
at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
|
|
13966
|
-
});
|
|
13653
|
+
this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
|
|
13967
13654
|
}
|
|
13968
13655
|
}
|
|
13969
13656
|
const isTail = this.match(24);
|
|
@@ -14023,9 +13710,7 @@ class ExpressionParser extends LValParser {
|
|
|
14023
13710
|
this.checkProto(prop, isRecord, propHash, refExpressionErrors);
|
|
14024
13711
|
}
|
|
14025
13712
|
if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
|
|
14026
|
-
this.raise(Errors.InvalidRecordProperty,
|
|
14027
|
-
at: prop
|
|
14028
|
-
});
|
|
13713
|
+
this.raise(Errors.InvalidRecordProperty, prop);
|
|
14029
13714
|
}
|
|
14030
13715
|
if (prop.shorthand) {
|
|
14031
13716
|
this.addExtra(prop, "shorthand", true);
|
|
@@ -14043,7 +13728,7 @@ class ExpressionParser extends LValParser {
|
|
|
14043
13728
|
return this.finishNode(node, type);
|
|
14044
13729
|
}
|
|
14045
13730
|
addTrailingCommaExtraToNode(node) {
|
|
14046
|
-
this.addExtra(node, "trailingComma", this.state.
|
|
13731
|
+
this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
|
|
14047
13732
|
this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
|
|
14048
13733
|
}
|
|
14049
13734
|
maybeAsyncOrAccessorProp(prop) {
|
|
@@ -14053,9 +13738,7 @@ class ExpressionParser extends LValParser {
|
|
|
14053
13738
|
let decorators = [];
|
|
14054
13739
|
if (this.match(26)) {
|
|
14055
13740
|
if (this.hasPlugin("decorators")) {
|
|
14056
|
-
this.raise(Errors.UnsupportedPropertyDecorator,
|
|
14057
|
-
at: this.state.startLoc
|
|
14058
|
-
});
|
|
13741
|
+
this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
|
|
14059
13742
|
}
|
|
14060
13743
|
while (this.match(26)) {
|
|
14061
13744
|
decorators.push(this.parseDecorator());
|
|
@@ -14095,8 +13778,7 @@ class ExpressionParser extends LValParser {
|
|
|
14095
13778
|
prop.kind = keyName;
|
|
14096
13779
|
if (this.match(55)) {
|
|
14097
13780
|
isGenerator = true;
|
|
14098
|
-
this.raise(Errors.AccessorIsGenerator, {
|
|
14099
|
-
at: this.state.curPosition(),
|
|
13781
|
+
this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
|
|
14100
13782
|
kind: keyName
|
|
14101
13783
|
});
|
|
14102
13784
|
this.next();
|
|
@@ -14117,14 +13799,10 @@ class ExpressionParser extends LValParser {
|
|
|
14117
13799
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
14118
13800
|
const params = this.getObjectOrClassMethodParams(method);
|
|
14119
13801
|
if (params.length !== paramCount) {
|
|
14120
|
-
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity,
|
|
14121
|
-
at: method
|
|
14122
|
-
});
|
|
13802
|
+
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
|
|
14123
13803
|
}
|
|
14124
13804
|
if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
|
|
14125
|
-
this.raise(Errors.BadSetterRestParameter,
|
|
14126
|
-
at: method
|
|
14127
|
-
});
|
|
13805
|
+
this.raise(Errors.BadSetterRestParameter, method);
|
|
14128
13806
|
}
|
|
14129
13807
|
}
|
|
14130
13808
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
@@ -14157,9 +13835,7 @@ class ExpressionParser extends LValParser {
|
|
|
14157
13835
|
refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
|
|
14158
13836
|
}
|
|
14159
13837
|
} else {
|
|
14160
|
-
this.raise(Errors.InvalidCoverInitializedName,
|
|
14161
|
-
at: shorthandAssignLoc
|
|
14162
|
-
});
|
|
13838
|
+
this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
14163
13839
|
}
|
|
14164
13840
|
prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
|
|
14165
13841
|
} else {
|
|
@@ -14209,9 +13885,7 @@ class ExpressionParser extends LValParser {
|
|
|
14209
13885
|
refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
14210
13886
|
}
|
|
14211
13887
|
} else {
|
|
14212
|
-
this.raise(Errors.UnexpectedPrivateField,
|
|
14213
|
-
at: privateKeyLoc
|
|
14214
|
-
});
|
|
13888
|
+
this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
14215
13889
|
}
|
|
14216
13890
|
key = this.parsePrivateName();
|
|
14217
13891
|
break;
|
|
@@ -14297,9 +13971,7 @@ class ExpressionParser extends LValParser {
|
|
|
14297
13971
|
node.body = this.parseBlock(true, false, hasStrictModeDirective => {
|
|
14298
13972
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
14299
13973
|
if (hasStrictModeDirective && nonSimple) {
|
|
14300
|
-
this.raise(Errors.IllegalLanguageModeDirective,
|
|
14301
|
-
at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
|
|
14302
|
-
});
|
|
13974
|
+
this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
|
|
14303
13975
|
}
|
|
14304
13976
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
14305
13977
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
@@ -14359,8 +14031,7 @@ class ExpressionParser extends LValParser {
|
|
|
14359
14031
|
let elt;
|
|
14360
14032
|
if (this.match(12)) {
|
|
14361
14033
|
if (!allowEmpty) {
|
|
14362
|
-
this.raise(Errors.UnexpectedToken, {
|
|
14363
|
-
at: this.state.curPosition(),
|
|
14034
|
+
this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
|
|
14364
14035
|
unexpected: ","
|
|
14365
14036
|
});
|
|
14366
14037
|
}
|
|
@@ -14371,9 +14042,7 @@ class ExpressionParser extends LValParser {
|
|
|
14371
14042
|
} else if (this.match(17)) {
|
|
14372
14043
|
this.expectPlugin("partialApplication");
|
|
14373
14044
|
if (!allowPlaceholder) {
|
|
14374
|
-
this.raise(Errors.UnexpectedArgumentPlaceholder,
|
|
14375
|
-
at: this.state.startLoc
|
|
14376
|
-
});
|
|
14045
|
+
this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
|
|
14377
14046
|
}
|
|
14378
14047
|
const node = this.startNode();
|
|
14379
14048
|
this.next();
|
|
@@ -14423,47 +14092,35 @@ class ExpressionParser extends LValParser {
|
|
|
14423
14092
|
return;
|
|
14424
14093
|
}
|
|
14425
14094
|
if (checkKeywords && isKeyword(word)) {
|
|
14426
|
-
this.raise(Errors.UnexpectedKeyword, {
|
|
14427
|
-
at: startLoc,
|
|
14095
|
+
this.raise(Errors.UnexpectedKeyword, startLoc, {
|
|
14428
14096
|
keyword: word
|
|
14429
14097
|
});
|
|
14430
14098
|
return;
|
|
14431
14099
|
}
|
|
14432
14100
|
const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
|
|
14433
14101
|
if (reservedTest(word, this.inModule)) {
|
|
14434
|
-
this.raise(Errors.UnexpectedReservedWord, {
|
|
14435
|
-
at: startLoc,
|
|
14102
|
+
this.raise(Errors.UnexpectedReservedWord, startLoc, {
|
|
14436
14103
|
reservedWord: word
|
|
14437
14104
|
});
|
|
14438
14105
|
return;
|
|
14439
14106
|
} else if (word === "yield") {
|
|
14440
14107
|
if (this.prodParam.hasYield) {
|
|
14441
|
-
this.raise(Errors.YieldBindingIdentifier,
|
|
14442
|
-
at: startLoc
|
|
14443
|
-
});
|
|
14108
|
+
this.raise(Errors.YieldBindingIdentifier, startLoc);
|
|
14444
14109
|
return;
|
|
14445
14110
|
}
|
|
14446
14111
|
} else if (word === "await") {
|
|
14447
14112
|
if (this.prodParam.hasAwait) {
|
|
14448
|
-
this.raise(Errors.AwaitBindingIdentifier,
|
|
14449
|
-
at: startLoc
|
|
14450
|
-
});
|
|
14113
|
+
this.raise(Errors.AwaitBindingIdentifier, startLoc);
|
|
14451
14114
|
return;
|
|
14452
14115
|
}
|
|
14453
14116
|
if (this.scope.inStaticBlock) {
|
|
14454
|
-
this.raise(Errors.AwaitBindingIdentifierInStaticBlock,
|
|
14455
|
-
at: startLoc
|
|
14456
|
-
});
|
|
14117
|
+
this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
|
|
14457
14118
|
return;
|
|
14458
14119
|
}
|
|
14459
|
-
this.expressionScope.recordAsyncArrowParametersError(
|
|
14460
|
-
at: startLoc
|
|
14461
|
-
});
|
|
14120
|
+
this.expressionScope.recordAsyncArrowParametersError(startLoc);
|
|
14462
14121
|
} else if (word === "arguments") {
|
|
14463
14122
|
if (this.scope.inClassAndNotInNonArrowFunction) {
|
|
14464
|
-
this.raise(Errors.ArgumentsInClass,
|
|
14465
|
-
at: startLoc
|
|
14466
|
-
});
|
|
14123
|
+
this.raise(Errors.ArgumentsInClass, startLoc);
|
|
14467
14124
|
return;
|
|
14468
14125
|
}
|
|
14469
14126
|
}
|
|
@@ -14477,13 +14134,9 @@ class ExpressionParser extends LValParser {
|
|
|
14477
14134
|
}
|
|
14478
14135
|
parseAwait(startLoc) {
|
|
14479
14136
|
const node = this.startNodeAt(startLoc);
|
|
14480
|
-
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter,
|
|
14481
|
-
at: node
|
|
14482
|
-
});
|
|
14137
|
+
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
|
|
14483
14138
|
if (this.eat(55)) {
|
|
14484
|
-
this.raise(Errors.ObsoleteAwaitStar,
|
|
14485
|
-
at: node
|
|
14486
|
-
});
|
|
14139
|
+
this.raise(Errors.ObsoleteAwaitStar, node);
|
|
14487
14140
|
}
|
|
14488
14141
|
if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
|
|
14489
14142
|
if (this.isAmbiguousAwait()) {
|
|
@@ -14506,9 +14159,7 @@ class ExpressionParser extends LValParser {
|
|
|
14506
14159
|
}
|
|
14507
14160
|
parseYield() {
|
|
14508
14161
|
const node = this.startNode();
|
|
14509
|
-
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter,
|
|
14510
|
-
at: node
|
|
14511
|
-
});
|
|
14162
|
+
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
|
|
14512
14163
|
this.next();
|
|
14513
14164
|
let delegating = false;
|
|
14514
14165
|
let argument = null;
|
|
@@ -14553,9 +14204,7 @@ class ExpressionParser extends LValParser {
|
|
|
14553
14204
|
proposal: "smart"
|
|
14554
14205
|
}])) {
|
|
14555
14206
|
if (left.type === "SequenceExpression") {
|
|
14556
|
-
this.raise(Errors.PipelineHeadSequenceExpression,
|
|
14557
|
-
at: leftStartLoc
|
|
14558
|
-
});
|
|
14207
|
+
this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
|
|
14559
14208
|
}
|
|
14560
14209
|
}
|
|
14561
14210
|
}
|
|
@@ -14583,14 +14232,10 @@ class ExpressionParser extends LValParser {
|
|
|
14583
14232
|
}
|
|
14584
14233
|
checkSmartPipeTopicBodyEarlyErrors(startLoc) {
|
|
14585
14234
|
if (this.match(19)) {
|
|
14586
|
-
throw this.raise(Errors.PipelineBodyNoArrow,
|
|
14587
|
-
at: this.state.startLoc
|
|
14588
|
-
});
|
|
14235
|
+
throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
|
|
14589
14236
|
}
|
|
14590
14237
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
14591
|
-
this.raise(Errors.PipelineTopicUnused,
|
|
14592
|
-
at: startLoc
|
|
14593
|
-
});
|
|
14238
|
+
this.raise(Errors.PipelineTopicUnused, startLoc);
|
|
14594
14239
|
}
|
|
14595
14240
|
}
|
|
14596
14241
|
withTopicBindingContext(callback) {
|
|
@@ -14697,10 +14342,10 @@ class ExpressionParser extends LValParser {
|
|
|
14697
14342
|
parsePropertyNamePrefixOperator(prop) {}
|
|
14698
14343
|
}
|
|
14699
14344
|
const loopLabel = {
|
|
14700
|
-
kind:
|
|
14345
|
+
kind: 1
|
|
14701
14346
|
},
|
|
14702
14347
|
switchLabel = {
|
|
14703
|
-
kind:
|
|
14348
|
+
kind: 2
|
|
14704
14349
|
};
|
|
14705
14350
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
14706
14351
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
@@ -14814,7 +14459,7 @@ function babel7CompatTokens(tokens, input) {
|
|
|
14814
14459
|
class StatementParser extends ExpressionParser {
|
|
14815
14460
|
parseTopLevel(file, program) {
|
|
14816
14461
|
file.program = this.parseProgram(program);
|
|
14817
|
-
file.comments = this.
|
|
14462
|
+
file.comments = this.comments;
|
|
14818
14463
|
if (this.options.tokens) {
|
|
14819
14464
|
file.tokens = babel7CompatTokens(this.tokens, this.input);
|
|
14820
14465
|
}
|
|
@@ -14826,8 +14471,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14826
14471
|
this.parseBlockBody(program, true, true, end);
|
|
14827
14472
|
if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
|
|
14828
14473
|
for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
|
|
14829
|
-
this.raise(Errors.ModuleExportUndefined, {
|
|
14830
|
-
at,
|
|
14474
|
+
this.raise(Errors.ModuleExportUndefined, at, {
|
|
14831
14475
|
localName
|
|
14832
14476
|
});
|
|
14833
14477
|
}
|
|
@@ -14969,9 +14613,7 @@ class StatementParser extends ExpressionParser {
|
|
|
14969
14613
|
case 68:
|
|
14970
14614
|
if (this.lookaheadCharCode() === 46) break;
|
|
14971
14615
|
if (!allowFunctionDeclaration) {
|
|
14972
|
-
this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction,
|
|
14973
|
-
at: this.state.startLoc
|
|
14974
|
-
});
|
|
14616
|
+
this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
|
|
14975
14617
|
}
|
|
14976
14618
|
return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
|
|
14977
14619
|
case 80:
|
|
@@ -14990,13 +14632,9 @@ class StatementParser extends ExpressionParser {
|
|
|
14990
14632
|
case 96:
|
|
14991
14633
|
if (!this.state.containsEsc && this.startsAwaitUsing()) {
|
|
14992
14634
|
if (!this.isAwaitAllowed()) {
|
|
14993
|
-
this.raise(Errors.AwaitUsingNotInAsyncContext,
|
|
14994
|
-
at: node
|
|
14995
|
-
});
|
|
14635
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, node);
|
|
14996
14636
|
} else if (!allowDeclaration) {
|
|
14997
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
14998
|
-
at: node
|
|
14999
|
-
});
|
|
14637
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
15000
14638
|
}
|
|
15001
14639
|
this.next();
|
|
15002
14640
|
return this.parseVarStatement(node, "await using");
|
|
@@ -15008,13 +14646,9 @@ class StatementParser extends ExpressionParser {
|
|
|
15008
14646
|
}
|
|
15009
14647
|
this.expectPlugin("explicitResourceManagement");
|
|
15010
14648
|
if (!this.scope.inModule && this.scope.inTopLevel) {
|
|
15011
|
-
this.raise(Errors.UnexpectedUsingDeclaration,
|
|
15012
|
-
at: this.state.startLoc
|
|
15013
|
-
});
|
|
14649
|
+
this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
15014
14650
|
} else if (!allowDeclaration) {
|
|
15015
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
15016
|
-
at: this.state.startLoc
|
|
15017
|
-
});
|
|
14651
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
15018
14652
|
}
|
|
15019
14653
|
return this.parseVarStatement(node, "using");
|
|
15020
14654
|
case 100:
|
|
@@ -15034,9 +14668,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15034
14668
|
case 75:
|
|
15035
14669
|
{
|
|
15036
14670
|
if (!allowDeclaration) {
|
|
15037
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
15038
|
-
at: this.state.startLoc
|
|
15039
|
-
});
|
|
14671
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
15040
14672
|
}
|
|
15041
14673
|
}
|
|
15042
14674
|
case 74:
|
|
@@ -15062,9 +14694,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15062
14694
|
case 82:
|
|
15063
14695
|
{
|
|
15064
14696
|
if (!this.options.allowImportExportEverywhere && !topLevel) {
|
|
15065
|
-
this.raise(Errors.UnexpectedImportExport,
|
|
15066
|
-
at: this.state.startLoc
|
|
15067
|
-
});
|
|
14697
|
+
this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
|
|
15068
14698
|
}
|
|
15069
14699
|
this.next();
|
|
15070
14700
|
let result;
|
|
@@ -15086,9 +14716,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15086
14716
|
{
|
|
15087
14717
|
if (this.isAsyncFunction()) {
|
|
15088
14718
|
if (!allowDeclaration) {
|
|
15089
|
-
this.raise(Errors.AsyncFunctionInSingleStatementContext,
|
|
15090
|
-
at: this.state.startLoc
|
|
15091
|
-
});
|
|
14719
|
+
this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
15092
14720
|
}
|
|
15093
14721
|
this.next();
|
|
15094
14722
|
return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
|
|
@@ -15105,9 +14733,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15105
14733
|
}
|
|
15106
14734
|
assertModuleNodeAllowed(node) {
|
|
15107
14735
|
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
|
15108
|
-
this.raise(Errors.ImportOutsideModule,
|
|
15109
|
-
at: node
|
|
15110
|
-
});
|
|
14736
|
+
this.raise(Errors.ImportOutsideModule, node);
|
|
15111
14737
|
}
|
|
15112
14738
|
}
|
|
15113
14739
|
decoratorsEnabledBeforeExport() {
|
|
@@ -15118,9 +14744,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15118
14744
|
if (maybeDecorators) {
|
|
15119
14745
|
if (classNode.decorators && classNode.decorators.length > 0) {
|
|
15120
14746
|
if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
|
|
15121
|
-
this.raise(Errors.DecoratorsBeforeAfterExport,
|
|
15122
|
-
at: classNode.decorators[0]
|
|
15123
|
-
});
|
|
14747
|
+
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
15124
14748
|
}
|
|
15125
14749
|
classNode.decorators.unshift(...maybeDecorators);
|
|
15126
14750
|
} else {
|
|
@@ -15144,14 +14768,10 @@ class StatementParser extends ExpressionParser {
|
|
|
15144
14768
|
this.unexpected();
|
|
15145
14769
|
}
|
|
15146
14770
|
if (!this.decoratorsEnabledBeforeExport()) {
|
|
15147
|
-
this.raise(Errors.DecoratorExportClass,
|
|
15148
|
-
at: this.state.startLoc
|
|
15149
|
-
});
|
|
14771
|
+
this.raise(Errors.DecoratorExportClass, this.state.startLoc);
|
|
15150
14772
|
}
|
|
15151
14773
|
} else if (!this.canHaveLeadingDecorator()) {
|
|
15152
|
-
throw this.raise(Errors.UnexpectedLeadingDecorator,
|
|
15153
|
-
at: this.state.startLoc
|
|
15154
|
-
});
|
|
14774
|
+
throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
|
|
15155
14775
|
}
|
|
15156
14776
|
return decorators;
|
|
15157
14777
|
}
|
|
@@ -15171,9 +14791,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15171
14791
|
const paramsStartLoc = this.state.startLoc;
|
|
15172
14792
|
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
15173
14793
|
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
15174
|
-
this.raise(Errors.DecoratorArgumentsOutsideParentheses,
|
|
15175
|
-
at: paramsStartLoc
|
|
15176
|
-
});
|
|
14794
|
+
this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
|
|
15177
14795
|
}
|
|
15178
14796
|
} else {
|
|
15179
14797
|
expr = this.parseIdentifier(false);
|
|
@@ -15222,14 +14840,15 @@ class StatementParser extends ExpressionParser {
|
|
|
15222
14840
|
for (i = 0; i < this.state.labels.length; ++i) {
|
|
15223
14841
|
const lab = this.state.labels[i];
|
|
15224
14842
|
if (node.label == null || lab.name === node.label.name) {
|
|
15225
|
-
if (lab.kind != null && (isBreak || lab.kind ===
|
|
14843
|
+
if (lab.kind != null && (isBreak || lab.kind === 1)) {
|
|
14844
|
+
break;
|
|
14845
|
+
}
|
|
15226
14846
|
if (node.label && isBreak) break;
|
|
15227
14847
|
}
|
|
15228
14848
|
}
|
|
15229
14849
|
if (i === this.state.labels.length) {
|
|
15230
14850
|
const type = isBreak ? "BreakStatement" : "ContinueStatement";
|
|
15231
|
-
this.raise(Errors.IllegalBreakContinue, {
|
|
15232
|
-
at: node,
|
|
14851
|
+
this.raise(Errors.IllegalBreakContinue, node, {
|
|
15233
14852
|
type
|
|
15234
14853
|
});
|
|
15235
14854
|
}
|
|
@@ -15281,9 +14900,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15281
14900
|
if (startsWithAwaitUsing) {
|
|
15282
14901
|
kind = "await using";
|
|
15283
14902
|
if (!this.isAwaitAllowed()) {
|
|
15284
|
-
this.raise(Errors.AwaitUsingNotInAsyncContext,
|
|
15285
|
-
at: this.state.startLoc
|
|
15286
|
-
});
|
|
14903
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
|
|
15287
14904
|
}
|
|
15288
14905
|
this.next();
|
|
15289
14906
|
} else {
|
|
@@ -15294,9 +14911,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15294
14911
|
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
15295
14912
|
const isForIn = this.match(58);
|
|
15296
14913
|
if (isForIn && starsWithUsingDeclaration) {
|
|
15297
|
-
this.raise(Errors.ForInUsing,
|
|
15298
|
-
at: init
|
|
15299
|
-
});
|
|
14914
|
+
this.raise(Errors.ForInUsing, init);
|
|
15300
14915
|
}
|
|
15301
14916
|
if ((isForIn || this.isContextual(102)) && init.declarations.length === 1) {
|
|
15302
14917
|
return this.parseForIn(node, init, awaitAt);
|
|
@@ -15313,14 +14928,10 @@ class StatementParser extends ExpressionParser {
|
|
|
15313
14928
|
const isForOf = this.isContextual(102);
|
|
15314
14929
|
if (isForOf) {
|
|
15315
14930
|
if (startsWithLet) {
|
|
15316
|
-
this.raise(Errors.ForOfLet,
|
|
15317
|
-
at: init
|
|
15318
|
-
});
|
|
14931
|
+
this.raise(Errors.ForOfLet, init);
|
|
15319
14932
|
}
|
|
15320
14933
|
if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
15321
|
-
this.raise(Errors.ForOfAsync,
|
|
15322
|
-
at: init
|
|
15323
|
-
});
|
|
14934
|
+
this.raise(Errors.ForOfAsync, init);
|
|
15324
14935
|
}
|
|
15325
14936
|
}
|
|
15326
14937
|
if (isForOf || this.match(58)) {
|
|
@@ -15354,9 +14965,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15354
14965
|
}
|
|
15355
14966
|
parseReturnStatement(node) {
|
|
15356
14967
|
if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
|
|
15357
|
-
this.raise(Errors.IllegalReturn,
|
|
15358
|
-
at: this.state.startLoc
|
|
15359
|
-
});
|
|
14968
|
+
this.raise(Errors.IllegalReturn, this.state.startLoc);
|
|
15360
14969
|
}
|
|
15361
14970
|
this.next();
|
|
15362
14971
|
if (this.isLineTerminator()) {
|
|
@@ -15386,9 +14995,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15386
14995
|
cur.test = this.parseExpression();
|
|
15387
14996
|
} else {
|
|
15388
14997
|
if (sawDefault) {
|
|
15389
|
-
this.raise(Errors.MultipleDefaultsInSwitch,
|
|
15390
|
-
at: this.state.lastTokStartLoc
|
|
15391
|
-
});
|
|
14998
|
+
this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
|
|
15392
14999
|
}
|
|
15393
15000
|
sawDefault = true;
|
|
15394
15001
|
cur.test = null;
|
|
@@ -15411,9 +15018,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15411
15018
|
parseThrowStatement(node) {
|
|
15412
15019
|
this.next();
|
|
15413
15020
|
if (this.hasPrecedingLineBreak()) {
|
|
15414
|
-
this.raise(Errors.NewlineAfterThrow,
|
|
15415
|
-
at: this.state.lastTokEndLoc
|
|
15416
|
-
});
|
|
15021
|
+
this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
|
|
15417
15022
|
}
|
|
15418
15023
|
node.argument = this.parseExpression();
|
|
15419
15024
|
this.semicolon();
|
|
@@ -15451,9 +15056,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15451
15056
|
}
|
|
15452
15057
|
node.finalizer = this.eat(67) ? this.parseBlock() : null;
|
|
15453
15058
|
if (!node.handler && !node.finalizer) {
|
|
15454
|
-
this.raise(Errors.NoCatchOrFinally,
|
|
15455
|
-
at: node
|
|
15456
|
-
});
|
|
15059
|
+
this.raise(Errors.NoCatchOrFinally, node);
|
|
15457
15060
|
}
|
|
15458
15061
|
return this.finishNode(node, "TryStatement");
|
|
15459
15062
|
}
|
|
@@ -15473,9 +15076,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15473
15076
|
}
|
|
15474
15077
|
parseWithStatement(node) {
|
|
15475
15078
|
if (this.state.strict) {
|
|
15476
|
-
this.raise(Errors.StrictWith,
|
|
15477
|
-
at: this.state.startLoc
|
|
15478
|
-
});
|
|
15079
|
+
this.raise(Errors.StrictWith, this.state.startLoc);
|
|
15479
15080
|
}
|
|
15480
15081
|
this.next();
|
|
15481
15082
|
node.object = this.parseHeaderExpression();
|
|
@@ -15489,13 +15090,12 @@ class StatementParser extends ExpressionParser {
|
|
|
15489
15090
|
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
15490
15091
|
for (const label of this.state.labels) {
|
|
15491
15092
|
if (label.name === maybeName) {
|
|
15492
|
-
this.raise(Errors.LabelRedeclaration, {
|
|
15493
|
-
at: expr,
|
|
15093
|
+
this.raise(Errors.LabelRedeclaration, expr, {
|
|
15494
15094
|
labelName: maybeName
|
|
15495
15095
|
});
|
|
15496
15096
|
}
|
|
15497
15097
|
}
|
|
15498
|
-
const kind = tokenIsLoop(this.state.type) ?
|
|
15098
|
+
const kind = tokenIsLoop(this.state.type) ? 1 : this.match(71) ? 2 : null;
|
|
15499
15099
|
for (let i = this.state.labels.length - 1; i >= 0; i--) {
|
|
15500
15100
|
const label = this.state.labels[i];
|
|
15501
15101
|
if (label.statementStart === node.start) {
|
|
@@ -15591,14 +15191,12 @@ class StatementParser extends ExpressionParser {
|
|
|
15591
15191
|
node.await = awaitAt !== null;
|
|
15592
15192
|
}
|
|
15593
15193
|
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
|
|
15594
|
-
this.raise(Errors.ForInOfLoopInitializer, {
|
|
15595
|
-
at: init,
|
|
15194
|
+
this.raise(Errors.ForInOfLoopInitializer, init, {
|
|
15596
15195
|
type: isForIn ? "ForInStatement" : "ForOfStatement"
|
|
15597
15196
|
});
|
|
15598
15197
|
}
|
|
15599
15198
|
if (init.type === "AssignmentPattern") {
|
|
15600
|
-
this.raise(Errors.InvalidLhs, {
|
|
15601
|
-
at: init,
|
|
15199
|
+
this.raise(Errors.InvalidLhs, init, {
|
|
15602
15200
|
ancestor: {
|
|
15603
15201
|
type: "ForStatement"
|
|
15604
15202
|
}
|
|
@@ -15621,13 +15219,11 @@ class StatementParser extends ExpressionParser {
|
|
|
15621
15219
|
decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
15622
15220
|
if (decl.init === null && !allowMissingInitializer) {
|
|
15623
15221
|
if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
|
|
15624
|
-
this.raise(Errors.DeclarationMissingInitializer, {
|
|
15625
|
-
at: this.state.lastTokEndLoc,
|
|
15222
|
+
this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
|
|
15626
15223
|
kind: "destructuring"
|
|
15627
15224
|
});
|
|
15628
15225
|
} else if (kind === "const" && !(this.match(58) || this.isContextual(102))) {
|
|
15629
|
-
this.raise(Errors.DeclarationMissingInitializer, {
|
|
15630
|
-
at: this.state.lastTokEndLoc,
|
|
15226
|
+
this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
|
|
15631
15227
|
kind: "const"
|
|
15632
15228
|
});
|
|
15633
15229
|
}
|
|
@@ -15658,9 +15254,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15658
15254
|
this.initFunction(node, isAsync);
|
|
15659
15255
|
if (this.match(55)) {
|
|
15660
15256
|
if (hangingDeclaration) {
|
|
15661
|
-
this.raise(Errors.GeneratorInSingleStatementContext,
|
|
15662
|
-
at: this.state.startLoc
|
|
15663
|
-
});
|
|
15257
|
+
this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
15664
15258
|
}
|
|
15665
15259
|
this.next();
|
|
15666
15260
|
node.generator = true;
|
|
@@ -15732,9 +15326,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15732
15326
|
while (!this.match(8)) {
|
|
15733
15327
|
if (this.eat(13)) {
|
|
15734
15328
|
if (decorators.length > 0) {
|
|
15735
|
-
throw this.raise(Errors.DecoratorSemicolon,
|
|
15736
|
-
at: this.state.lastTokEndLoc
|
|
15737
|
-
});
|
|
15329
|
+
throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
|
|
15738
15330
|
}
|
|
15739
15331
|
continue;
|
|
15740
15332
|
}
|
|
@@ -15750,18 +15342,14 @@ class StatementParser extends ExpressionParser {
|
|
|
15750
15342
|
}
|
|
15751
15343
|
this.parseClassMember(classBody, member, state);
|
|
15752
15344
|
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
|
|
15753
|
-
this.raise(Errors.DecoratorConstructor,
|
|
15754
|
-
at: member
|
|
15755
|
-
});
|
|
15345
|
+
this.raise(Errors.DecoratorConstructor, member);
|
|
15756
15346
|
}
|
|
15757
15347
|
}
|
|
15758
15348
|
});
|
|
15759
15349
|
this.state.strict = oldStrict;
|
|
15760
15350
|
this.next();
|
|
15761
15351
|
if (decorators.length) {
|
|
15762
|
-
throw this.raise(Errors.TrailingDecorator,
|
|
15763
|
-
at: this.state.startLoc
|
|
15764
|
-
});
|
|
15352
|
+
throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
|
|
15765
15353
|
}
|
|
15766
15354
|
this.classScope.exit();
|
|
15767
15355
|
return this.finishNode(classBody, "ClassBody");
|
|
@@ -15819,9 +15407,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15819
15407
|
return;
|
|
15820
15408
|
}
|
|
15821
15409
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
15822
|
-
this.raise(Errors.ConstructorIsGenerator,
|
|
15823
|
-
at: publicMethod.key
|
|
15824
|
-
});
|
|
15410
|
+
this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
|
|
15825
15411
|
}
|
|
15826
15412
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
15827
15413
|
return;
|
|
@@ -15842,14 +15428,10 @@ class StatementParser extends ExpressionParser {
|
|
|
15842
15428
|
if (isConstructor) {
|
|
15843
15429
|
publicMethod.kind = "constructor";
|
|
15844
15430
|
if (state.hadConstructor && !this.hasPlugin("typescript")) {
|
|
15845
|
-
this.raise(Errors.DuplicateConstructor,
|
|
15846
|
-
at: key
|
|
15847
|
-
});
|
|
15431
|
+
this.raise(Errors.DuplicateConstructor, key);
|
|
15848
15432
|
}
|
|
15849
15433
|
if (isConstructor && this.hasPlugin("typescript") && member.override) {
|
|
15850
|
-
this.raise(Errors.OverrideOnConstructor,
|
|
15851
|
-
at: key
|
|
15852
|
-
});
|
|
15434
|
+
this.raise(Errors.OverrideOnConstructor, key);
|
|
15853
15435
|
}
|
|
15854
15436
|
state.hadConstructor = true;
|
|
15855
15437
|
allowsDirectSuper = state.hadSuperClass;
|
|
@@ -15875,9 +15457,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15875
15457
|
this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
15876
15458
|
} else {
|
|
15877
15459
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
15878
|
-
this.raise(Errors.ConstructorIsAsync,
|
|
15879
|
-
at: publicMethod.key
|
|
15880
|
-
});
|
|
15460
|
+
this.raise(Errors.ConstructorIsAsync, publicMethod.key);
|
|
15881
15461
|
}
|
|
15882
15462
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
15883
15463
|
}
|
|
@@ -15890,9 +15470,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15890
15470
|
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
15891
15471
|
} else {
|
|
15892
15472
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
15893
|
-
this.raise(Errors.ConstructorIsAccessor,
|
|
15894
|
-
at: publicMethod.key
|
|
15895
|
-
});
|
|
15473
|
+
this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
|
|
15896
15474
|
}
|
|
15897
15475
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
15898
15476
|
}
|
|
@@ -15919,15 +15497,11 @@ class StatementParser extends ExpressionParser {
|
|
|
15919
15497
|
value
|
|
15920
15498
|
} = this.state;
|
|
15921
15499
|
if ((type === 132 || type === 133) && member.static && value === "prototype") {
|
|
15922
|
-
this.raise(Errors.StaticPrototype,
|
|
15923
|
-
at: this.state.startLoc
|
|
15924
|
-
});
|
|
15500
|
+
this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
15925
15501
|
}
|
|
15926
15502
|
if (type === 138) {
|
|
15927
15503
|
if (value === "constructor") {
|
|
15928
|
-
this.raise(Errors.ConstructorClassPrivateField,
|
|
15929
|
-
at: this.state.startLoc
|
|
15930
|
-
});
|
|
15504
|
+
this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
15931
15505
|
}
|
|
15932
15506
|
const key = this.parsePrivateName();
|
|
15933
15507
|
member.key = key;
|
|
@@ -15948,16 +15522,12 @@ class StatementParser extends ExpressionParser {
|
|
|
15948
15522
|
this.state.labels = oldLabels;
|
|
15949
15523
|
classBody.body.push(this.finishNode(member, "StaticBlock"));
|
|
15950
15524
|
if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
|
|
15951
|
-
this.raise(Errors.DecoratorStaticBlock,
|
|
15952
|
-
at: member
|
|
15953
|
-
});
|
|
15525
|
+
this.raise(Errors.DecoratorStaticBlock, member);
|
|
15954
15526
|
}
|
|
15955
15527
|
}
|
|
15956
15528
|
pushClassProperty(classBody, prop) {
|
|
15957
15529
|
if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
|
|
15958
|
-
this.raise(Errors.ConstructorClassField,
|
|
15959
|
-
at: prop.key
|
|
15960
|
-
});
|
|
15530
|
+
this.raise(Errors.ConstructorClassField, prop.key);
|
|
15961
15531
|
}
|
|
15962
15532
|
classBody.body.push(this.parseClassProperty(prop));
|
|
15963
15533
|
}
|
|
@@ -15970,9 +15540,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15970
15540
|
if (!isPrivate && !prop.computed) {
|
|
15971
15541
|
const key = prop.key;
|
|
15972
15542
|
if (key.name === "constructor" || key.value === "constructor") {
|
|
15973
|
-
this.raise(Errors.ConstructorClassField,
|
|
15974
|
-
at: key
|
|
15975
|
-
});
|
|
15543
|
+
this.raise(Errors.ConstructorClassField, key);
|
|
15976
15544
|
}
|
|
15977
15545
|
}
|
|
15978
15546
|
const node = this.parseClassAccessorProperty(prop);
|
|
@@ -16028,9 +15596,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16028
15596
|
if (optionalId || !isStatement) {
|
|
16029
15597
|
node.id = null;
|
|
16030
15598
|
} else {
|
|
16031
|
-
throw this.raise(Errors.MissingClassName,
|
|
16032
|
-
at: this.state.startLoc
|
|
16033
|
-
});
|
|
15599
|
+
throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
16034
15600
|
}
|
|
16035
15601
|
}
|
|
16036
15602
|
}
|
|
@@ -16048,9 +15614,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16048
15614
|
if (hasStar && !hasNamespace) {
|
|
16049
15615
|
if (hasDefault) this.unexpected();
|
|
16050
15616
|
if (decorators) {
|
|
16051
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
16052
|
-
at: node
|
|
16053
|
-
});
|
|
15617
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
16054
15618
|
}
|
|
16055
15619
|
this.parseExportFrom(node, true);
|
|
16056
15620
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
@@ -16066,9 +15630,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16066
15630
|
if (isFromRequired || hasSpecifiers) {
|
|
16067
15631
|
hasDeclaration = false;
|
|
16068
15632
|
if (decorators) {
|
|
16069
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
16070
|
-
at: node
|
|
16071
|
-
});
|
|
15633
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
16072
15634
|
}
|
|
16073
15635
|
this.parseExportFrom(node, isFromRequired);
|
|
16074
15636
|
} else {
|
|
@@ -16081,9 +15643,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16081
15643
|
if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
|
|
16082
15644
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
16083
15645
|
} else if (decorators) {
|
|
16084
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
16085
|
-
at: node
|
|
16086
|
-
});
|
|
15646
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
16087
15647
|
}
|
|
16088
15648
|
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
16089
15649
|
}
|
|
@@ -16094,9 +15654,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16094
15654
|
if (decl.type === "ClassDeclaration") {
|
|
16095
15655
|
this.maybeTakeDecorators(decorators, decl, node2);
|
|
16096
15656
|
} else if (decorators) {
|
|
16097
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
16098
|
-
at: node
|
|
16099
|
-
});
|
|
15657
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
16100
15658
|
}
|
|
16101
15659
|
this.checkExport(node2, true, true);
|
|
16102
15660
|
return this.finishNode(node2, "ExportDefaultDeclaration");
|
|
@@ -16174,16 +15732,12 @@ class StatementParser extends ExpressionParser {
|
|
|
16174
15732
|
}
|
|
16175
15733
|
if (this.match(26)) {
|
|
16176
15734
|
if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
16177
|
-
this.raise(Errors.DecoratorBeforeExport,
|
|
16178
|
-
at: this.state.startLoc
|
|
16179
|
-
});
|
|
15735
|
+
this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
|
|
16180
15736
|
}
|
|
16181
15737
|
return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
16182
15738
|
}
|
|
16183
15739
|
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
16184
|
-
throw this.raise(Errors.UnsupportedDefaultExport,
|
|
16185
|
-
at: this.state.startLoc
|
|
16186
|
-
});
|
|
15740
|
+
throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
16187
15741
|
}
|
|
16188
15742
|
const res = this.parseMaybeAssignAllowIn();
|
|
16189
15743
|
this.semicolon();
|
|
@@ -16246,9 +15800,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16246
15800
|
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
16247
15801
|
if (this.hasPlugin("decorators")) {
|
|
16248
15802
|
if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
16249
|
-
this.raise(Errors.DecoratorBeforeExport,
|
|
16250
|
-
at: this.state.startLoc
|
|
16251
|
-
});
|
|
15803
|
+
this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
|
|
16252
15804
|
}
|
|
16253
15805
|
return true;
|
|
16254
15806
|
}
|
|
@@ -16264,9 +15816,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16264
15816
|
var _declaration$extra;
|
|
16265
15817
|
const declaration = node.declaration;
|
|
16266
15818
|
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
16267
|
-
this.raise(Errors.ExportDefaultFromAsIdentifier,
|
|
16268
|
-
at: declaration
|
|
16269
|
-
});
|
|
15819
|
+
this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
|
|
16270
15820
|
}
|
|
16271
15821
|
}
|
|
16272
15822
|
} else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
|
|
@@ -16281,8 +15831,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16281
15831
|
local
|
|
16282
15832
|
} = specifier;
|
|
16283
15833
|
if (local.type !== "Identifier") {
|
|
16284
|
-
this.raise(Errors.ExportBindingIsString, {
|
|
16285
|
-
at: specifier,
|
|
15834
|
+
this.raise(Errors.ExportBindingIsString, specifier, {
|
|
16286
15835
|
localName: local.value,
|
|
16287
15836
|
exportName
|
|
16288
15837
|
});
|
|
@@ -16329,12 +15878,9 @@ class StatementParser extends ExpressionParser {
|
|
|
16329
15878
|
checkDuplicateExports(node, exportName) {
|
|
16330
15879
|
if (this.exportedIdentifiers.has(exportName)) {
|
|
16331
15880
|
if (exportName === "default") {
|
|
16332
|
-
this.raise(Errors.DuplicateDefaultExport,
|
|
16333
|
-
at: node
|
|
16334
|
-
});
|
|
15881
|
+
this.raise(Errors.DuplicateDefaultExport, node);
|
|
16335
15882
|
} else {
|
|
16336
|
-
this.raise(Errors.DuplicateExport, {
|
|
16337
|
-
at: node,
|
|
15883
|
+
this.raise(Errors.DuplicateExport, node, {
|
|
16338
15884
|
exportName
|
|
16339
15885
|
});
|
|
16340
15886
|
}
|
|
@@ -16375,8 +15921,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16375
15921
|
const result = this.parseStringLiteral(this.state.value);
|
|
16376
15922
|
const surrogate = result.value.match(loneSurrogate);
|
|
16377
15923
|
if (surrogate) {
|
|
16378
|
-
this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
|
|
16379
|
-
at: result,
|
|
15924
|
+
this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
|
|
16380
15925
|
surrogateCharCode: surrogate[0].charCodeAt(0)
|
|
16381
15926
|
});
|
|
16382
15927
|
}
|
|
@@ -16402,27 +15947,19 @@ class StatementParser extends ExpressionParser {
|
|
|
16402
15947
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
16403
15948
|
if (node.phase === "source") {
|
|
16404
15949
|
if (singleBindingType !== "ImportDefaultSpecifier") {
|
|
16405
|
-
this.raise(Errors.SourcePhaseImportRequiresDefault,
|
|
16406
|
-
at: specifiers[0].loc.start
|
|
16407
|
-
});
|
|
15950
|
+
this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
|
|
16408
15951
|
}
|
|
16409
15952
|
} else if (node.phase === "defer") {
|
|
16410
15953
|
if (singleBindingType !== "ImportNamespaceSpecifier") {
|
|
16411
|
-
this.raise(Errors.DeferImportRequiresNamespace,
|
|
16412
|
-
at: specifiers[0].loc.start
|
|
16413
|
-
});
|
|
15954
|
+
this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
|
|
16414
15955
|
}
|
|
16415
15956
|
} else if (node.module) {
|
|
16416
15957
|
var _node$assertions;
|
|
16417
15958
|
if (singleBindingType !== "ImportDefaultSpecifier") {
|
|
16418
|
-
this.raise(Errors.ImportReflectionNotBinding,
|
|
16419
|
-
at: specifiers[0].loc.start
|
|
16420
|
-
});
|
|
15959
|
+
this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
|
|
16421
15960
|
}
|
|
16422
15961
|
if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
|
|
16423
|
-
this.raise(Errors.ImportReflectionHasAssertion,
|
|
16424
|
-
at: node.specifiers[0].loc.start
|
|
16425
|
-
});
|
|
15962
|
+
this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
|
|
16426
15963
|
}
|
|
16427
15964
|
}
|
|
16428
15965
|
}
|
|
@@ -16444,9 +15981,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16444
15981
|
}
|
|
16445
15982
|
});
|
|
16446
15983
|
if (nonDefaultNamedSpecifier !== undefined) {
|
|
16447
|
-
this.raise(Errors.ImportJSONBindingNotDefault,
|
|
16448
|
-
at: nonDefaultNamedSpecifier.loc.start
|
|
16449
|
-
});
|
|
15984
|
+
this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
|
|
16450
15985
|
}
|
|
16451
15986
|
}
|
|
16452
15987
|
}
|
|
@@ -16553,8 +16088,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16553
16088
|
const node = this.startNode();
|
|
16554
16089
|
const keyName = this.state.value;
|
|
16555
16090
|
if (attrNames.has(keyName)) {
|
|
16556
|
-
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
16557
|
-
at: this.state.startLoc,
|
|
16091
|
+
this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
|
|
16558
16092
|
key: keyName
|
|
16559
16093
|
});
|
|
16560
16094
|
}
|
|
@@ -16566,9 +16100,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16566
16100
|
}
|
|
16567
16101
|
this.expect(14);
|
|
16568
16102
|
if (!this.match(133)) {
|
|
16569
|
-
throw this.raise(Errors.ModuleAttributeInvalidValue,
|
|
16570
|
-
at: this.state.startLoc
|
|
16571
|
-
});
|
|
16103
|
+
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
16572
16104
|
}
|
|
16573
16105
|
node.value = this.parseStringLiteral(this.state.value);
|
|
16574
16106
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
@@ -16583,22 +16115,17 @@ class StatementParser extends ExpressionParser {
|
|
|
16583
16115
|
const node = this.startNode();
|
|
16584
16116
|
node.key = this.parseIdentifier(true);
|
|
16585
16117
|
if (node.key.name !== "type") {
|
|
16586
|
-
this.raise(Errors.ModuleAttributeDifferentFromType,
|
|
16587
|
-
at: node.key
|
|
16588
|
-
});
|
|
16118
|
+
this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
|
|
16589
16119
|
}
|
|
16590
16120
|
if (attributes.has(node.key.name)) {
|
|
16591
|
-
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
16592
|
-
at: node.key,
|
|
16121
|
+
this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
|
|
16593
16122
|
key: node.key.name
|
|
16594
16123
|
});
|
|
16595
16124
|
}
|
|
16596
16125
|
attributes.add(node.key.name);
|
|
16597
16126
|
this.expect(14);
|
|
16598
16127
|
if (!this.match(133)) {
|
|
16599
|
-
throw this.raise(Errors.ModuleAttributeInvalidValue,
|
|
16600
|
-
at: this.state.startLoc
|
|
16601
|
-
});
|
|
16128
|
+
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
16602
16129
|
}
|
|
16603
16130
|
node.value = this.parseStringLiteral(this.state.value);
|
|
16604
16131
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
@@ -16625,9 +16152,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16625
16152
|
} else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
|
|
16626
16153
|
if (this.hasPlugin("importAttributes")) {
|
|
16627
16154
|
if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
|
|
16628
|
-
this.raise(Errors.ImportAttributesUseAssert,
|
|
16629
|
-
at: this.state.startLoc
|
|
16630
|
-
});
|
|
16155
|
+
this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
|
|
16631
16156
|
}
|
|
16632
16157
|
this.addExtra(node, "deprecatedAssertSyntax", true);
|
|
16633
16158
|
} else {
|
|
@@ -16678,9 +16203,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16678
16203
|
first = false;
|
|
16679
16204
|
} else {
|
|
16680
16205
|
if (this.eat(14)) {
|
|
16681
|
-
throw this.raise(Errors.DestructureNamedImport,
|
|
16682
|
-
at: this.state.startLoc
|
|
16683
|
-
});
|
|
16206
|
+
throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
|
|
16684
16207
|
}
|
|
16685
16208
|
this.expect(12);
|
|
16686
16209
|
if (this.eat(8)) break;
|
|
@@ -16701,8 +16224,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16701
16224
|
imported
|
|
16702
16225
|
} = specifier;
|
|
16703
16226
|
if (importedIsString) {
|
|
16704
|
-
throw this.raise(Errors.ImportBindingIsString, {
|
|
16705
|
-
at: specifier,
|
|
16227
|
+
throw this.raise(Errors.ImportBindingIsString, specifier, {
|
|
16706
16228
|
importName: imported.value
|
|
16707
16229
|
});
|
|
16708
16230
|
}
|
|
@@ -16737,6 +16259,7 @@ let Parser$2 = class Parser extends StatementParser {
|
|
|
16737
16259
|
file.errors = null;
|
|
16738
16260
|
this.parseTopLevel(file, program);
|
|
16739
16261
|
file.errors = this.state.errors;
|
|
16262
|
+
file.comments.length = this.state.commentsLen;
|
|
16740
16263
|
return file;
|
|
16741
16264
|
}
|
|
16742
16265
|
};
|
|
@@ -24532,8 +24055,15 @@ function processSlotOutlet(node, context) {
|
|
|
24532
24055
|
}
|
|
24533
24056
|
} else {
|
|
24534
24057
|
if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
|
|
24535
|
-
if (p.exp)
|
|
24058
|
+
if (p.exp) {
|
|
24536
24059
|
slotName = p.exp;
|
|
24060
|
+
} else if (p.arg && p.arg.type === 4) {
|
|
24061
|
+
const name = camelize(p.arg.content);
|
|
24062
|
+
slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
|
|
24063
|
+
{
|
|
24064
|
+
slotName = p.exp = processExpression(p.exp, context);
|
|
24065
|
+
}
|
|
24066
|
+
}
|
|
24537
24067
|
} else {
|
|
24538
24068
|
if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
|
|
24539
24069
|
p.arg.content = camelize(p.arg.content);
|
|
@@ -24673,7 +24203,32 @@ const transformBind = (dir, _node, context) => {
|
|
|
24673
24203
|
const { modifiers, loc } = dir;
|
|
24674
24204
|
const arg = dir.arg;
|
|
24675
24205
|
let { exp } = dir;
|
|
24676
|
-
if (
|
|
24206
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
24207
|
+
{
|
|
24208
|
+
context.onError(
|
|
24209
|
+
createCompilerError(34, loc)
|
|
24210
|
+
);
|
|
24211
|
+
return {
|
|
24212
|
+
props: [
|
|
24213
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
24214
|
+
]
|
|
24215
|
+
};
|
|
24216
|
+
}
|
|
24217
|
+
}
|
|
24218
|
+
if (!exp) {
|
|
24219
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
24220
|
+
context.onError(
|
|
24221
|
+
createCompilerError(
|
|
24222
|
+
52,
|
|
24223
|
+
arg.loc
|
|
24224
|
+
)
|
|
24225
|
+
);
|
|
24226
|
+
return {
|
|
24227
|
+
props: [
|
|
24228
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
24229
|
+
]
|
|
24230
|
+
};
|
|
24231
|
+
}
|
|
24677
24232
|
const propName = camelize(arg.content);
|
|
24678
24233
|
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
24679
24234
|
{
|
|
@@ -24706,12 +24261,6 @@ const transformBind = (dir, _node, context) => {
|
|
|
24706
24261
|
injectPrefix(arg, "^");
|
|
24707
24262
|
}
|
|
24708
24263
|
}
|
|
24709
|
-
if (!exp || exp.type === 4 && !exp.content.trim()) {
|
|
24710
|
-
context.onError(createCompilerError(34, loc));
|
|
24711
|
-
return {
|
|
24712
|
-
props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
|
|
24713
|
-
};
|
|
24714
|
-
}
|
|
24715
24264
|
return {
|
|
24716
24265
|
props: [createObjectProperty(arg, exp)]
|
|
24717
24266
|
};
|
|
@@ -27470,6 +27019,8 @@ var isArray$2 = Array.isArray || function (arr) {
|
|
|
27470
27019
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
27471
27020
|
* @license MIT
|
|
27472
27021
|
*/
|
|
27022
|
+
/* eslint-disable no-proto */
|
|
27023
|
+
|
|
27473
27024
|
|
|
27474
27025
|
var INSPECT_MAX_BYTES = 50;
|
|
27475
27026
|
|
|
@@ -37172,7 +36723,6 @@ const trimPlugin = () => {
|
|
|
37172
36723
|
};
|
|
37173
36724
|
};
|
|
37174
36725
|
trimPlugin.postcss = true;
|
|
37175
|
-
var trimPlugin$1 = trimPlugin;
|
|
37176
36726
|
|
|
37177
36727
|
var dist = {exports: {}};
|
|
37178
36728
|
|
|
@@ -40744,7 +40294,6 @@ function isSpaceCombinator(node) {
|
|
|
40744
40294
|
return node.type === "combinator" && /^\s+$/.test(node.value);
|
|
40745
40295
|
}
|
|
40746
40296
|
scopedPlugin.postcss = true;
|
|
40747
|
-
var scopedPlugin$1 = scopedPlugin;
|
|
40748
40297
|
|
|
40749
40298
|
var sourceMap$1 = {};
|
|
40750
40299
|
|
|
@@ -44141,10 +43690,10 @@ function doCompileStyle(options) {
|
|
|
44141
43690
|
const plugins = (postcssPlugins || []).slice();
|
|
44142
43691
|
plugins.unshift(cssVarsPlugin({ id: shortId, isProd }));
|
|
44143
43692
|
if (trim) {
|
|
44144
|
-
plugins.push(trimPlugin
|
|
43693
|
+
plugins.push(trimPlugin());
|
|
44145
43694
|
}
|
|
44146
43695
|
if (scoped) {
|
|
44147
|
-
plugins.push(scopedPlugin
|
|
43696
|
+
plugins.push(scopedPlugin(longId));
|
|
44148
43697
|
}
|
|
44149
43698
|
let cssModules;
|
|
44150
43699
|
if (modules) {
|
|
@@ -44575,8 +44124,8 @@ class Chunk {
|
|
|
44575
44124
|
}
|
|
44576
44125
|
|
|
44577
44126
|
function getBtoa() {
|
|
44578
|
-
if (typeof
|
|
44579
|
-
return (str) =>
|
|
44127
|
+
if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {
|
|
44128
|
+
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
44580
44129
|
} else if (typeof Buffer === 'function') {
|
|
44581
44130
|
return (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
44582
44131
|
} else {
|
|
@@ -46461,7 +46010,8 @@ function resolveFS(ctx) {
|
|
|
46461
46010
|
file = file.replace(/\.ts$/, "");
|
|
46462
46011
|
}
|
|
46463
46012
|
return fs.readFile(file);
|
|
46464
|
-
}
|
|
46013
|
+
},
|
|
46014
|
+
realpath: fs.realpath
|
|
46465
46015
|
};
|
|
46466
46016
|
}
|
|
46467
46017
|
function resolveTypeFromImport(ctx, node, name, scope) {
|
|
@@ -48648,7 +48198,7 @@ var __spreadValues = (a, b) => {
|
|
|
48648
48198
|
}
|
|
48649
48199
|
return a;
|
|
48650
48200
|
};
|
|
48651
|
-
const version = "3.4.
|
|
48201
|
+
const version = "3.4.16";
|
|
48652
48202
|
const parseCache = parseCache$1;
|
|
48653
48203
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
48654
48204
|
const walk = walk$2;
|