@sanity/pkg-utils 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{build-N7HnlT8k.cjs → build-AuLlgQCD.cjs} +2 -2
- package/dist/_chunks/{build-N7HnlT8k.cjs.map → build-AuLlgQCD.cjs.map} +1 -1
- package/dist/_chunks/{buildAction-yqNgk-aq.cjs → buildAction-aKVmXTPP.cjs} +2 -2
- package/dist/_chunks/{buildAction-yqNgk-aq.cjs.map → buildAction-aKVmXTPP.cjs.map} +1 -1
- package/dist/_chunks/consoleSpy-HqQIfX7k.cjs.map +1 -1
- package/dist/_chunks/{index-0-iA8gVL.cjs → index-FaD5mo-6.cjs} +555 -1035
- package/dist/_chunks/index-FaD5mo-6.cjs.map +1 -0
- package/dist/_chunks/{watch-3unutrcJ.cjs → watch-fXO97GL2.cjs} +2 -2
- package/dist/_chunks/{watch-3unutrcJ.cjs.map → watch-fXO97GL2.cjs.map} +1 -1
- package/dist/_chunks/{watchAction-0OCDBHAy.cjs → watchAction-SAJ1nU-a.cjs} +2 -2
- package/dist/_chunks/{watchAction-0OCDBHAy.cjs.map → watchAction-SAJ1nU-a.cjs.map} +1 -1
- package/dist/cli.cjs +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.js +554 -1034
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/dist/_chunks/index-0-iA8gVL.cjs.map +0 -1
|
@@ -21200,8 +21200,8 @@ function requireLib () {
|
|
|
21200
21200
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
21201
21201
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
21202
21202
|
};
|
|
21203
|
-
const _excluded
|
|
21204
|
-
_excluded2
|
|
21203
|
+
const _excluded = ["toMessage"],
|
|
21204
|
+
_excluded2 = ["message"];
|
|
21205
21205
|
function defineHidden(obj, key, value) {
|
|
21206
21206
|
Object.defineProperty(obj, key, {
|
|
21207
21207
|
enumerable: false,
|
|
@@ -21213,11 +21213,8 @@ function requireLib () {
|
|
|
21213
21213
|
let {
|
|
21214
21214
|
toMessage
|
|
21215
21215
|
} = _ref,
|
|
21216
|
-
properties = _objectWithoutPropertiesLoose(_ref, _excluded
|
|
21217
|
-
return function constructor({
|
|
21218
|
-
loc,
|
|
21219
|
-
details
|
|
21220
|
-
}) {
|
|
21216
|
+
properties = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21217
|
+
return function constructor(loc, details) {
|
|
21221
21218
|
const error = new SyntaxError();
|
|
21222
21219
|
Object.assign(error, properties, {
|
|
21223
21220
|
loc,
|
|
@@ -21235,10 +21232,7 @@ function requireLib () {
|
|
|
21235
21232
|
column,
|
|
21236
21233
|
index
|
|
21237
21234
|
} = (_overrides$loc = overrides.loc) != null ? _overrides$loc : loc;
|
|
21238
|
-
return constructor({
|
|
21239
|
-
loc: new Position(line, column, index),
|
|
21240
|
-
details: Object.assign({}, details, overrides.details)
|
|
21241
|
-
});
|
|
21235
|
+
return constructor(new Position(line, column, index), Object.assign({}, details, overrides.details));
|
|
21242
21236
|
});
|
|
21243
21237
|
defineHidden(error, "details", details);
|
|
21244
21238
|
Object.defineProperty(error, "message", {
|
|
@@ -21273,7 +21267,7 @@ function requireLib () {
|
|
|
21273
21267
|
{
|
|
21274
21268
|
message
|
|
21275
21269
|
} = _ref2,
|
|
21276
|
-
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2
|
|
21270
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
21277
21271
|
const toMessage = typeof message === "string" ? () => message : message;
|
|
21278
21272
|
ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
|
|
21279
21273
|
code: "BABEL_PARSER_SYNTAX_ERROR",
|
|
@@ -21518,13 +21512,9 @@ function requireLib () {
|
|
|
21518
21512
|
}
|
|
21519
21513
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
21520
21514
|
if (prop.kind === "get" || prop.kind === "set") {
|
|
21521
|
-
this.raise(Errors.PatternHasAccessor,
|
|
21522
|
-
at: prop.key
|
|
21523
|
-
});
|
|
21515
|
+
this.raise(Errors.PatternHasAccessor, prop.key);
|
|
21524
21516
|
} else if (prop.method) {
|
|
21525
|
-
this.raise(Errors.PatternHasMethod,
|
|
21526
|
-
at: prop.key
|
|
21527
|
-
});
|
|
21517
|
+
this.raise(Errors.PatternHasMethod, prop.key);
|
|
21528
21518
|
} else {
|
|
21529
21519
|
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
21530
21520
|
}
|
|
@@ -22260,9 +22250,9 @@ function requireLib () {
|
|
|
22260
22250
|
}
|
|
22261
22251
|
class Scope {
|
|
22262
22252
|
constructor(flags) {
|
|
22263
|
-
this.
|
|
22264
|
-
this.
|
|
22265
|
-
this.
|
|
22253
|
+
this.flags = 0;
|
|
22254
|
+
this.names = new Map();
|
|
22255
|
+
this.firstLexicalName = "";
|
|
22266
22256
|
this.flags = flags;
|
|
22267
22257
|
}
|
|
22268
22258
|
}
|
|
@@ -22330,11 +22320,16 @@ function requireLib () {
|
|
|
22330
22320
|
let scope = this.currentScope();
|
|
22331
22321
|
if (bindingType & 8 || bindingType & 16) {
|
|
22332
22322
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
22323
|
+
let type = scope.names.get(name) || 0;
|
|
22333
22324
|
if (bindingType & 16) {
|
|
22334
|
-
|
|
22325
|
+
type = type | 4;
|
|
22335
22326
|
} else {
|
|
22336
|
-
scope.
|
|
22327
|
+
if (!scope.firstLexicalName) {
|
|
22328
|
+
scope.firstLexicalName = name;
|
|
22329
|
+
}
|
|
22330
|
+
type = type | 2;
|
|
22337
22331
|
}
|
|
22332
|
+
scope.names.set(name, type);
|
|
22338
22333
|
if (bindingType & 8) {
|
|
22339
22334
|
this.maybeExportDefined(scope, name);
|
|
22340
22335
|
}
|
|
@@ -22342,7 +22337,7 @@ function requireLib () {
|
|
|
22342
22337
|
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
22343
22338
|
scope = this.scopeStack[i];
|
|
22344
22339
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
22345
|
-
scope.
|
|
22340
|
+
scope.names.set(name, (scope.names.get(name) || 0) | 1);
|
|
22346
22341
|
this.maybeExportDefined(scope, name);
|
|
22347
22342
|
if (scope.flags & 387) break;
|
|
22348
22343
|
}
|
|
@@ -22358,8 +22353,7 @@ function requireLib () {
|
|
|
22358
22353
|
}
|
|
22359
22354
|
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
22360
22355
|
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
|
22361
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
22362
|
-
at: loc,
|
|
22356
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
22363
22357
|
identifierName: name
|
|
22364
22358
|
});
|
|
22365
22359
|
}
|
|
@@ -22367,19 +22361,20 @@ function requireLib () {
|
|
|
22367
22361
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
22368
22362
|
if (!(bindingType & 1)) return false;
|
|
22369
22363
|
if (bindingType & 8) {
|
|
22370
|
-
return scope.
|
|
22364
|
+
return scope.names.has(name);
|
|
22371
22365
|
}
|
|
22366
|
+
const type = scope.names.get(name);
|
|
22372
22367
|
if (bindingType & 16) {
|
|
22373
|
-
return
|
|
22368
|
+
return (type & 2) > 0 || !this.treatFunctionsAsVarInScope(scope) && (type & 1) > 0;
|
|
22374
22369
|
}
|
|
22375
|
-
return
|
|
22370
|
+
return (type & 2) > 0 && !(scope.flags & 8 && scope.firstLexicalName === name) || !this.treatFunctionsAsVarInScope(scope) && (type & 4) > 0;
|
|
22376
22371
|
}
|
|
22377
22372
|
checkLocalExport(id) {
|
|
22378
22373
|
const {
|
|
22379
22374
|
name
|
|
22380
22375
|
} = id;
|
|
22381
22376
|
const topLevelScope = this.scopeStack[0];
|
|
22382
|
-
if (!topLevelScope.
|
|
22377
|
+
if (!topLevelScope.names.has(name)) {
|
|
22383
22378
|
this.undefinedExports.set(name, id.loc.start);
|
|
22384
22379
|
}
|
|
22385
22380
|
}
|
|
@@ -22429,8 +22424,9 @@ function requireLib () {
|
|
|
22429
22424
|
}
|
|
22430
22425
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
22431
22426
|
if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
|
|
22432
|
-
if (bindingType & 2048) {
|
|
22433
|
-
|
|
22427
|
+
if (bindingType & 2048 && !scope.declareFunctions.has(name)) {
|
|
22428
|
+
const type = scope.names.get(name);
|
|
22429
|
+
return (type & 4) > 0 || (type & 2) > 0;
|
|
22434
22430
|
}
|
|
22435
22431
|
return false;
|
|
22436
22432
|
}
|
|
@@ -22503,7 +22499,12 @@ function requireLib () {
|
|
|
22503
22499
|
class CommentsParser extends BaseParser {
|
|
22504
22500
|
addComment(comment) {
|
|
22505
22501
|
if (this.filename) comment.loc.filename = this.filename;
|
|
22506
|
-
|
|
22502
|
+
const {
|
|
22503
|
+
commentsLen
|
|
22504
|
+
} = this.state;
|
|
22505
|
+
if (this.comments.length != commentsLen) this.comments.length = commentsLen;
|
|
22506
|
+
this.comments.push(comment);
|
|
22507
|
+
this.state.commentsLen++;
|
|
22507
22508
|
}
|
|
22508
22509
|
processComment(node) {
|
|
22509
22510
|
const {
|
|
@@ -22692,7 +22693,7 @@ function requireLib () {
|
|
|
22692
22693
|
}
|
|
22693
22694
|
class State {
|
|
22694
22695
|
constructor() {
|
|
22695
|
-
this.
|
|
22696
|
+
this.flags = 1024;
|
|
22696
22697
|
this.curLine = void 0;
|
|
22697
22698
|
this.lineStart = void 0;
|
|
22698
22699
|
this.startLoc = void 0;
|
|
@@ -22701,21 +22702,12 @@ function requireLib () {
|
|
|
22701
22702
|
this.potentialArrowAt = -1;
|
|
22702
22703
|
this.noArrowAt = [];
|
|
22703
22704
|
this.noArrowParamsConversionAt = [];
|
|
22704
|
-
this.maybeInArrowParameters = false;
|
|
22705
|
-
this.inType = false;
|
|
22706
|
-
this.noAnonFunctionType = false;
|
|
22707
|
-
this.hasFlowComment = false;
|
|
22708
|
-
this.isAmbientContext = false;
|
|
22709
|
-
this.inAbstractClass = false;
|
|
22710
|
-
this.inDisallowConditionalTypesContext = false;
|
|
22711
22705
|
this.topicContext = {
|
|
22712
22706
|
maxNumOfResolvableTopics: 0,
|
|
22713
22707
|
maxTopicIndex: null
|
|
22714
22708
|
};
|
|
22715
|
-
this.soloAwait = false;
|
|
22716
|
-
this.inFSharpPipelineDirectBody = false;
|
|
22717
22709
|
this.labels = [];
|
|
22718
|
-
this.
|
|
22710
|
+
this.commentsLen = 0;
|
|
22719
22711
|
this.commentStack = [];
|
|
22720
22712
|
this.pos = 0;
|
|
22721
22713
|
this.type = 139;
|
|
@@ -22724,14 +22716,21 @@ function requireLib () {
|
|
|
22724
22716
|
this.end = 0;
|
|
22725
22717
|
this.lastTokEndLoc = null;
|
|
22726
22718
|
this.lastTokStartLoc = null;
|
|
22727
|
-
this.lastTokStart = 0;
|
|
22728
22719
|
this.context = [types.brace];
|
|
22729
|
-
this.canStartJSXElement = true;
|
|
22730
|
-
this.containsEsc = false;
|
|
22731
22720
|
this.firstInvalidTemplateEscapePos = null;
|
|
22732
22721
|
this.strictErrors = new Map();
|
|
22733
22722
|
this.tokensLength = 0;
|
|
22734
22723
|
}
|
|
22724
|
+
get strict() {
|
|
22725
|
+
return (this.flags & 1) > 0;
|
|
22726
|
+
}
|
|
22727
|
+
set strict(value) {
|
|
22728
|
+
if (value) {
|
|
22729
|
+
this.flags |= 1;
|
|
22730
|
+
} else {
|
|
22731
|
+
this.flags &= ~1;
|
|
22732
|
+
}
|
|
22733
|
+
}
|
|
22735
22734
|
init({
|
|
22736
22735
|
strictMode,
|
|
22737
22736
|
sourceType,
|
|
@@ -22743,20 +22742,145 @@ function requireLib () {
|
|
|
22743
22742
|
this.lineStart = -startColumn;
|
|
22744
22743
|
this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
|
|
22745
22744
|
}
|
|
22745
|
+
get maybeInArrowParameters() {
|
|
22746
|
+
return (this.flags & 2) > 0;
|
|
22747
|
+
}
|
|
22748
|
+
set maybeInArrowParameters(value) {
|
|
22749
|
+
if (value) {
|
|
22750
|
+
this.flags |= 2;
|
|
22751
|
+
} else {
|
|
22752
|
+
this.flags &= ~2;
|
|
22753
|
+
}
|
|
22754
|
+
}
|
|
22755
|
+
get inType() {
|
|
22756
|
+
return (this.flags & 4) > 0;
|
|
22757
|
+
}
|
|
22758
|
+
set inType(value) {
|
|
22759
|
+
if (value) {
|
|
22760
|
+
this.flags |= 4;
|
|
22761
|
+
} else {
|
|
22762
|
+
this.flags &= ~4;
|
|
22763
|
+
}
|
|
22764
|
+
}
|
|
22765
|
+
get noAnonFunctionType() {
|
|
22766
|
+
return (this.flags & 8) > 0;
|
|
22767
|
+
}
|
|
22768
|
+
set noAnonFunctionType(value) {
|
|
22769
|
+
if (value) {
|
|
22770
|
+
this.flags |= 8;
|
|
22771
|
+
} else {
|
|
22772
|
+
this.flags &= ~8;
|
|
22773
|
+
}
|
|
22774
|
+
}
|
|
22775
|
+
get hasFlowComment() {
|
|
22776
|
+
return (this.flags & 16) > 0;
|
|
22777
|
+
}
|
|
22778
|
+
set hasFlowComment(value) {
|
|
22779
|
+
if (value) {
|
|
22780
|
+
this.flags |= 16;
|
|
22781
|
+
} else {
|
|
22782
|
+
this.flags &= ~16;
|
|
22783
|
+
}
|
|
22784
|
+
}
|
|
22785
|
+
get isAmbientContext() {
|
|
22786
|
+
return (this.flags & 32) > 0;
|
|
22787
|
+
}
|
|
22788
|
+
set isAmbientContext(value) {
|
|
22789
|
+
if (value) {
|
|
22790
|
+
this.flags |= 32;
|
|
22791
|
+
} else {
|
|
22792
|
+
this.flags &= ~32;
|
|
22793
|
+
}
|
|
22794
|
+
}
|
|
22795
|
+
get inAbstractClass() {
|
|
22796
|
+
return (this.flags & 64) > 0;
|
|
22797
|
+
}
|
|
22798
|
+
set inAbstractClass(value) {
|
|
22799
|
+
if (value) {
|
|
22800
|
+
this.flags |= 64;
|
|
22801
|
+
} else {
|
|
22802
|
+
this.flags &= ~64;
|
|
22803
|
+
}
|
|
22804
|
+
}
|
|
22805
|
+
get inDisallowConditionalTypesContext() {
|
|
22806
|
+
return (this.flags & 128) > 0;
|
|
22807
|
+
}
|
|
22808
|
+
set inDisallowConditionalTypesContext(value) {
|
|
22809
|
+
if (value) {
|
|
22810
|
+
this.flags |= 128;
|
|
22811
|
+
} else {
|
|
22812
|
+
this.flags &= ~128;
|
|
22813
|
+
}
|
|
22814
|
+
}
|
|
22815
|
+
get soloAwait() {
|
|
22816
|
+
return (this.flags & 256) > 0;
|
|
22817
|
+
}
|
|
22818
|
+
set soloAwait(value) {
|
|
22819
|
+
if (value) {
|
|
22820
|
+
this.flags |= 256;
|
|
22821
|
+
} else {
|
|
22822
|
+
this.flags &= ~256;
|
|
22823
|
+
}
|
|
22824
|
+
}
|
|
22825
|
+
get inFSharpPipelineDirectBody() {
|
|
22826
|
+
return (this.flags & 512) > 0;
|
|
22827
|
+
}
|
|
22828
|
+
set inFSharpPipelineDirectBody(value) {
|
|
22829
|
+
if (value) {
|
|
22830
|
+
this.flags |= 512;
|
|
22831
|
+
} else {
|
|
22832
|
+
this.flags &= ~512;
|
|
22833
|
+
}
|
|
22834
|
+
}
|
|
22835
|
+
get canStartJSXElement() {
|
|
22836
|
+
return (this.flags & 1024) > 0;
|
|
22837
|
+
}
|
|
22838
|
+
set canStartJSXElement(value) {
|
|
22839
|
+
if (value) {
|
|
22840
|
+
this.flags |= 1024;
|
|
22841
|
+
} else {
|
|
22842
|
+
this.flags &= ~1024;
|
|
22843
|
+
}
|
|
22844
|
+
}
|
|
22845
|
+
get containsEsc() {
|
|
22846
|
+
return (this.flags & 2048) > 0;
|
|
22847
|
+
}
|
|
22848
|
+
set containsEsc(value) {
|
|
22849
|
+
if (value) {
|
|
22850
|
+
this.flags |= 2048;
|
|
22851
|
+
} else {
|
|
22852
|
+
this.flags &= ~2048;
|
|
22853
|
+
}
|
|
22854
|
+
}
|
|
22746
22855
|
curPosition() {
|
|
22747
22856
|
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
|
|
22748
22857
|
}
|
|
22749
|
-
clone(
|
|
22858
|
+
clone() {
|
|
22750
22859
|
const state = new State();
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22860
|
+
state.flags = this.flags;
|
|
22861
|
+
state.curLine = this.curLine;
|
|
22862
|
+
state.lineStart = this.lineStart;
|
|
22863
|
+
state.startLoc = this.startLoc;
|
|
22864
|
+
state.endLoc = this.endLoc;
|
|
22865
|
+
state.errors = this.errors.slice();
|
|
22866
|
+
state.potentialArrowAt = this.potentialArrowAt;
|
|
22867
|
+
state.noArrowAt = this.noArrowAt.slice();
|
|
22868
|
+
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
22869
|
+
state.topicContext = this.topicContext;
|
|
22870
|
+
state.labels = this.labels.slice();
|
|
22871
|
+
state.commentsLen = this.commentsLen;
|
|
22872
|
+
state.commentStack = this.commentStack.slice();
|
|
22873
|
+
state.pos = this.pos;
|
|
22874
|
+
state.type = this.type;
|
|
22875
|
+
state.value = this.value;
|
|
22876
|
+
state.start = this.start;
|
|
22877
|
+
state.end = this.end;
|
|
22878
|
+
state.lastTokEndLoc = this.lastTokEndLoc;
|
|
22879
|
+
state.lastTokStartLoc = this.lastTokStartLoc;
|
|
22880
|
+
state.context = this.context.slice();
|
|
22881
|
+
state.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos;
|
|
22882
|
+
state.strictErrors = this.strictErrors;
|
|
22883
|
+
state.tokensLength = this.tokensLength;
|
|
22760
22884
|
return state;
|
|
22761
22885
|
}
|
|
22762
22886
|
}
|
|
@@ -23045,8 +23169,6 @@ function requireLib () {
|
|
|
23045
23169
|
pos
|
|
23046
23170
|
};
|
|
23047
23171
|
}
|
|
23048
|
-
const _excluded = ["at"],
|
|
23049
|
-
_excluded2 = ["at"];
|
|
23050
23172
|
function buildPosition(pos, lineStart, curLine) {
|
|
23051
23173
|
return new Position(curLine, pos - lineStart, pos);
|
|
23052
23174
|
}
|
|
@@ -23068,8 +23190,7 @@ function requireLib () {
|
|
|
23068
23190
|
this.errorHandlers_readInt = {
|
|
23069
23191
|
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
23070
23192
|
if (!this.options.errorRecovery) return false;
|
|
23071
|
-
this.raise(Errors.InvalidDigit, {
|
|
23072
|
-
at: buildPosition(pos, lineStart, curLine),
|
|
23193
|
+
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
|
|
23073
23194
|
radix
|
|
23074
23195
|
});
|
|
23075
23196
|
return true;
|
|
@@ -23083,28 +23204,23 @@ function requireLib () {
|
|
|
23083
23204
|
});
|
|
23084
23205
|
this.errorHandlers_readStringContents_string = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
23085
23206
|
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
23086
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape,
|
|
23087
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
23088
|
-
});
|
|
23207
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
|
|
23089
23208
|
},
|
|
23090
23209
|
unterminated: (pos, lineStart, curLine) => {
|
|
23091
|
-
throw this.raise(Errors.UnterminatedString,
|
|
23092
|
-
at: buildPosition(pos - 1, lineStart, curLine)
|
|
23093
|
-
});
|
|
23210
|
+
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
|
|
23094
23211
|
}
|
|
23095
23212
|
});
|
|
23096
23213
|
this.errorHandlers_readStringContents_template = Object.assign({}, this.errorHandlers_readCodePoint, {
|
|
23097
23214
|
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
23098
23215
|
unterminated: (pos, lineStart, curLine) => {
|
|
23099
|
-
throw this.raise(Errors.UnterminatedTemplate,
|
|
23100
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
23101
|
-
});
|
|
23216
|
+
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
|
|
23102
23217
|
}
|
|
23103
23218
|
});
|
|
23104
23219
|
this.state = new State();
|
|
23105
23220
|
this.state.init(options);
|
|
23106
23221
|
this.input = input;
|
|
23107
23222
|
this.length = input.length;
|
|
23223
|
+
this.comments = [];
|
|
23108
23224
|
this.isLookahead = false;
|
|
23109
23225
|
}
|
|
23110
23226
|
pushToken(token) {
|
|
@@ -23117,7 +23233,6 @@ function requireLib () {
|
|
|
23117
23233
|
if (this.options.tokens) {
|
|
23118
23234
|
this.pushToken(new Token(this.state));
|
|
23119
23235
|
}
|
|
23120
|
-
this.state.lastTokStart = this.state.start;
|
|
23121
23236
|
this.state.lastTokEndLoc = this.state.endLoc;
|
|
23122
23237
|
this.state.lastTokStartLoc = this.state.startLoc;
|
|
23123
23238
|
this.nextToken();
|
|
@@ -23192,9 +23307,7 @@ function requireLib () {
|
|
|
23192
23307
|
setStrict(strict) {
|
|
23193
23308
|
this.state.strict = strict;
|
|
23194
23309
|
if (strict) {
|
|
23195
|
-
this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError,
|
|
23196
|
-
at
|
|
23197
|
-
}));
|
|
23310
|
+
this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at));
|
|
23198
23311
|
this.state.strictErrors.clear();
|
|
23199
23312
|
}
|
|
23200
23313
|
}
|
|
@@ -23217,9 +23330,7 @@ function requireLib () {
|
|
|
23217
23330
|
const start = this.state.pos;
|
|
23218
23331
|
const end = this.input.indexOf(commentEnd, start + 2);
|
|
23219
23332
|
if (end === -1) {
|
|
23220
|
-
throw this.raise(Errors.UnterminatedComment,
|
|
23221
|
-
at: this.state.curPosition()
|
|
23222
|
-
});
|
|
23333
|
+
throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
23223
23334
|
}
|
|
23224
23335
|
this.state.pos = end + commentEnd.length;
|
|
23225
23336
|
lineBreakG.lastIndex = start + 2;
|
|
@@ -23371,16 +23482,12 @@ function requireLib () {
|
|
|
23371
23482
|
const nextPos = this.state.pos + 1;
|
|
23372
23483
|
const next = this.codePointAtPos(nextPos);
|
|
23373
23484
|
if (next >= 48 && next <= 57) {
|
|
23374
|
-
throw this.raise(Errors.UnexpectedDigitAfterHash,
|
|
23375
|
-
at: this.state.curPosition()
|
|
23376
|
-
});
|
|
23485
|
+
throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
23377
23486
|
}
|
|
23378
23487
|
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
|
|
23379
23488
|
this.expectPlugin("recordAndTuple");
|
|
23380
23489
|
if (this.getPluginOption("recordAndTuple", "syntaxType") === "bar") {
|
|
23381
|
-
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType,
|
|
23382
|
-
at: this.state.curPosition()
|
|
23383
|
-
});
|
|
23490
|
+
throw this.raise(next === 123 ? Errors.RecordExpressionHashIncorrectStartSyntaxType : Errors.TupleExpressionHashIncorrectStartSyntaxType, this.state.curPosition());
|
|
23384
23491
|
}
|
|
23385
23492
|
this.state.pos += 2;
|
|
23386
23493
|
if (next === 123) {
|
|
@@ -23465,9 +23572,7 @@ function requireLib () {
|
|
|
23465
23572
|
}
|
|
23466
23573
|
if (this.hasPlugin("recordAndTuple") && next === 125) {
|
|
23467
23574
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
23468
|
-
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType,
|
|
23469
|
-
at: this.state.curPosition()
|
|
23470
|
-
});
|
|
23575
|
+
throw this.raise(Errors.RecordExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
|
|
23471
23576
|
}
|
|
23472
23577
|
this.state.pos += 2;
|
|
23473
23578
|
this.finishToken(9);
|
|
@@ -23475,9 +23580,7 @@ function requireLib () {
|
|
|
23475
23580
|
}
|
|
23476
23581
|
if (this.hasPlugin("recordAndTuple") && next === 93) {
|
|
23477
23582
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
23478
|
-
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType,
|
|
23479
|
-
at: this.state.curPosition()
|
|
23480
|
-
});
|
|
23583
|
+
throw this.raise(Errors.TupleExpressionBarIncorrectEndSyntaxType, this.state.curPosition());
|
|
23481
23584
|
}
|
|
23482
23585
|
this.state.pos += 2;
|
|
23483
23586
|
this.finishToken(4);
|
|
@@ -23623,9 +23726,7 @@ function requireLib () {
|
|
|
23623
23726
|
case 91:
|
|
23624
23727
|
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
|
23625
23728
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
23626
|
-
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType,
|
|
23627
|
-
at: this.state.curPosition()
|
|
23628
|
-
});
|
|
23729
|
+
throw this.raise(Errors.TupleExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
|
|
23629
23730
|
}
|
|
23630
23731
|
this.state.pos += 2;
|
|
23631
23732
|
this.finishToken(2);
|
|
@@ -23641,9 +23742,7 @@ function requireLib () {
|
|
|
23641
23742
|
case 123:
|
|
23642
23743
|
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
|
|
23643
23744
|
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
|
|
23644
|
-
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType,
|
|
23645
|
-
at: this.state.curPosition()
|
|
23646
|
-
});
|
|
23745
|
+
throw this.raise(Errors.RecordExpressionBarIncorrectStartSyntaxType, this.state.curPosition());
|
|
23647
23746
|
}
|
|
23648
23747
|
this.state.pos += 2;
|
|
23649
23748
|
this.finishToken(6);
|
|
@@ -23747,8 +23846,7 @@ function requireLib () {
|
|
|
23747
23846
|
return;
|
|
23748
23847
|
}
|
|
23749
23848
|
}
|
|
23750
|
-
throw this.raise(Errors.InvalidOrUnexpectedToken, {
|
|
23751
|
-
at: this.state.curPosition(),
|
|
23849
|
+
throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), {
|
|
23752
23850
|
unexpected: String.fromCodePoint(code)
|
|
23753
23851
|
});
|
|
23754
23852
|
}
|
|
@@ -23766,15 +23864,11 @@ function requireLib () {
|
|
|
23766
23864
|
} = this.state;
|
|
23767
23865
|
for (;; ++pos) {
|
|
23768
23866
|
if (pos >= this.length) {
|
|
23769
|
-
throw this.raise(Errors.UnterminatedRegExp,
|
|
23770
|
-
at: createPositionWithColumnOffset(startLoc, 1)
|
|
23771
|
-
});
|
|
23867
|
+
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
23772
23868
|
}
|
|
23773
23869
|
const ch = this.input.charCodeAt(pos);
|
|
23774
23870
|
if (isNewLine(ch)) {
|
|
23775
|
-
throw this.raise(Errors.UnterminatedRegExp,
|
|
23776
|
-
at: createPositionWithColumnOffset(startLoc, 1)
|
|
23777
|
-
});
|
|
23871
|
+
throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
23778
23872
|
}
|
|
23779
23873
|
if (escaped) {
|
|
23780
23874
|
escaped = false;
|
|
@@ -23799,26 +23893,18 @@ function requireLib () {
|
|
|
23799
23893
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
23800
23894
|
if (cp === 118) {
|
|
23801
23895
|
if (mods.includes("u")) {
|
|
23802
|
-
this.raise(Errors.IncompatibleRegExpUVFlags,
|
|
23803
|
-
at: nextPos()
|
|
23804
|
-
});
|
|
23896
|
+
this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
23805
23897
|
}
|
|
23806
23898
|
} else if (cp === 117) {
|
|
23807
23899
|
if (mods.includes("v")) {
|
|
23808
|
-
this.raise(Errors.IncompatibleRegExpUVFlags,
|
|
23809
|
-
at: nextPos()
|
|
23810
|
-
});
|
|
23900
|
+
this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
23811
23901
|
}
|
|
23812
23902
|
}
|
|
23813
23903
|
if (mods.includes(char)) {
|
|
23814
|
-
this.raise(Errors.DuplicateRegExpFlags,
|
|
23815
|
-
at: nextPos()
|
|
23816
|
-
});
|
|
23904
|
+
this.raise(Errors.DuplicateRegExpFlags, nextPos());
|
|
23817
23905
|
}
|
|
23818
23906
|
} else if (isIdentifierChar(cp) || cp === 92) {
|
|
23819
|
-
this.raise(Errors.MalformedRegExpFlags,
|
|
23820
|
-
at: nextPos()
|
|
23821
|
-
});
|
|
23907
|
+
this.raise(Errors.MalformedRegExpFlags, nextPos());
|
|
23822
23908
|
} else {
|
|
23823
23909
|
break;
|
|
23824
23910
|
}
|
|
@@ -23845,8 +23931,7 @@ function requireLib () {
|
|
|
23845
23931
|
this.state.pos += 2;
|
|
23846
23932
|
const val = this.readInt(radix);
|
|
23847
23933
|
if (val == null) {
|
|
23848
|
-
this.raise(Errors.InvalidDigit, {
|
|
23849
|
-
at: createPositionWithColumnOffset(startLoc, 2),
|
|
23934
|
+
this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), {
|
|
23850
23935
|
radix
|
|
23851
23936
|
});
|
|
23852
23937
|
}
|
|
@@ -23855,14 +23940,10 @@ function requireLib () {
|
|
|
23855
23940
|
++this.state.pos;
|
|
23856
23941
|
isBigInt = true;
|
|
23857
23942
|
} else if (next === 109) {
|
|
23858
|
-
throw this.raise(Errors.InvalidDecimal,
|
|
23859
|
-
at: startLoc
|
|
23860
|
-
});
|
|
23943
|
+
throw this.raise(Errors.InvalidDecimal, startLoc);
|
|
23861
23944
|
}
|
|
23862
23945
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
|
|
23863
|
-
throw this.raise(Errors.NumberIdentifier,
|
|
23864
|
-
at: this.state.curPosition()
|
|
23865
|
-
});
|
|
23946
|
+
throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
23866
23947
|
}
|
|
23867
23948
|
if (isBigInt) {
|
|
23868
23949
|
const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
|
|
@@ -23880,22 +23961,16 @@ function requireLib () {
|
|
|
23880
23961
|
let hasExponent = false;
|
|
23881
23962
|
let isOctal = false;
|
|
23882
23963
|
if (!startsWithDot && this.readInt(10) === null) {
|
|
23883
|
-
this.raise(Errors.InvalidNumber,
|
|
23884
|
-
at: this.state.curPosition()
|
|
23885
|
-
});
|
|
23964
|
+
this.raise(Errors.InvalidNumber, this.state.curPosition());
|
|
23886
23965
|
}
|
|
23887
23966
|
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
23888
23967
|
if (hasLeadingZero) {
|
|
23889
23968
|
const integer = this.input.slice(start, this.state.pos);
|
|
23890
|
-
this.recordStrictModeErrors(Errors.StrictOctalLiteral,
|
|
23891
|
-
at: startLoc
|
|
23892
|
-
});
|
|
23969
|
+
this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
|
|
23893
23970
|
if (!this.state.strict) {
|
|
23894
23971
|
const underscorePos = integer.indexOf("_");
|
|
23895
23972
|
if (underscorePos > 0) {
|
|
23896
|
-
this.raise(Errors.ZeroDigitNumericSeparator,
|
|
23897
|
-
at: createPositionWithColumnOffset(startLoc, underscorePos)
|
|
23898
|
-
});
|
|
23973
|
+
this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
|
|
23899
23974
|
}
|
|
23900
23975
|
}
|
|
23901
23976
|
isOctal = hasLeadingZero && !/[89]/.test(integer);
|
|
@@ -23913,9 +23988,7 @@ function requireLib () {
|
|
|
23913
23988
|
++this.state.pos;
|
|
23914
23989
|
}
|
|
23915
23990
|
if (this.readInt(10) === null) {
|
|
23916
|
-
this.raise(Errors.InvalidOrMissingExponent,
|
|
23917
|
-
at: startLoc
|
|
23918
|
-
});
|
|
23991
|
+
this.raise(Errors.InvalidOrMissingExponent, startLoc);
|
|
23919
23992
|
}
|
|
23920
23993
|
isFloat = true;
|
|
23921
23994
|
hasExponent = true;
|
|
@@ -23923,9 +23996,7 @@ function requireLib () {
|
|
|
23923
23996
|
}
|
|
23924
23997
|
if (next === 110) {
|
|
23925
23998
|
if (isFloat || hasLeadingZero) {
|
|
23926
|
-
this.raise(Errors.InvalidBigIntLiteral,
|
|
23927
|
-
at: startLoc
|
|
23928
|
-
});
|
|
23999
|
+
this.raise(Errors.InvalidBigIntLiteral, startLoc);
|
|
23929
24000
|
}
|
|
23930
24001
|
++this.state.pos;
|
|
23931
24002
|
isBigInt = true;
|
|
@@ -23933,17 +24004,13 @@ function requireLib () {
|
|
|
23933
24004
|
if (next === 109) {
|
|
23934
24005
|
this.expectPlugin("decimal", this.state.curPosition());
|
|
23935
24006
|
if (hasExponent || hasLeadingZero) {
|
|
23936
|
-
this.raise(Errors.InvalidDecimal,
|
|
23937
|
-
at: startLoc
|
|
23938
|
-
});
|
|
24007
|
+
this.raise(Errors.InvalidDecimal, startLoc);
|
|
23939
24008
|
}
|
|
23940
24009
|
++this.state.pos;
|
|
23941
24010
|
isDecimal = true;
|
|
23942
24011
|
}
|
|
23943
24012
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
|
|
23944
|
-
throw this.raise(Errors.NumberIdentifier,
|
|
23945
|
-
at: this.state.curPosition()
|
|
23946
|
-
});
|
|
24013
|
+
throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
23947
24014
|
}
|
|
23948
24015
|
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
23949
24016
|
if (isBigInt) {
|
|
@@ -24006,14 +24073,10 @@ function requireLib () {
|
|
|
24006
24073
|
this.finishToken(25, firstInvalidLoc ? null : opening + str + "${");
|
|
24007
24074
|
}
|
|
24008
24075
|
}
|
|
24009
|
-
recordStrictModeErrors(toParseError, {
|
|
24010
|
-
at
|
|
24011
|
-
}) {
|
|
24076
|
+
recordStrictModeErrors(toParseError, at) {
|
|
24012
24077
|
const index = at.index;
|
|
24013
24078
|
if (this.state.strict && !this.state.strictErrors.has(index)) {
|
|
24014
|
-
this.raise(toParseError,
|
|
24015
|
-
at
|
|
24016
|
-
});
|
|
24079
|
+
this.raise(toParseError, at);
|
|
24017
24080
|
} else {
|
|
24018
24081
|
this.state.strictErrors.set(index, [toParseError, at]);
|
|
24019
24082
|
}
|
|
@@ -24036,9 +24099,7 @@ function requireLib () {
|
|
|
24036
24099
|
const escStart = this.state.curPosition();
|
|
24037
24100
|
const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
|
|
24038
24101
|
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
|
24039
|
-
this.raise(Errors.MissingUnicodeEscape,
|
|
24040
|
-
at: this.state.curPosition()
|
|
24041
|
-
});
|
|
24102
|
+
this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
|
|
24042
24103
|
chunkStart = this.state.pos - 1;
|
|
24043
24104
|
continue;
|
|
24044
24105
|
}
|
|
@@ -24046,9 +24107,7 @@ function requireLib () {
|
|
|
24046
24107
|
const esc = this.readCodePoint(true);
|
|
24047
24108
|
if (esc !== null) {
|
|
24048
24109
|
if (!identifierCheck(esc)) {
|
|
24049
|
-
this.raise(Errors.EscapedCharNotAnIdentifier,
|
|
24050
|
-
at: escStart
|
|
24051
|
-
});
|
|
24110
|
+
this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
|
|
24052
24111
|
}
|
|
24053
24112
|
word += String.fromCodePoint(esc);
|
|
24054
24113
|
}
|
|
@@ -24073,75 +24132,55 @@ function requireLib () {
|
|
|
24073
24132
|
type
|
|
24074
24133
|
} = this.state;
|
|
24075
24134
|
if (tokenIsKeyword(type) && this.state.containsEsc) {
|
|
24076
|
-
this.raise(Errors.InvalidEscapedReservedWord, {
|
|
24077
|
-
at: this.state.startLoc,
|
|
24135
|
+
this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, {
|
|
24078
24136
|
reservedWord: tokenLabelName(type)
|
|
24079
24137
|
});
|
|
24080
24138
|
}
|
|
24081
24139
|
}
|
|
24082
|
-
raise(toParseError,
|
|
24083
|
-
const {
|
|
24084
|
-
at
|
|
24085
|
-
} = raiseProperties,
|
|
24086
|
-
details = _objectWithoutPropertiesLoose(raiseProperties, _excluded);
|
|
24140
|
+
raise(toParseError, at, details = {}) {
|
|
24087
24141
|
const loc = at instanceof Position ? at : at.loc.start;
|
|
24088
|
-
const error = toParseError(
|
|
24089
|
-
loc,
|
|
24090
|
-
details
|
|
24091
|
-
});
|
|
24142
|
+
const error = toParseError(loc, details);
|
|
24092
24143
|
if (!this.options.errorRecovery) throw error;
|
|
24093
24144
|
if (!this.isLookahead) this.state.errors.push(error);
|
|
24094
24145
|
return error;
|
|
24095
24146
|
}
|
|
24096
|
-
raiseOverwrite(toParseError,
|
|
24097
|
-
const {
|
|
24098
|
-
at
|
|
24099
|
-
} = raiseProperties,
|
|
24100
|
-
details = _objectWithoutPropertiesLoose(raiseProperties, _excluded2);
|
|
24147
|
+
raiseOverwrite(toParseError, at, details = {}) {
|
|
24101
24148
|
const loc = at instanceof Position ? at : at.loc.start;
|
|
24102
24149
|
const pos = loc.index;
|
|
24103
24150
|
const errors = this.state.errors;
|
|
24104
24151
|
for (let i = errors.length - 1; i >= 0; i--) {
|
|
24105
24152
|
const error = errors[i];
|
|
24106
24153
|
if (error.loc.index === pos) {
|
|
24107
|
-
return errors[i] = toParseError(
|
|
24108
|
-
loc,
|
|
24109
|
-
details
|
|
24110
|
-
});
|
|
24154
|
+
return errors[i] = toParseError(loc, details);
|
|
24111
24155
|
}
|
|
24112
24156
|
if (error.loc.index < pos) break;
|
|
24113
24157
|
}
|
|
24114
|
-
return this.raise(toParseError,
|
|
24158
|
+
return this.raise(toParseError, at, details);
|
|
24115
24159
|
}
|
|
24116
24160
|
updateContext(prevType) {}
|
|
24117
24161
|
unexpected(loc, type) {
|
|
24118
|
-
throw this.raise(Errors.UnexpectedToken, {
|
|
24119
|
-
expected: type ? tokenLabelName(type) : null
|
|
24120
|
-
at: loc != null ? loc : this.state.startLoc
|
|
24162
|
+
throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, {
|
|
24163
|
+
expected: type ? tokenLabelName(type) : null
|
|
24121
24164
|
});
|
|
24122
24165
|
}
|
|
24123
24166
|
expectPlugin(pluginName, loc) {
|
|
24124
24167
|
if (this.hasPlugin(pluginName)) {
|
|
24125
24168
|
return true;
|
|
24126
24169
|
}
|
|
24127
|
-
throw this.raise(Errors.MissingPlugin, {
|
|
24128
|
-
at: loc != null ? loc : this.state.startLoc,
|
|
24170
|
+
throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, {
|
|
24129
24171
|
missingPlugin: [pluginName]
|
|
24130
24172
|
});
|
|
24131
24173
|
}
|
|
24132
24174
|
expectOnePlugin(pluginNames) {
|
|
24133
24175
|
if (!pluginNames.some(name => this.hasPlugin(name))) {
|
|
24134
|
-
throw this.raise(Errors.MissingOneOfPlugins, {
|
|
24135
|
-
at: this.state.startLoc,
|
|
24176
|
+
throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, {
|
|
24136
24177
|
missingPlugin: pluginNames
|
|
24137
24178
|
});
|
|
24138
24179
|
}
|
|
24139
24180
|
}
|
|
24140
24181
|
errorBuilder(error) {
|
|
24141
24182
|
return (pos, lineStart, curLine) => {
|
|
24142
|
-
this.raise(error,
|
|
24143
|
-
at: buildPosition(pos, lineStart, curLine)
|
|
24144
|
-
});
|
|
24183
|
+
this.raise(error, buildPosition(pos, lineStart, curLine));
|
|
24145
24184
|
};
|
|
24146
24185
|
}
|
|
24147
24186
|
}
|
|
@@ -24174,8 +24213,7 @@ function requireLib () {
|
|
|
24174
24213
|
current.undefinedPrivateNames.set(name, loc);
|
|
24175
24214
|
}
|
|
24176
24215
|
} else {
|
|
24177
|
-
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
|
|
24178
|
-
at: loc,
|
|
24216
|
+
this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
|
|
24179
24217
|
identifierName: name
|
|
24180
24218
|
});
|
|
24181
24219
|
}
|
|
@@ -24202,8 +24240,7 @@ function requireLib () {
|
|
|
24202
24240
|
}
|
|
24203
24241
|
}
|
|
24204
24242
|
if (redefined) {
|
|
24205
|
-
this.parser.raise(Errors.PrivateNameRedeclaration, {
|
|
24206
|
-
at: loc,
|
|
24243
|
+
this.parser.raise(Errors.PrivateNameRedeclaration, loc, {
|
|
24207
24244
|
identifierName: name
|
|
24208
24245
|
});
|
|
24209
24246
|
}
|
|
@@ -24218,8 +24255,7 @@ function requireLib () {
|
|
|
24218
24255
|
if (classScope) {
|
|
24219
24256
|
classScope.undefinedPrivateNames.set(name, loc);
|
|
24220
24257
|
} else {
|
|
24221
|
-
this.parser.raise(Errors.InvalidPrivateFieldResolution, {
|
|
24222
|
-
at: loc,
|
|
24258
|
+
this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, {
|
|
24223
24259
|
identifierName: name
|
|
24224
24260
|
});
|
|
24225
24261
|
}
|
|
@@ -24241,9 +24277,7 @@ function requireLib () {
|
|
|
24241
24277
|
super(type);
|
|
24242
24278
|
this.declarationErrors = new Map();
|
|
24243
24279
|
}
|
|
24244
|
-
recordDeclarationError(ParsingErrorClass, {
|
|
24245
|
-
at
|
|
24246
|
-
}) {
|
|
24280
|
+
recordDeclarationError(ParsingErrorClass, at) {
|
|
24247
24281
|
const index = at.index;
|
|
24248
24282
|
this.declarationErrors.set(index, [ParsingErrorClass, at]);
|
|
24249
24283
|
}
|
|
@@ -24266,12 +24300,8 @@ function requireLib () {
|
|
|
24266
24300
|
exit() {
|
|
24267
24301
|
this.stack.pop();
|
|
24268
24302
|
}
|
|
24269
|
-
recordParameterInitializerError(toParseError, {
|
|
24270
|
-
|
|
24271
|
-
}) {
|
|
24272
|
-
const origin = {
|
|
24273
|
-
at: node.loc.start
|
|
24274
|
-
};
|
|
24303
|
+
recordParameterInitializerError(toParseError, node) {
|
|
24304
|
+
const origin = node.loc.start;
|
|
24275
24305
|
const {
|
|
24276
24306
|
stack
|
|
24277
24307
|
} = this;
|
|
@@ -24287,16 +24317,12 @@ function requireLib () {
|
|
|
24287
24317
|
}
|
|
24288
24318
|
this.parser.raise(toParseError, origin);
|
|
24289
24319
|
}
|
|
24290
|
-
recordArrowParameterBindingError(error, {
|
|
24291
|
-
at: node
|
|
24292
|
-
}) {
|
|
24320
|
+
recordArrowParameterBindingError(error, node) {
|
|
24293
24321
|
const {
|
|
24294
24322
|
stack
|
|
24295
24323
|
} = this;
|
|
24296
24324
|
const scope = stack[stack.length - 1];
|
|
24297
|
-
const origin =
|
|
24298
|
-
at: node.loc.start
|
|
24299
|
-
};
|
|
24325
|
+
const origin = node.loc.start;
|
|
24300
24326
|
if (scope.isCertainlyParameterDeclaration()) {
|
|
24301
24327
|
this.parser.raise(error, origin);
|
|
24302
24328
|
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
@@ -24305,9 +24331,7 @@ function requireLib () {
|
|
|
24305
24331
|
return;
|
|
24306
24332
|
}
|
|
24307
24333
|
}
|
|
24308
|
-
recordAsyncArrowParametersError({
|
|
24309
|
-
at
|
|
24310
|
-
}) {
|
|
24334
|
+
recordAsyncArrowParametersError(at) {
|
|
24311
24335
|
const {
|
|
24312
24336
|
stack
|
|
24313
24337
|
} = this;
|
|
@@ -24315,9 +24339,7 @@ function requireLib () {
|
|
|
24315
24339
|
let scope = stack[i];
|
|
24316
24340
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
24317
24341
|
if (scope.type === 2) {
|
|
24318
|
-
scope.recordDeclarationError(Errors.AwaitBindingIdentifier,
|
|
24319
|
-
at
|
|
24320
|
-
});
|
|
24342
|
+
scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
24321
24343
|
}
|
|
24322
24344
|
scope = stack[--i];
|
|
24323
24345
|
}
|
|
@@ -24329,9 +24351,7 @@ function requireLib () {
|
|
|
24329
24351
|
const currentScope = stack[stack.length - 1];
|
|
24330
24352
|
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
24331
24353
|
currentScope.iterateErrors(([toParseError, loc]) => {
|
|
24332
|
-
this.parser.raise(toParseError,
|
|
24333
|
-
at: loc
|
|
24334
|
-
});
|
|
24354
|
+
this.parser.raise(toParseError, loc);
|
|
24335
24355
|
let i = stack.length - 2;
|
|
24336
24356
|
let scope = stack[i];
|
|
24337
24357
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
@@ -24420,9 +24440,7 @@ function requireLib () {
|
|
|
24420
24440
|
expectContextual(token, toParseError) {
|
|
24421
24441
|
if (!this.eatContextual(token)) {
|
|
24422
24442
|
if (toParseError != null) {
|
|
24423
|
-
throw this.raise(toParseError,
|
|
24424
|
-
at: this.state.startLoc
|
|
24425
|
-
});
|
|
24443
|
+
throw this.raise(toParseError, this.state.startLoc);
|
|
24426
24444
|
}
|
|
24427
24445
|
this.unexpected(null, token);
|
|
24428
24446
|
}
|
|
@@ -24442,9 +24460,7 @@ function requireLib () {
|
|
|
24442
24460
|
}
|
|
24443
24461
|
semicolon(allowAsi = true) {
|
|
24444
24462
|
if (allowAsi ? this.isLineTerminator() : this.eat(13)) return;
|
|
24445
|
-
this.raise(Errors.MissingSemicolon,
|
|
24446
|
-
at: this.state.lastTokEndLoc
|
|
24447
|
-
});
|
|
24463
|
+
this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
|
|
24448
24464
|
}
|
|
24449
24465
|
expect(type, loc) {
|
|
24450
24466
|
this.eat(type) || this.unexpected(loc, type);
|
|
@@ -24514,19 +24530,13 @@ function requireLib () {
|
|
|
24514
24530
|
return hasErrors;
|
|
24515
24531
|
}
|
|
24516
24532
|
if (shorthandAssignLoc != null) {
|
|
24517
|
-
this.raise(Errors.InvalidCoverInitializedName,
|
|
24518
|
-
at: shorthandAssignLoc
|
|
24519
|
-
});
|
|
24533
|
+
this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
24520
24534
|
}
|
|
24521
24535
|
if (doubleProtoLoc != null) {
|
|
24522
|
-
this.raise(Errors.DuplicateProto,
|
|
24523
|
-
at: doubleProtoLoc
|
|
24524
|
-
});
|
|
24536
|
+
this.raise(Errors.DuplicateProto, doubleProtoLoc);
|
|
24525
24537
|
}
|
|
24526
24538
|
if (privateKeyLoc != null) {
|
|
24527
|
-
this.raise(Errors.UnexpectedPrivateField,
|
|
24528
|
-
at: privateKeyLoc
|
|
24529
|
-
});
|
|
24539
|
+
this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
24530
24540
|
}
|
|
24531
24541
|
if (optionalParametersLoc != null) {
|
|
24532
24542
|
this.unexpected(optionalParametersLoc);
|
|
@@ -24679,7 +24689,8 @@ function requireLib () {
|
|
|
24679
24689
|
}
|
|
24680
24690
|
class NodeUtils extends UtilParser {
|
|
24681
24691
|
startNode() {
|
|
24682
|
-
|
|
24692
|
+
const loc = this.state.startLoc;
|
|
24693
|
+
return new Node(this, loc.index, loc);
|
|
24683
24694
|
}
|
|
24684
24695
|
startNodeAt(loc) {
|
|
24685
24696
|
return new Node(this, loc.index, loc);
|
|
@@ -24875,10 +24886,8 @@ function requireLib () {
|
|
|
24875
24886
|
const moduloLoc = this.state.startLoc;
|
|
24876
24887
|
this.next();
|
|
24877
24888
|
this.expectContextual(110);
|
|
24878
|
-
if (this.state.
|
|
24879
|
-
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks,
|
|
24880
|
-
at: moduloLoc
|
|
24881
|
-
});
|
|
24889
|
+
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) {
|
|
24890
|
+
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
24882
24891
|
}
|
|
24883
24892
|
if (this.eat(10)) {
|
|
24884
24893
|
node.value = super.parseExpression();
|
|
@@ -24947,9 +24956,7 @@ function requireLib () {
|
|
|
24947
24956
|
return this.flowParseDeclareModuleExports(node);
|
|
24948
24957
|
} else {
|
|
24949
24958
|
if (insideModule) {
|
|
24950
|
-
this.raise(FlowErrors.NestedDeclareModule,
|
|
24951
|
-
at: this.state.lastTokStartLoc
|
|
24952
|
-
});
|
|
24959
|
+
this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
24953
24960
|
}
|
|
24954
24961
|
return this.flowParseDeclareModule(node);
|
|
24955
24962
|
}
|
|
@@ -24987,9 +24994,7 @@ function requireLib () {
|
|
|
24987
24994
|
if (this.match(83)) {
|
|
24988
24995
|
this.next();
|
|
24989
24996
|
if (!this.isContextual(130) && !this.match(87)) {
|
|
24990
|
-
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule,
|
|
24991
|
-
at: this.state.lastTokStartLoc
|
|
24992
|
-
});
|
|
24997
|
+
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
24993
24998
|
}
|
|
24994
24999
|
super.parseImport(bodyNode);
|
|
24995
25000
|
} else {
|
|
@@ -25006,21 +25011,15 @@ function requireLib () {
|
|
|
25006
25011
|
body.forEach(bodyElement => {
|
|
25007
25012
|
if (isEsModuleType(bodyElement)) {
|
|
25008
25013
|
if (kind === "CommonJS") {
|
|
25009
|
-
this.raise(FlowErrors.AmbiguousDeclareModuleKind,
|
|
25010
|
-
at: bodyElement
|
|
25011
|
-
});
|
|
25014
|
+
this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
25012
25015
|
}
|
|
25013
25016
|
kind = "ES";
|
|
25014
25017
|
} else if (bodyElement.type === "DeclareModuleExports") {
|
|
25015
25018
|
if (hasModuleExport) {
|
|
25016
|
-
this.raise(FlowErrors.DuplicateDeclareModuleExports,
|
|
25017
|
-
at: bodyElement
|
|
25018
|
-
});
|
|
25019
|
+
this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
|
|
25019
25020
|
}
|
|
25020
25021
|
if (kind === "ES") {
|
|
25021
|
-
this.raise(FlowErrors.AmbiguousDeclareModuleKind,
|
|
25022
|
-
at: bodyElement
|
|
25023
|
-
});
|
|
25022
|
+
this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
25024
25023
|
}
|
|
25025
25024
|
kind = "CommonJS";
|
|
25026
25025
|
hasModuleExport = true;
|
|
@@ -25043,8 +25042,7 @@ function requireLib () {
|
|
|
25043
25042
|
} else {
|
|
25044
25043
|
if (this.match(75) || this.isLet() || (this.isContextual(130) || this.isContextual(129)) && !insideModule) {
|
|
25045
25044
|
const label = this.state.value;
|
|
25046
|
-
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
|
|
25047
|
-
at: this.state.startLoc,
|
|
25045
|
+
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
25048
25046
|
unsupportedExportKind: label,
|
|
25049
25047
|
suggestion: exportSuggestions[label]
|
|
25050
25048
|
});
|
|
@@ -25142,15 +25140,12 @@ function requireLib () {
|
|
|
25142
25140
|
}
|
|
25143
25141
|
checkNotUnderscore(word) {
|
|
25144
25142
|
if (word === "_") {
|
|
25145
|
-
this.raise(FlowErrors.UnexpectedReservedUnderscore,
|
|
25146
|
-
at: this.state.startLoc
|
|
25147
|
-
});
|
|
25143
|
+
this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
|
|
25148
25144
|
}
|
|
25149
25145
|
}
|
|
25150
25146
|
checkReservedType(word, startLoc, declaration) {
|
|
25151
25147
|
if (!reservedTypes.has(word)) return;
|
|
25152
|
-
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, {
|
|
25153
|
-
at: startLoc,
|
|
25148
|
+
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, {
|
|
25154
25149
|
reservedType: word
|
|
25155
25150
|
});
|
|
25156
25151
|
}
|
|
@@ -25203,9 +25198,7 @@ function requireLib () {
|
|
|
25203
25198
|
node.default = this.flowParseType();
|
|
25204
25199
|
} else {
|
|
25205
25200
|
if (requireDefault) {
|
|
25206
|
-
this.raise(FlowErrors.MissingTypeParamDefault,
|
|
25207
|
-
at: nodeStartLoc
|
|
25208
|
-
});
|
|
25201
|
+
this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
|
|
25209
25202
|
}
|
|
25210
25203
|
}
|
|
25211
25204
|
return this.finishNode(node, "TypeParameter");
|
|
@@ -25445,9 +25438,7 @@ function requireLib () {
|
|
|
25445
25438
|
}
|
|
25446
25439
|
this.flowObjectTypeSemicolon();
|
|
25447
25440
|
if (inexactStartLoc && !this.match(8) && !this.match(9)) {
|
|
25448
|
-
this.raise(FlowErrors.UnexpectedExplicitInexactInObject,
|
|
25449
|
-
at: inexactStartLoc
|
|
25450
|
-
});
|
|
25441
|
+
this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
|
|
25451
25442
|
}
|
|
25452
25443
|
}
|
|
25453
25444
|
this.expect(endDelim);
|
|
@@ -25463,33 +25454,23 @@ function requireLib () {
|
|
|
25463
25454
|
const isInexactToken = this.match(12) || this.match(13) || this.match(8) || this.match(9);
|
|
25464
25455
|
if (isInexactToken) {
|
|
25465
25456
|
if (!allowSpread) {
|
|
25466
|
-
this.raise(FlowErrors.InexactInsideNonObject,
|
|
25467
|
-
at: this.state.lastTokStartLoc
|
|
25468
|
-
});
|
|
25457
|
+
this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
|
|
25469
25458
|
} else if (!allowInexact) {
|
|
25470
|
-
this.raise(FlowErrors.InexactInsideExact,
|
|
25471
|
-
at: this.state.lastTokStartLoc
|
|
25472
|
-
});
|
|
25459
|
+
this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
|
|
25473
25460
|
}
|
|
25474
25461
|
if (variance) {
|
|
25475
|
-
this.raise(FlowErrors.InexactVariance,
|
|
25476
|
-
at: variance
|
|
25477
|
-
});
|
|
25462
|
+
this.raise(FlowErrors.InexactVariance, variance);
|
|
25478
25463
|
}
|
|
25479
25464
|
return null;
|
|
25480
25465
|
}
|
|
25481
25466
|
if (!allowSpread) {
|
|
25482
|
-
this.raise(FlowErrors.UnexpectedSpreadType,
|
|
25483
|
-
at: this.state.lastTokStartLoc
|
|
25484
|
-
});
|
|
25467
|
+
this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
|
|
25485
25468
|
}
|
|
25486
25469
|
if (protoStartLoc != null) {
|
|
25487
25470
|
this.unexpected(protoStartLoc);
|
|
25488
25471
|
}
|
|
25489
25472
|
if (variance) {
|
|
25490
|
-
this.raise(FlowErrors.SpreadVariance,
|
|
25491
|
-
at: variance
|
|
25492
|
-
});
|
|
25473
|
+
this.raise(FlowErrors.SpreadVariance, variance);
|
|
25493
25474
|
}
|
|
25494
25475
|
node.argument = this.flowParseType();
|
|
25495
25476
|
return this.finishNode(node, "ObjectTypeSpreadProperty");
|
|
@@ -25512,9 +25493,7 @@ function requireLib () {
|
|
|
25512
25493
|
this.flowCheckGetterSetterParams(node);
|
|
25513
25494
|
}
|
|
25514
25495
|
if (!allowSpread && node.key.name === "constructor" && node.value.this) {
|
|
25515
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
25516
|
-
at: node.value.this
|
|
25517
|
-
});
|
|
25496
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
|
|
25518
25497
|
}
|
|
25519
25498
|
} else {
|
|
25520
25499
|
if (kind !== "init") this.unexpected();
|
|
@@ -25533,19 +25512,13 @@ function requireLib () {
|
|
|
25533
25512
|
const paramCount = property.kind === "get" ? 0 : 1;
|
|
25534
25513
|
const length = property.value.params.length + (property.value.rest ? 1 : 0);
|
|
25535
25514
|
if (property.value.this) {
|
|
25536
|
-
this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam,
|
|
25537
|
-
at: property.value.this
|
|
25538
|
-
});
|
|
25515
|
+
this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, property.value.this);
|
|
25539
25516
|
}
|
|
25540
25517
|
if (length !== paramCount) {
|
|
25541
|
-
this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity,
|
|
25542
|
-
at: property
|
|
25543
|
-
});
|
|
25518
|
+
this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
|
|
25544
25519
|
}
|
|
25545
25520
|
if (property.kind === "set" && property.value.rest) {
|
|
25546
|
-
this.raise(Errors.BadSetterRestParameter,
|
|
25547
|
-
at: property
|
|
25548
|
-
});
|
|
25521
|
+
this.raise(Errors.BadSetterRestParameter, property);
|
|
25549
25522
|
}
|
|
25550
25523
|
}
|
|
25551
25524
|
flowObjectTypeSemicolon() {
|
|
@@ -25601,17 +25574,13 @@ function requireLib () {
|
|
|
25601
25574
|
const isThis = this.state.type === 78;
|
|
25602
25575
|
if (lh.type === 14 || lh.type === 17) {
|
|
25603
25576
|
if (isThis && !first) {
|
|
25604
|
-
this.raise(FlowErrors.ThisParamMustBeFirst,
|
|
25605
|
-
at: node
|
|
25606
|
-
});
|
|
25577
|
+
this.raise(FlowErrors.ThisParamMustBeFirst, node);
|
|
25607
25578
|
}
|
|
25608
25579
|
name = this.parseIdentifier(isThis);
|
|
25609
25580
|
if (this.eat(17)) {
|
|
25610
25581
|
optional = true;
|
|
25611
25582
|
if (isThis) {
|
|
25612
|
-
this.raise(FlowErrors.ThisParamMayNotBeOptional,
|
|
25613
|
-
at: node
|
|
25614
|
-
});
|
|
25583
|
+
this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
|
|
25615
25584
|
}
|
|
25616
25585
|
}
|
|
25617
25586
|
typeAnnotation = this.flowParseTypeInitialiser();
|
|
@@ -25767,9 +25736,7 @@ function requireLib () {
|
|
|
25767
25736
|
if (this.match(135)) {
|
|
25768
25737
|
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
25769
25738
|
}
|
|
25770
|
-
throw this.raise(FlowErrors.UnexpectedSubtractionOperand,
|
|
25771
|
-
at: this.state.startLoc
|
|
25772
|
-
});
|
|
25739
|
+
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
25773
25740
|
}
|
|
25774
25741
|
this.unexpected();
|
|
25775
25742
|
return;
|
|
@@ -26033,9 +26000,7 @@ function requireLib () {
|
|
|
26033
26000
|
[valid, invalid] = this.getArrowLikeExpressions(consequent);
|
|
26034
26001
|
}
|
|
26035
26002
|
if (failed && valid.length > 1) {
|
|
26036
|
-
this.raise(FlowErrors.AmbiguousConditionalArrow,
|
|
26037
|
-
at: state.startLoc
|
|
26038
|
-
});
|
|
26003
|
+
this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
|
|
26039
26004
|
}
|
|
26040
26005
|
if (failed && valid.length === 1) {
|
|
26041
26006
|
this.state = state;
|
|
@@ -26196,13 +26161,9 @@ function requireLib () {
|
|
|
26196
26161
|
super.parseClassMember(classBody, member, state);
|
|
26197
26162
|
if (member.declare) {
|
|
26198
26163
|
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
|
|
26199
|
-
this.raise(FlowErrors.DeclareClassElement,
|
|
26200
|
-
at: startLoc
|
|
26201
|
-
});
|
|
26164
|
+
this.raise(FlowErrors.DeclareClassElement, startLoc);
|
|
26202
26165
|
} else if (member.value) {
|
|
26203
|
-
this.raise(FlowErrors.DeclareClassFieldInitializer,
|
|
26204
|
-
at: member.value
|
|
26205
|
-
});
|
|
26166
|
+
this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
|
|
26206
26167
|
}
|
|
26207
26168
|
}
|
|
26208
26169
|
}
|
|
@@ -26213,8 +26174,7 @@ function requireLib () {
|
|
|
26213
26174
|
const word = super.readWord1();
|
|
26214
26175
|
const fullWord = "@@" + word;
|
|
26215
26176
|
if (!this.isIterator(word) || !this.state.inType) {
|
|
26216
|
-
this.raise(Errors.InvalidIdentifier, {
|
|
26217
|
-
at: this.state.curPosition(),
|
|
26177
|
+
this.raise(Errors.InvalidIdentifier, this.state.curPosition(), {
|
|
26218
26178
|
identifierName: fullWord
|
|
26219
26179
|
});
|
|
26220
26180
|
}
|
|
@@ -26266,9 +26226,7 @@ function requireLib () {
|
|
|
26266
26226
|
var _expr$extra;
|
|
26267
26227
|
const expr = exprList[i];
|
|
26268
26228
|
if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) != null && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
|
|
26269
|
-
this.raise(FlowErrors.TypeCastInPattern,
|
|
26270
|
-
at: expr.typeAnnotation
|
|
26271
|
-
});
|
|
26229
|
+
this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
|
|
26272
26230
|
}
|
|
26273
26231
|
}
|
|
26274
26232
|
return exprList;
|
|
@@ -26316,16 +26274,12 @@ function requireLib () {
|
|
|
26316
26274
|
if (method.params && isConstructor) {
|
|
26317
26275
|
const params = method.params;
|
|
26318
26276
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
26319
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
26320
|
-
at: method
|
|
26321
|
-
});
|
|
26277
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
26322
26278
|
}
|
|
26323
26279
|
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
|
|
26324
26280
|
const params = method.value.params;
|
|
26325
26281
|
if (params.length > 0 && this.isThisParam(params[0])) {
|
|
26326
|
-
this.raise(FlowErrors.ThisParamBannedInConstructor,
|
|
26327
|
-
at: method
|
|
26328
|
-
});
|
|
26282
|
+
this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
26329
26283
|
}
|
|
26330
26284
|
}
|
|
26331
26285
|
}
|
|
@@ -26365,13 +26319,9 @@ function requireLib () {
|
|
|
26365
26319
|
if (params.length > 0) {
|
|
26366
26320
|
const param = params[0];
|
|
26367
26321
|
if (this.isThisParam(param) && method.kind === "get") {
|
|
26368
|
-
this.raise(FlowErrors.GetterMayNotHaveThisParam,
|
|
26369
|
-
at: param
|
|
26370
|
-
});
|
|
26322
|
+
this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
|
|
26371
26323
|
} else if (this.isThisParam(param)) {
|
|
26372
|
-
this.raise(FlowErrors.SetterMayNotHaveThisParam,
|
|
26373
|
-
at: param
|
|
26374
|
-
});
|
|
26324
|
+
this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
|
|
26375
26325
|
}
|
|
26376
26326
|
}
|
|
26377
26327
|
}
|
|
@@ -26397,28 +26347,20 @@ function requireLib () {
|
|
|
26397
26347
|
parseAssignableListItemTypes(param) {
|
|
26398
26348
|
if (this.eat(17)) {
|
|
26399
26349
|
if (param.type !== "Identifier") {
|
|
26400
|
-
this.raise(FlowErrors.PatternIsOptional,
|
|
26401
|
-
at: param
|
|
26402
|
-
});
|
|
26350
|
+
this.raise(FlowErrors.PatternIsOptional, param);
|
|
26403
26351
|
}
|
|
26404
26352
|
if (this.isThisParam(param)) {
|
|
26405
|
-
this.raise(FlowErrors.ThisParamMayNotBeOptional,
|
|
26406
|
-
at: param
|
|
26407
|
-
});
|
|
26353
|
+
this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
|
|
26408
26354
|
}
|
|
26409
26355
|
param.optional = true;
|
|
26410
26356
|
}
|
|
26411
26357
|
if (this.match(14)) {
|
|
26412
26358
|
param.typeAnnotation = this.flowParseTypeAnnotation();
|
|
26413
26359
|
} else if (this.isThisParam(param)) {
|
|
26414
|
-
this.raise(FlowErrors.ThisParamAnnotationRequired,
|
|
26415
|
-
at: param
|
|
26416
|
-
});
|
|
26360
|
+
this.raise(FlowErrors.ThisParamAnnotationRequired, param);
|
|
26417
26361
|
}
|
|
26418
26362
|
if (this.match(29) && this.isThisParam(param)) {
|
|
26419
|
-
this.raise(FlowErrors.ThisParamNoDefault,
|
|
26420
|
-
at: param
|
|
26421
|
-
});
|
|
26363
|
+
this.raise(FlowErrors.ThisParamNoDefault, param);
|
|
26422
26364
|
}
|
|
26423
26365
|
this.resetEndLocation(param);
|
|
26424
26366
|
return param;
|
|
@@ -26426,18 +26368,14 @@ function requireLib () {
|
|
|
26426
26368
|
parseMaybeDefault(startLoc, left) {
|
|
26427
26369
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
26428
26370
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
26429
|
-
this.raise(FlowErrors.TypeBeforeInitializer,
|
|
26430
|
-
at: node.typeAnnotation
|
|
26431
|
-
});
|
|
26371
|
+
this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
|
|
26432
26372
|
}
|
|
26433
26373
|
return node;
|
|
26434
26374
|
}
|
|
26435
26375
|
checkImportReflection(node) {
|
|
26436
26376
|
super.checkImportReflection(node);
|
|
26437
26377
|
if (node.module && node.importKind !== "value") {
|
|
26438
|
-
this.raise(FlowErrors.ImportReflectionHasImportType,
|
|
26439
|
-
at: node.specifiers[0].loc.start
|
|
26440
|
-
});
|
|
26378
|
+
this.raise(FlowErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
|
|
26441
26379
|
}
|
|
26442
26380
|
}
|
|
26443
26381
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -26493,8 +26431,7 @@ function requireLib () {
|
|
|
26493
26431
|
specifier.importKind = specifierTypeKind;
|
|
26494
26432
|
} else {
|
|
26495
26433
|
if (importedIsString) {
|
|
26496
|
-
throw this.raise(Errors.ImportBindingIsString, {
|
|
26497
|
-
at: specifier,
|
|
26434
|
+
throw this.raise(Errors.ImportBindingIsString, specifier, {
|
|
26498
26435
|
importName: firstIdent.value
|
|
26499
26436
|
});
|
|
26500
26437
|
}
|
|
@@ -26510,9 +26447,7 @@ function requireLib () {
|
|
|
26510
26447
|
}
|
|
26511
26448
|
const specifierIsTypeImport = hasTypeImportKind(specifier);
|
|
26512
26449
|
if (isInTypeOnlyImport && specifierIsTypeImport) {
|
|
26513
|
-
this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport,
|
|
26514
|
-
at: specifier
|
|
26515
|
-
});
|
|
26450
|
+
this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
|
|
26516
26451
|
}
|
|
26517
26452
|
if (isInTypeOnlyImport || specifierIsTypeImport) {
|
|
26518
26453
|
this.checkReservedType(specifier.local.name, specifier.local.loc.start, true);
|
|
@@ -26595,9 +26530,7 @@ function requireLib () {
|
|
|
26595
26530
|
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
26596
26531
|
if (!arrow.error && !arrow.aborted) {
|
|
26597
26532
|
if (arrow.node.async) {
|
|
26598
|
-
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction,
|
|
26599
|
-
at: typeParameters
|
|
26600
|
-
});
|
|
26533
|
+
this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
|
|
26601
26534
|
}
|
|
26602
26535
|
return arrow.node;
|
|
26603
26536
|
}
|
|
@@ -26613,9 +26546,7 @@ function requireLib () {
|
|
|
26613
26546
|
}
|
|
26614
26547
|
if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
|
|
26615
26548
|
if (arrow.thrown) throw arrow.error;
|
|
26616
|
-
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter,
|
|
26617
|
-
at: typeParameters
|
|
26618
|
-
});
|
|
26549
|
+
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
|
|
26619
26550
|
}
|
|
26620
26551
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
26621
26552
|
}
|
|
@@ -26653,9 +26584,7 @@ function requireLib () {
|
|
|
26653
26584
|
}
|
|
26654
26585
|
for (let i = 0; i < node.params.length; i++) {
|
|
26655
26586
|
if (this.isThisParam(node.params[i]) && i > 0) {
|
|
26656
|
-
this.raise(FlowErrors.ThisParamMustBeFirst,
|
|
26657
|
-
at: node.params[i]
|
|
26658
|
-
});
|
|
26587
|
+
this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
|
|
26659
26588
|
}
|
|
26660
26589
|
}
|
|
26661
26590
|
super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
|
|
@@ -26757,18 +26686,14 @@ function requireLib () {
|
|
|
26757
26686
|
parseTopLevel(file, program) {
|
|
26758
26687
|
const fileNode = super.parseTopLevel(file, program);
|
|
26759
26688
|
if (this.state.hasFlowComment) {
|
|
26760
|
-
this.raise(FlowErrors.UnterminatedFlowComment,
|
|
26761
|
-
at: this.state.curPosition()
|
|
26762
|
-
});
|
|
26689
|
+
this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
|
|
26763
26690
|
}
|
|
26764
26691
|
return fileNode;
|
|
26765
26692
|
}
|
|
26766
26693
|
skipBlockComment() {
|
|
26767
26694
|
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
|
|
26768
26695
|
if (this.state.hasFlowComment) {
|
|
26769
|
-
throw this.raise(FlowErrors.NestedFlowComment,
|
|
26770
|
-
at: this.state.startLoc
|
|
26771
|
-
});
|
|
26696
|
+
throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
|
|
26772
26697
|
}
|
|
26773
26698
|
this.hasFlowCommentCompletion();
|
|
26774
26699
|
const commentSkip = this.skipFlowComment();
|
|
@@ -26804,43 +26729,26 @@ function requireLib () {
|
|
|
26804
26729
|
hasFlowCommentCompletion() {
|
|
26805
26730
|
const end = this.input.indexOf("*/", this.state.pos);
|
|
26806
26731
|
if (end === -1) {
|
|
26807
|
-
throw this.raise(Errors.UnterminatedComment,
|
|
26808
|
-
at: this.state.curPosition()
|
|
26809
|
-
});
|
|
26732
|
+
throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
26810
26733
|
}
|
|
26811
26734
|
}
|
|
26812
26735
|
flowEnumErrorBooleanMemberNotInitialized(loc, {
|
|
26813
26736
|
enumName,
|
|
26814
26737
|
memberName
|
|
26815
26738
|
}) {
|
|
26816
|
-
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, {
|
|
26817
|
-
at: loc,
|
|
26739
|
+
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, {
|
|
26818
26740
|
memberName,
|
|
26819
26741
|
enumName
|
|
26820
26742
|
});
|
|
26821
26743
|
}
|
|
26822
26744
|
flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
|
|
26823
|
-
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType,
|
|
26824
|
-
at: loc
|
|
26825
|
-
}, enumContext));
|
|
26745
|
+
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
|
|
26826
26746
|
}
|
|
26827
|
-
flowEnumErrorNumberMemberNotInitialized(loc, {
|
|
26828
|
-
|
|
26829
|
-
memberName
|
|
26830
|
-
}) {
|
|
26831
|
-
this.raise(FlowErrors.EnumNumberMemberNotInitialized, {
|
|
26832
|
-
at: loc,
|
|
26833
|
-
enumName,
|
|
26834
|
-
memberName
|
|
26835
|
-
});
|
|
26747
|
+
flowEnumErrorNumberMemberNotInitialized(loc, details) {
|
|
26748
|
+
this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
|
|
26836
26749
|
}
|
|
26837
|
-
flowEnumErrorStringMemberInconsistentlyInitialized(node, {
|
|
26838
|
-
|
|
26839
|
-
}) {
|
|
26840
|
-
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, {
|
|
26841
|
-
at: node,
|
|
26842
|
-
enumName
|
|
26843
|
-
});
|
|
26750
|
+
flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
|
|
26751
|
+
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
|
|
26844
26752
|
}
|
|
26845
26753
|
flowEnumMemberInit() {
|
|
26846
26754
|
const startLoc = this.state.startLoc;
|
|
@@ -26949,16 +26857,14 @@ function requireLib () {
|
|
|
26949
26857
|
continue;
|
|
26950
26858
|
}
|
|
26951
26859
|
if (/^[a-z]/.test(memberName)) {
|
|
26952
|
-
this.raise(FlowErrors.EnumInvalidMemberName, {
|
|
26953
|
-
at: id,
|
|
26860
|
+
this.raise(FlowErrors.EnumInvalidMemberName, id, {
|
|
26954
26861
|
memberName,
|
|
26955
26862
|
suggestion: memberName[0].toUpperCase() + memberName.slice(1),
|
|
26956
26863
|
enumName
|
|
26957
26864
|
});
|
|
26958
26865
|
}
|
|
26959
26866
|
if (seenNames.has(memberName)) {
|
|
26960
|
-
this.raise(FlowErrors.EnumDuplicateMemberName, {
|
|
26961
|
-
at: id,
|
|
26867
|
+
this.raise(FlowErrors.EnumDuplicateMemberName, id, {
|
|
26962
26868
|
memberName,
|
|
26963
26869
|
enumName
|
|
26964
26870
|
});
|
|
@@ -27047,8 +26953,7 @@ function requireLib () {
|
|
|
27047
26953
|
}) {
|
|
27048
26954
|
if (!this.eatContextual(102)) return null;
|
|
27049
26955
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
27050
|
-
throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, {
|
|
27051
|
-
at: this.state.startLoc,
|
|
26956
|
+
throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, {
|
|
27052
26957
|
enumName
|
|
27053
26958
|
});
|
|
27054
26959
|
}
|
|
@@ -27057,8 +26962,7 @@ function requireLib () {
|
|
|
27057
26962
|
} = this.state;
|
|
27058
26963
|
this.next();
|
|
27059
26964
|
if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
|
|
27060
|
-
this.raise(FlowErrors.EnumInvalidExplicitType, {
|
|
27061
|
-
at: this.state.startLoc,
|
|
26965
|
+
this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
|
|
27062
26966
|
enumName,
|
|
27063
26967
|
invalidEnumType: value
|
|
27064
26968
|
});
|
|
@@ -27143,8 +27047,7 @@ function requireLib () {
|
|
|
27143
27047
|
this.expect(8);
|
|
27144
27048
|
return this.finishNode(node, "EnumNumberBody");
|
|
27145
27049
|
} else {
|
|
27146
|
-
this.raise(FlowErrors.EnumInconsistentMemberValues, {
|
|
27147
|
-
at: nameLoc,
|
|
27050
|
+
this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, {
|
|
27148
27051
|
enumName
|
|
27149
27052
|
});
|
|
27150
27053
|
return empty();
|
|
@@ -27462,9 +27365,7 @@ function requireLib () {
|
|
|
27462
27365
|
let chunkStart = this.state.pos;
|
|
27463
27366
|
for (;;) {
|
|
27464
27367
|
if (this.state.pos >= this.length) {
|
|
27465
|
-
throw this.raise(JsxErrors.UnterminatedJsxContent,
|
|
27466
|
-
at: this.state.startLoc
|
|
27467
|
-
});
|
|
27368
|
+
throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
|
|
27468
27369
|
}
|
|
27469
27370
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
27470
27371
|
switch (ch) {
|
|
@@ -27519,9 +27420,7 @@ function requireLib () {
|
|
|
27519
27420
|
let chunkStart = ++this.state.pos;
|
|
27520
27421
|
for (;;) {
|
|
27521
27422
|
if (this.state.pos >= this.length) {
|
|
27522
|
-
throw this.raise(Errors.UnterminatedString,
|
|
27523
|
-
at: this.state.startLoc
|
|
27524
|
-
});
|
|
27423
|
+
throw this.raise(Errors.UnterminatedString, this.state.startLoc);
|
|
27525
27424
|
}
|
|
27526
27425
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
27527
27426
|
if (ch === quote) break;
|
|
@@ -27624,18 +27523,14 @@ function requireLib () {
|
|
|
27624
27523
|
this.next();
|
|
27625
27524
|
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
27626
27525
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
27627
|
-
this.raise(JsxErrors.AttributeIsEmpty,
|
|
27628
|
-
at: node
|
|
27629
|
-
});
|
|
27526
|
+
this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
27630
27527
|
}
|
|
27631
27528
|
return node;
|
|
27632
27529
|
case 142:
|
|
27633
27530
|
case 133:
|
|
27634
27531
|
return this.parseExprAtom();
|
|
27635
27532
|
default:
|
|
27636
|
-
throw this.raise(JsxErrors.UnsupportedJsxValue,
|
|
27637
|
-
at: this.state.startLoc
|
|
27638
|
-
});
|
|
27533
|
+
throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
27639
27534
|
}
|
|
27640
27535
|
}
|
|
27641
27536
|
jsxParseEmptyExpression() {
|
|
@@ -27742,18 +27637,14 @@ function requireLib () {
|
|
|
27742
27637
|
}
|
|
27743
27638
|
}
|
|
27744
27639
|
if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) {
|
|
27745
|
-
this.raise(JsxErrors.MissingClosingTagFragment,
|
|
27746
|
-
at: closingElement
|
|
27747
|
-
});
|
|
27640
|
+
this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
|
|
27748
27641
|
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
|
27749
|
-
this.raise(JsxErrors.MissingClosingTagElement, {
|
|
27750
|
-
at: closingElement,
|
|
27642
|
+
this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
|
|
27751
27643
|
openingTagName: getQualifiedJSXName(openingElement.name)
|
|
27752
27644
|
});
|
|
27753
27645
|
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
|
27754
27646
|
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
|
27755
|
-
this.raise(JsxErrors.MissingClosingTagElement, {
|
|
27756
|
-
at: closingElement,
|
|
27647
|
+
this.raise(JsxErrors.MissingClosingTagElement, closingElement, {
|
|
27757
27648
|
openingTagName: getQualifiedJSXName(openingElement.name)
|
|
27758
27649
|
});
|
|
27759
27650
|
}
|
|
@@ -27768,9 +27659,7 @@ function requireLib () {
|
|
|
27768
27659
|
}
|
|
27769
27660
|
node.children = children;
|
|
27770
27661
|
if (this.match(47)) {
|
|
27771
|
-
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements,
|
|
27772
|
-
at: this.state.startLoc
|
|
27773
|
-
});
|
|
27662
|
+
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
|
|
27774
27663
|
}
|
|
27775
27664
|
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
|
27776
27665
|
}
|
|
@@ -27856,11 +27745,7 @@ function requireLib () {
|
|
|
27856
27745
|
class TypeScriptScope extends Scope {
|
|
27857
27746
|
constructor(...args) {
|
|
27858
27747
|
super(...args);
|
|
27859
|
-
this.
|
|
27860
|
-
this.enums = new Set();
|
|
27861
|
-
this.constEnums = new Set();
|
|
27862
|
-
this.classes = new Set();
|
|
27863
|
-
this.exportOnlyBindings = new Set();
|
|
27748
|
+
this.tsNames = new Map();
|
|
27864
27749
|
}
|
|
27865
27750
|
}
|
|
27866
27751
|
class TypeScriptScopeHandler extends ScopeHandler {
|
|
@@ -27900,8 +27785,7 @@ function requireLib () {
|
|
|
27900
27785
|
declareName(name, bindingType, loc) {
|
|
27901
27786
|
if (bindingType & 4096) {
|
|
27902
27787
|
if (this.hasImport(name, true)) {
|
|
27903
|
-
this.parser.raise(Errors.VarRedeclaration, {
|
|
27904
|
-
at: loc,
|
|
27788
|
+
this.parser.raise(Errors.VarRedeclaration, loc, {
|
|
27905
27789
|
identifierName: name
|
|
27906
27790
|
});
|
|
27907
27791
|
}
|
|
@@ -27909,9 +27793,10 @@ function requireLib () {
|
|
|
27909
27793
|
return;
|
|
27910
27794
|
}
|
|
27911
27795
|
const scope = this.currentScope();
|
|
27796
|
+
let type = scope.tsNames.get(name) || 0;
|
|
27912
27797
|
if (bindingType & 1024) {
|
|
27913
27798
|
this.maybeExportDefined(scope, name);
|
|
27914
|
-
scope.
|
|
27799
|
+
scope.tsNames.set(name, type | 16);
|
|
27915
27800
|
return;
|
|
27916
27801
|
}
|
|
27917
27802
|
super.declareName(name, bindingType, loc);
|
|
@@ -27920,31 +27805,37 @@ function requireLib () {
|
|
|
27920
27805
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
27921
27806
|
this.maybeExportDefined(scope, name);
|
|
27922
27807
|
}
|
|
27923
|
-
|
|
27808
|
+
type = type | 1;
|
|
27809
|
+
}
|
|
27810
|
+
if (bindingType & 256) {
|
|
27811
|
+
type = type | 2;
|
|
27924
27812
|
}
|
|
27925
|
-
if (bindingType & 256) scope.enums.add(name);
|
|
27926
27813
|
if (bindingType & 512) {
|
|
27927
|
-
|
|
27814
|
+
type = type | 4;
|
|
27928
27815
|
}
|
|
27929
|
-
if (bindingType & 128)
|
|
27816
|
+
if (bindingType & 128) {
|
|
27817
|
+
type = type | 8;
|
|
27818
|
+
}
|
|
27819
|
+
if (type) scope.tsNames.set(name, type);
|
|
27930
27820
|
}
|
|
27931
27821
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
27932
|
-
|
|
27822
|
+
const type = scope.tsNames.get(name);
|
|
27823
|
+
if ((type & 2) > 0) {
|
|
27933
27824
|
if (bindingType & 256) {
|
|
27934
27825
|
const isConst = !!(bindingType & 512);
|
|
27935
|
-
const wasConst =
|
|
27826
|
+
const wasConst = (type & 4) > 0;
|
|
27936
27827
|
return isConst !== wasConst;
|
|
27937
27828
|
}
|
|
27938
27829
|
return true;
|
|
27939
27830
|
}
|
|
27940
|
-
if (bindingType & 128 &&
|
|
27941
|
-
if (scope.
|
|
27831
|
+
if (bindingType & 128 && (type & 8) > 0) {
|
|
27832
|
+
if (scope.names.get(name) & 2) {
|
|
27942
27833
|
return !!(bindingType & 1);
|
|
27943
27834
|
} else {
|
|
27944
27835
|
return false;
|
|
27945
27836
|
}
|
|
27946
27837
|
}
|
|
27947
|
-
if (bindingType & 2 &&
|
|
27838
|
+
if (bindingType & 2 && (type & 1) > 0) {
|
|
27948
27839
|
return true;
|
|
27949
27840
|
}
|
|
27950
27841
|
return super.isRedeclaredInScope(scope, name, bindingType);
|
|
@@ -27957,7 +27848,10 @@ function requireLib () {
|
|
|
27957
27848
|
const len = this.scopeStack.length;
|
|
27958
27849
|
for (let i = len - 1; i >= 0; i--) {
|
|
27959
27850
|
const scope = this.scopeStack[i];
|
|
27960
|
-
|
|
27851
|
+
const type = scope.tsNames.get(name);
|
|
27852
|
+
if ((type & 1) > 0 || (type & 16) > 0) {
|
|
27853
|
+
return;
|
|
27854
|
+
}
|
|
27961
27855
|
}
|
|
27962
27856
|
super.checkLocalExport(id);
|
|
27963
27857
|
}
|
|
@@ -27974,18 +27868,12 @@ function requireLib () {
|
|
|
27974
27868
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
27975
27869
|
if (isLHS) {
|
|
27976
27870
|
if (parenthesized.type === "Identifier") {
|
|
27977
|
-
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment,
|
|
27978
|
-
at: node
|
|
27979
|
-
});
|
|
27871
|
+
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
|
|
27980
27872
|
} else if (parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
|
|
27981
|
-
this.raise(Errors.InvalidParenthesizedAssignment,
|
|
27982
|
-
at: node
|
|
27983
|
-
});
|
|
27873
|
+
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
27984
27874
|
}
|
|
27985
27875
|
} else {
|
|
27986
|
-
this.raise(Errors.InvalidParenthesizedAssignment,
|
|
27987
|
-
at: node
|
|
27988
|
-
});
|
|
27876
|
+
this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
27989
27877
|
}
|
|
27990
27878
|
}
|
|
27991
27879
|
switch (node.type) {
|
|
@@ -28003,9 +27891,7 @@ function requireLib () {
|
|
|
28003
27891
|
const isLast = i === last;
|
|
28004
27892
|
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
28005
27893
|
if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingCommaLoc) {
|
|
28006
|
-
this.raise(Errors.RestTrailingComma,
|
|
28007
|
-
at: node.extra.trailingCommaLoc
|
|
28008
|
-
});
|
|
27894
|
+
this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
|
|
28009
27895
|
}
|
|
28010
27896
|
}
|
|
28011
27897
|
break;
|
|
@@ -28031,9 +27917,7 @@ function requireLib () {
|
|
|
28031
27917
|
break;
|
|
28032
27918
|
case "AssignmentExpression":
|
|
28033
27919
|
if (node.operator !== "=") {
|
|
28034
|
-
this.raise(Errors.MissingEqInAssignment,
|
|
28035
|
-
at: node.left.loc.end
|
|
28036
|
-
});
|
|
27920
|
+
this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
|
|
28037
27921
|
}
|
|
28038
27922
|
node.type = "AssignmentPattern";
|
|
28039
27923
|
delete node.operator;
|
|
@@ -28046,18 +27930,14 @@ function requireLib () {
|
|
|
28046
27930
|
}
|
|
28047
27931
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
28048
27932
|
if (prop.type === "ObjectMethod") {
|
|
28049
|
-
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod,
|
|
28050
|
-
at: prop.key
|
|
28051
|
-
});
|
|
27933
|
+
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
|
|
28052
27934
|
} else if (prop.type === "SpreadElement") {
|
|
28053
27935
|
prop.type = "RestElement";
|
|
28054
27936
|
const arg = prop.argument;
|
|
28055
27937
|
this.checkToRestConversion(arg, false);
|
|
28056
27938
|
this.toAssignable(arg, isLHS);
|
|
28057
27939
|
if (!isLast) {
|
|
28058
|
-
this.raise(Errors.RestTrailingComma,
|
|
28059
|
-
at: prop
|
|
28060
|
-
});
|
|
27940
|
+
this.raise(Errors.RestTrailingComma, prop);
|
|
28061
27941
|
}
|
|
28062
27942
|
} else {
|
|
28063
27943
|
this.toAssignable(prop, isLHS);
|
|
@@ -28078,13 +27958,9 @@ function requireLib () {
|
|
|
28078
27958
|
}
|
|
28079
27959
|
if (elt.type === "RestElement") {
|
|
28080
27960
|
if (i < end) {
|
|
28081
|
-
this.raise(Errors.RestTrailingComma,
|
|
28082
|
-
at: elt
|
|
28083
|
-
});
|
|
27961
|
+
this.raise(Errors.RestTrailingComma, elt);
|
|
28084
27962
|
} else if (trailingCommaLoc) {
|
|
28085
|
-
this.raise(Errors.RestTrailingComma,
|
|
28086
|
-
at: trailingCommaLoc
|
|
28087
|
-
});
|
|
27963
|
+
this.raise(Errors.RestTrailingComma, trailingCommaLoc);
|
|
28088
27964
|
}
|
|
28089
27965
|
}
|
|
28090
27966
|
}
|
|
@@ -28181,9 +28057,7 @@ function requireLib () {
|
|
|
28181
28057
|
} else {
|
|
28182
28058
|
const decorators = [];
|
|
28183
28059
|
if (this.match(26) && this.hasPlugin("decorators")) {
|
|
28184
|
-
this.raise(Errors.UnsupportedParameterDecorator,
|
|
28185
|
-
at: this.state.startLoc
|
|
28186
|
-
});
|
|
28060
|
+
this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
|
|
28187
28061
|
}
|
|
28188
28062
|
while (this.match(26)) {
|
|
28189
28063
|
decorators.push(this.parseDecorator());
|
|
@@ -28267,16 +28141,13 @@ function requireLib () {
|
|
|
28267
28141
|
if (isOptionalMemberExpression) {
|
|
28268
28142
|
this.expectPlugin("optionalChainingAssign", expression.loc.start);
|
|
28269
28143
|
if (ancestor.type !== "AssignmentExpression") {
|
|
28270
|
-
this.raise(Errors.InvalidLhsOptionalChaining, {
|
|
28271
|
-
at: expression,
|
|
28144
|
+
this.raise(Errors.InvalidLhsOptionalChaining, expression, {
|
|
28272
28145
|
ancestor
|
|
28273
28146
|
});
|
|
28274
28147
|
}
|
|
28275
28148
|
}
|
|
28276
28149
|
if (binding !== 64) {
|
|
28277
|
-
this.raise(Errors.InvalidPropertyBindingPattern,
|
|
28278
|
-
at: expression
|
|
28279
|
-
});
|
|
28150
|
+
this.raise(Errors.InvalidPropertyBindingPattern, expression);
|
|
28280
28151
|
}
|
|
28281
28152
|
return;
|
|
28282
28153
|
}
|
|
@@ -28287,9 +28158,7 @@ function requireLib () {
|
|
|
28287
28158
|
} = expression;
|
|
28288
28159
|
if (checkClashes) {
|
|
28289
28160
|
if (checkClashes.has(name)) {
|
|
28290
|
-
this.raise(Errors.ParamDupe,
|
|
28291
|
-
at: expression
|
|
28292
|
-
});
|
|
28161
|
+
this.raise(Errors.ParamDupe, expression);
|
|
28293
28162
|
} else {
|
|
28294
28163
|
checkClashes.add(name);
|
|
28295
28164
|
}
|
|
@@ -28300,8 +28169,7 @@ function requireLib () {
|
|
|
28300
28169
|
if (validity === true) return;
|
|
28301
28170
|
if (validity === false) {
|
|
28302
28171
|
const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
|
|
28303
|
-
this.raise(ParseErrorClass, {
|
|
28304
|
-
at: expression,
|
|
28172
|
+
this.raise(ParseErrorClass, expression, {
|
|
28305
28173
|
ancestor
|
|
28306
28174
|
});
|
|
28307
28175
|
return;
|
|
@@ -28325,21 +28193,17 @@ function requireLib () {
|
|
|
28325
28193
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
28326
28194
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
28327
28195
|
if (bindingType === 64) {
|
|
28328
|
-
this.raise(Errors.StrictEvalArguments, {
|
|
28329
|
-
at,
|
|
28196
|
+
this.raise(Errors.StrictEvalArguments, at, {
|
|
28330
28197
|
referenceName: at.name
|
|
28331
28198
|
});
|
|
28332
28199
|
} else {
|
|
28333
|
-
this.raise(Errors.StrictEvalArgumentsBinding, {
|
|
28334
|
-
at,
|
|
28200
|
+
this.raise(Errors.StrictEvalArgumentsBinding, at, {
|
|
28335
28201
|
bindingName: at.name
|
|
28336
28202
|
});
|
|
28337
28203
|
}
|
|
28338
28204
|
}
|
|
28339
28205
|
if (bindingType & 8192 && at.name === "let") {
|
|
28340
|
-
this.raise(Errors.LetInLexicalBinding,
|
|
28341
|
-
at
|
|
28342
|
-
});
|
|
28206
|
+
this.raise(Errors.LetInLexicalBinding, at);
|
|
28343
28207
|
}
|
|
28344
28208
|
if (!(bindingType & 64)) {
|
|
28345
28209
|
this.declareNameFromIdentifier(at, bindingType);
|
|
@@ -28360,18 +28224,14 @@ function requireLib () {
|
|
|
28360
28224
|
case "ObjectExpression":
|
|
28361
28225
|
if (allowPattern) break;
|
|
28362
28226
|
default:
|
|
28363
|
-
this.raise(Errors.InvalidRestAssignmentPattern,
|
|
28364
|
-
at: node
|
|
28365
|
-
});
|
|
28227
|
+
this.raise(Errors.InvalidRestAssignmentPattern, node);
|
|
28366
28228
|
}
|
|
28367
28229
|
}
|
|
28368
28230
|
checkCommaAfterRest(close) {
|
|
28369
28231
|
if (!this.match(12)) {
|
|
28370
28232
|
return false;
|
|
28371
28233
|
}
|
|
28372
|
-
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest,
|
|
28373
|
-
at: this.state.startLoc
|
|
28374
|
-
});
|
|
28234
|
+
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
|
|
28375
28235
|
return true;
|
|
28376
28236
|
}
|
|
28377
28237
|
}
|
|
@@ -28567,16 +28427,14 @@ function requireLib () {
|
|
|
28567
28427
|
}, modified) {
|
|
28568
28428
|
const enforceOrder = (loc, modifier, before, after) => {
|
|
28569
28429
|
if (modifier === before && modified[after]) {
|
|
28570
|
-
this.raise(TSErrors.InvalidModifiersOrder, {
|
|
28571
|
-
at: loc,
|
|
28430
|
+
this.raise(TSErrors.InvalidModifiersOrder, loc, {
|
|
28572
28431
|
orderedModifiers: [before, after]
|
|
28573
28432
|
});
|
|
28574
28433
|
}
|
|
28575
28434
|
};
|
|
28576
28435
|
const incompatible = (loc, modifier, mod1, mod2) => {
|
|
28577
28436
|
if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
|
|
28578
|
-
this.raise(TSErrors.IncompatibleModifiers, {
|
|
28579
|
-
at: loc,
|
|
28437
|
+
this.raise(TSErrors.IncompatibleModifiers, loc, {
|
|
28580
28438
|
modifiers: [mod1, mod2]
|
|
28581
28439
|
});
|
|
28582
28440
|
}
|
|
@@ -28589,8 +28447,7 @@ function requireLib () {
|
|
|
28589
28447
|
if (!modifier) break;
|
|
28590
28448
|
if (tsIsAccessModifier(modifier)) {
|
|
28591
28449
|
if (modified.accessibility) {
|
|
28592
|
-
this.raise(TSErrors.DuplicateAccessibilityModifier, {
|
|
28593
|
-
at: startLoc,
|
|
28450
|
+
this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
|
|
28594
28451
|
modifier
|
|
28595
28452
|
});
|
|
28596
28453
|
} else {
|
|
@@ -28601,8 +28458,7 @@ function requireLib () {
|
|
|
28601
28458
|
}
|
|
28602
28459
|
} else if (tsIsVarianceAnnotations(modifier)) {
|
|
28603
28460
|
if (modified[modifier]) {
|
|
28604
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
28605
|
-
at: startLoc,
|
|
28461
|
+
this.raise(TSErrors.DuplicateModifier, startLoc, {
|
|
28606
28462
|
modifier
|
|
28607
28463
|
});
|
|
28608
28464
|
}
|
|
@@ -28610,8 +28466,7 @@ function requireLib () {
|
|
|
28610
28466
|
enforceOrder(startLoc, modifier, "in", "out");
|
|
28611
28467
|
} else {
|
|
28612
28468
|
if (Object.hasOwnProperty.call(modified, modifier)) {
|
|
28613
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
28614
|
-
at: startLoc,
|
|
28469
|
+
this.raise(TSErrors.DuplicateModifier, startLoc, {
|
|
28615
28470
|
modifier
|
|
28616
28471
|
});
|
|
28617
28472
|
} else {
|
|
@@ -28625,8 +28480,7 @@ function requireLib () {
|
|
|
28625
28480
|
modified[modifier] = true;
|
|
28626
28481
|
}
|
|
28627
28482
|
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
|
|
28628
|
-
this.raise(errorTemplate, {
|
|
28629
|
-
at: startLoc,
|
|
28483
|
+
this.raise(errorTemplate, startLoc, {
|
|
28630
28484
|
modifier
|
|
28631
28485
|
});
|
|
28632
28486
|
}
|
|
@@ -28669,7 +28523,7 @@ function requireLib () {
|
|
|
28669
28523
|
}
|
|
28670
28524
|
result.push(element);
|
|
28671
28525
|
if (this.eat(12)) {
|
|
28672
|
-
trailingCommaPos = this.state.
|
|
28526
|
+
trailingCommaPos = this.state.lastTokStartLoc.index;
|
|
28673
28527
|
continue;
|
|
28674
28528
|
}
|
|
28675
28529
|
if (this.tsIsListTerminator(kind)) {
|
|
@@ -28706,9 +28560,7 @@ function requireLib () {
|
|
|
28706
28560
|
this.expect(83);
|
|
28707
28561
|
this.expect(10);
|
|
28708
28562
|
if (!this.match(133)) {
|
|
28709
|
-
this.raise(TSErrors.UnsupportedImportTypeArgument,
|
|
28710
|
-
at: this.state.startLoc
|
|
28711
|
-
});
|
|
28563
|
+
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
28712
28564
|
}
|
|
28713
28565
|
node.argument = super.parseExprAtom();
|
|
28714
28566
|
this.expect(11);
|
|
@@ -28789,9 +28641,7 @@ function requireLib () {
|
|
|
28789
28641
|
};
|
|
28790
28642
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
28791
28643
|
if (node.params.length === 0) {
|
|
28792
|
-
this.raise(TSErrors.EmptyTypeParameters,
|
|
28793
|
-
at: node
|
|
28794
|
-
});
|
|
28644
|
+
this.raise(TSErrors.EmptyTypeParameters, node);
|
|
28795
28645
|
}
|
|
28796
28646
|
if (refTrailingCommaPos.value !== -1) {
|
|
28797
28647
|
this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
|
|
@@ -28818,8 +28668,7 @@ function requireLib () {
|
|
|
28818
28668
|
type
|
|
28819
28669
|
} = pattern;
|
|
28820
28670
|
if (type === "AssignmentPattern" || type === "TSParameterProperty") {
|
|
28821
|
-
this.raise(TSErrors.UnsupportedSignatureParameterKind, {
|
|
28822
|
-
at: pattern,
|
|
28671
|
+
this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, {
|
|
28823
28672
|
type
|
|
28824
28673
|
});
|
|
28825
28674
|
}
|
|
@@ -28864,15 +28713,11 @@ function requireLib () {
|
|
|
28864
28713
|
const nodeAny = node;
|
|
28865
28714
|
if (this.match(10) || this.match(47)) {
|
|
28866
28715
|
if (readonly) {
|
|
28867
|
-
this.raise(TSErrors.ReadonlyForMethodSignature,
|
|
28868
|
-
at: node
|
|
28869
|
-
});
|
|
28716
|
+
this.raise(TSErrors.ReadonlyForMethodSignature, node);
|
|
28870
28717
|
}
|
|
28871
28718
|
const method = nodeAny;
|
|
28872
28719
|
if (method.kind && this.match(47)) {
|
|
28873
|
-
this.raise(TSErrors.AccesorCannotHaveTypeParameters,
|
|
28874
|
-
at: this.state.curPosition()
|
|
28875
|
-
});
|
|
28720
|
+
this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition());
|
|
28876
28721
|
}
|
|
28877
28722
|
this.tsFillSignature(14, method);
|
|
28878
28723
|
this.tsParseTypeMemberSemicolon();
|
|
@@ -28880,42 +28725,28 @@ function requireLib () {
|
|
|
28880
28725
|
const returnTypeKey = "typeAnnotation";
|
|
28881
28726
|
if (method.kind === "get") {
|
|
28882
28727
|
if (method[paramsKey].length > 0) {
|
|
28883
|
-
this.raise(Errors.BadGetterArity,
|
|
28884
|
-
at: this.state.curPosition()
|
|
28885
|
-
});
|
|
28728
|
+
this.raise(Errors.BadGetterArity, this.state.curPosition());
|
|
28886
28729
|
if (this.isThisParam(method[paramsKey][0])) {
|
|
28887
|
-
this.raise(TSErrors.AccesorCannotDeclareThisParameter,
|
|
28888
|
-
at: this.state.curPosition()
|
|
28889
|
-
});
|
|
28730
|
+
this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
|
|
28890
28731
|
}
|
|
28891
28732
|
}
|
|
28892
28733
|
} else if (method.kind === "set") {
|
|
28893
28734
|
if (method[paramsKey].length !== 1) {
|
|
28894
|
-
this.raise(Errors.BadSetterArity,
|
|
28895
|
-
at: this.state.curPosition()
|
|
28896
|
-
});
|
|
28735
|
+
this.raise(Errors.BadSetterArity, this.state.curPosition());
|
|
28897
28736
|
} else {
|
|
28898
28737
|
const firstParameter = method[paramsKey][0];
|
|
28899
28738
|
if (this.isThisParam(firstParameter)) {
|
|
28900
|
-
this.raise(TSErrors.AccesorCannotDeclareThisParameter,
|
|
28901
|
-
at: this.state.curPosition()
|
|
28902
|
-
});
|
|
28739
|
+
this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition());
|
|
28903
28740
|
}
|
|
28904
28741
|
if (firstParameter.type === "Identifier" && firstParameter.optional) {
|
|
28905
|
-
this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter,
|
|
28906
|
-
at: this.state.curPosition()
|
|
28907
|
-
});
|
|
28742
|
+
this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition());
|
|
28908
28743
|
}
|
|
28909
28744
|
if (firstParameter.type === "RestElement") {
|
|
28910
|
-
this.raise(TSErrors.SetAccesorCannotHaveRestParameter,
|
|
28911
|
-
at: this.state.curPosition()
|
|
28912
|
-
});
|
|
28745
|
+
this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
|
|
28913
28746
|
}
|
|
28914
28747
|
}
|
|
28915
28748
|
if (method[returnTypeKey]) {
|
|
28916
|
-
this.raise(TSErrors.SetAccesorCannotHaveReturnType,
|
|
28917
|
-
at: method[returnTypeKey]
|
|
28918
|
-
});
|
|
28749
|
+
this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
|
|
28919
28750
|
}
|
|
28920
28751
|
} else {
|
|
28921
28752
|
method.kind = "method";
|
|
@@ -29030,9 +28861,7 @@ function requireLib () {
|
|
|
29030
28861
|
type
|
|
29031
28862
|
} = elementNode;
|
|
29032
28863
|
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
|
|
29033
|
-
this.raise(TSErrors.OptionalTypeBeforeRequired,
|
|
29034
|
-
at: elementNode
|
|
29035
|
-
});
|
|
28864
|
+
this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
|
|
29036
28865
|
}
|
|
29037
28866
|
seenOptionalElement || (seenOptionalElement = type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType");
|
|
29038
28867
|
});
|
|
@@ -29085,16 +28914,12 @@ function requireLib () {
|
|
|
29085
28914
|
labeledNode.elementType = type;
|
|
29086
28915
|
if (this.eat(17)) {
|
|
29087
28916
|
labeledNode.optional = true;
|
|
29088
|
-
this.raise(TSErrors.TupleOptionalAfterType,
|
|
29089
|
-
at: this.state.lastTokStartLoc
|
|
29090
|
-
});
|
|
28917
|
+
this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
|
|
29091
28918
|
}
|
|
29092
28919
|
} else {
|
|
29093
28920
|
labeledNode = this.startNodeAtNode(type);
|
|
29094
28921
|
labeledNode.optional = optional;
|
|
29095
|
-
this.raise(TSErrors.InvalidTupleMemberLabel,
|
|
29096
|
-
at: type
|
|
29097
|
-
});
|
|
28922
|
+
this.raise(TSErrors.InvalidTupleMemberLabel, type);
|
|
29098
28923
|
labeledNode.label = type;
|
|
29099
28924
|
labeledNode.elementType = this.tsParseType();
|
|
29100
28925
|
}
|
|
@@ -29247,9 +29072,7 @@ function requireLib () {
|
|
|
29247
29072
|
case "TSArrayType":
|
|
29248
29073
|
return;
|
|
29249
29074
|
default:
|
|
29250
|
-
this.raise(TSErrors.UnexpectedReadonly,
|
|
29251
|
-
at: node
|
|
29252
|
-
});
|
|
29075
|
+
this.raise(TSErrors.UnexpectedReadonly, node);
|
|
29253
29076
|
}
|
|
29254
29077
|
}
|
|
29255
29078
|
tsParseInferType() {
|
|
@@ -29417,8 +29240,7 @@ function requireLib () {
|
|
|
29417
29240
|
return false;
|
|
29418
29241
|
}
|
|
29419
29242
|
if (containsEsc) {
|
|
29420
|
-
this.raise(Errors.InvalidEscapedReservedWord, {
|
|
29421
|
-
at: this.state.lastTokStartLoc,
|
|
29243
|
+
this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, {
|
|
29422
29244
|
reservedWord: "asserts"
|
|
29423
29245
|
});
|
|
29424
29246
|
}
|
|
@@ -29462,9 +29284,7 @@ function requireLib () {
|
|
|
29462
29284
|
}
|
|
29463
29285
|
tsParseTypeAssertion() {
|
|
29464
29286
|
if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
|
|
29465
|
-
this.raise(TSErrors.ReservedTypeAssertion,
|
|
29466
|
-
at: this.state.startLoc
|
|
29467
|
-
});
|
|
29287
|
+
this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
|
|
29468
29288
|
}
|
|
29469
29289
|
const node = this.startNode();
|
|
29470
29290
|
node.typeAnnotation = this.tsInType(() => {
|
|
@@ -29486,8 +29306,7 @@ function requireLib () {
|
|
|
29486
29306
|
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
29487
29307
|
});
|
|
29488
29308
|
if (!delimitedList.length) {
|
|
29489
|
-
this.raise(TSErrors.EmptyHeritageClauseType, {
|
|
29490
|
-
at: originalStartLoc,
|
|
29309
|
+
this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
|
29491
29310
|
token
|
|
29492
29311
|
});
|
|
29493
29312
|
}
|
|
@@ -29502,9 +29321,7 @@ function requireLib () {
|
|
|
29502
29321
|
this.checkIdentifier(node.id, 130);
|
|
29503
29322
|
} else {
|
|
29504
29323
|
node.id = null;
|
|
29505
|
-
this.raise(TSErrors.MissingInterfaceName,
|
|
29506
|
-
at: this.state.startLoc
|
|
29507
|
-
});
|
|
29324
|
+
this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
|
|
29508
29325
|
}
|
|
29509
29326
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
|
|
29510
29327
|
if (this.eat(81)) {
|
|
@@ -29656,9 +29473,7 @@ function requireLib () {
|
|
|
29656
29473
|
this.expect(29);
|
|
29657
29474
|
const moduleReference = this.tsParseModuleReference();
|
|
29658
29475
|
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
|
|
29659
|
-
this.raise(TSErrors.ImportAliasHasImportType,
|
|
29660
|
-
at: moduleReference
|
|
29661
|
-
});
|
|
29476
|
+
this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
|
|
29662
29477
|
}
|
|
29663
29478
|
node.moduleReference = moduleReference;
|
|
29664
29479
|
this.semicolon();
|
|
@@ -29844,9 +29659,7 @@ function requireLib () {
|
|
|
29844
29659
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
29845
29660
|
}));
|
|
29846
29661
|
if (node.params.length === 0) {
|
|
29847
|
-
this.raise(TSErrors.EmptyTypeArguments,
|
|
29848
|
-
at: node
|
|
29849
|
-
});
|
|
29662
|
+
this.raise(TSErrors.EmptyTypeArguments, node);
|
|
29850
29663
|
} else if (!this.state.inType && this.curContext() === types.brace) {
|
|
29851
29664
|
this.reScan_lt_gt();
|
|
29852
29665
|
}
|
|
@@ -29870,9 +29683,7 @@ function requireLib () {
|
|
|
29870
29683
|
const override = modified.override;
|
|
29871
29684
|
const readonly = modified.readonly;
|
|
29872
29685
|
if (!(flags & 4) && (accessibility || readonly || override)) {
|
|
29873
|
-
this.raise(TSErrors.UnexpectedParameterModifier,
|
|
29874
|
-
at: startLoc
|
|
29875
|
-
});
|
|
29686
|
+
this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
|
|
29876
29687
|
}
|
|
29877
29688
|
const left = this.parseMaybeDefault();
|
|
29878
29689
|
this.parseAssignableListItemTypes(left, flags);
|
|
@@ -29886,9 +29697,7 @@ function requireLib () {
|
|
|
29886
29697
|
if (readonly) pp.readonly = readonly;
|
|
29887
29698
|
if (override) pp.override = override;
|
|
29888
29699
|
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
|
|
29889
|
-
this.raise(TSErrors.UnsupportedParameterPropertyKind,
|
|
29890
|
-
at: pp
|
|
29891
|
-
});
|
|
29700
|
+
this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
|
|
29892
29701
|
}
|
|
29893
29702
|
pp.parameter = elt;
|
|
29894
29703
|
return this.finishNode(pp, "TSParameterProperty");
|
|
@@ -29904,9 +29713,7 @@ function requireLib () {
|
|
|
29904
29713
|
tsDisallowOptionalPattern(node) {
|
|
29905
29714
|
for (const param of node.params) {
|
|
29906
29715
|
if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) {
|
|
29907
|
-
this.raise(TSErrors.PatternIsOptional,
|
|
29908
|
-
at: param
|
|
29909
|
-
});
|
|
29716
|
+
this.raise(TSErrors.PatternIsOptional, param);
|
|
29910
29717
|
}
|
|
29911
29718
|
}
|
|
29912
29719
|
}
|
|
@@ -29923,9 +29730,7 @@ function requireLib () {
|
|
|
29923
29730
|
return this.finishNode(node, bodilessType);
|
|
29924
29731
|
}
|
|
29925
29732
|
if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
|
|
29926
|
-
this.raise(TSErrors.DeclareFunctionHasImplementation,
|
|
29927
|
-
at: node
|
|
29928
|
-
});
|
|
29733
|
+
this.raise(TSErrors.DeclareFunctionHasImplementation, node);
|
|
29929
29734
|
if (node.declare) {
|
|
29930
29735
|
return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
29931
29736
|
}
|
|
@@ -29943,9 +29748,7 @@ function requireLib () {
|
|
|
29943
29748
|
tsCheckForInvalidTypeCasts(items) {
|
|
29944
29749
|
items.forEach(node => {
|
|
29945
29750
|
if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
|
|
29946
|
-
this.raise(TSErrors.UnexpectedTypeAnnotation,
|
|
29947
|
-
at: node.typeAnnotation
|
|
29948
|
-
});
|
|
29751
|
+
this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
|
|
29949
29752
|
}
|
|
29950
29753
|
});
|
|
29951
29754
|
}
|
|
@@ -30022,9 +29825,7 @@ function requireLib () {
|
|
|
30022
29825
|
}
|
|
30023
29826
|
if (result) {
|
|
30024
29827
|
if (result.type === "TSInstantiationExpression" && (this.match(16) || this.match(18) && this.lookaheadCharCode() !== 40)) {
|
|
30025
|
-
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression,
|
|
30026
|
-
at: this.state.startLoc
|
|
30027
|
-
});
|
|
29828
|
+
this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
|
|
30028
29829
|
}
|
|
30029
29830
|
return result;
|
|
30030
29831
|
}
|
|
@@ -30051,8 +29852,7 @@ function requireLib () {
|
|
|
30051
29852
|
this.next();
|
|
30052
29853
|
if (this.match(75)) {
|
|
30053
29854
|
if (isSatisfies) {
|
|
30054
|
-
this.raise(Errors.UnexpectedKeyword, {
|
|
30055
|
-
at: this.state.startLoc,
|
|
29855
|
+
this.raise(Errors.UnexpectedKeyword, this.state.startLoc, {
|
|
30056
29856
|
keyword: "const"
|
|
30057
29857
|
});
|
|
30058
29858
|
}
|
|
@@ -30074,9 +29874,7 @@ function requireLib () {
|
|
|
30074
29874
|
checkImportReflection(node) {
|
|
30075
29875
|
super.checkImportReflection(node);
|
|
30076
29876
|
if (node.module && node.importKind !== "value") {
|
|
30077
|
-
this.raise(TSErrors.ImportReflectionHasImportType,
|
|
30078
|
-
at: node.specifiers[0].loc.start
|
|
30079
|
-
});
|
|
29877
|
+
this.raise(TSErrors.ImportReflectionHasImportType, node.specifiers[0].loc.start);
|
|
30080
29878
|
}
|
|
30081
29879
|
}
|
|
30082
29880
|
checkDuplicateExports() {}
|
|
@@ -30116,9 +29914,7 @@ function requireLib () {
|
|
|
30116
29914
|
importNode = super.parseImport(node);
|
|
30117
29915
|
}
|
|
30118
29916
|
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
30119
|
-
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed,
|
|
30120
|
-
at: importNode
|
|
30121
|
-
});
|
|
29917
|
+
this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
|
|
30122
29918
|
}
|
|
30123
29919
|
return importNode;
|
|
30124
29920
|
}
|
|
@@ -30176,13 +29972,9 @@ function requireLib () {
|
|
|
30176
29972
|
} of declaration.declarations) {
|
|
30177
29973
|
if (!init) continue;
|
|
30178
29974
|
if (kind !== "const" || !!id.typeAnnotation) {
|
|
30179
|
-
this.raise(TSErrors.InitializerNotAllowedInAmbientContext,
|
|
30180
|
-
at: init
|
|
30181
|
-
});
|
|
29975
|
+
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
|
|
30182
29976
|
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
30183
|
-
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference,
|
|
30184
|
-
at: init
|
|
30185
|
-
});
|
|
29977
|
+
this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
|
|
30186
29978
|
}
|
|
30187
29979
|
}
|
|
30188
29980
|
return declaration;
|
|
@@ -30231,9 +30023,7 @@ function requireLib () {
|
|
|
30231
30023
|
this.next();
|
|
30232
30024
|
this.next();
|
|
30233
30025
|
if (this.tsHasSomeModifiers(member, modifiers)) {
|
|
30234
|
-
this.raise(TSErrors.StaticBlockCannotHaveModifier,
|
|
30235
|
-
at: this.state.curPosition()
|
|
30236
|
-
});
|
|
30026
|
+
this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
|
|
30237
30027
|
}
|
|
30238
30028
|
super.parseClassStaticBlock(classBody, member);
|
|
30239
30029
|
} else {
|
|
@@ -30251,38 +30041,27 @@ function requireLib () {
|
|
|
30251
30041
|
if (idx) {
|
|
30252
30042
|
classBody.body.push(idx);
|
|
30253
30043
|
if (member.abstract) {
|
|
30254
|
-
this.raise(TSErrors.IndexSignatureHasAbstract,
|
|
30255
|
-
at: member
|
|
30256
|
-
});
|
|
30044
|
+
this.raise(TSErrors.IndexSignatureHasAbstract, member);
|
|
30257
30045
|
}
|
|
30258
30046
|
if (member.accessibility) {
|
|
30259
|
-
this.raise(TSErrors.IndexSignatureHasAccessibility, {
|
|
30260
|
-
at: member,
|
|
30047
|
+
this.raise(TSErrors.IndexSignatureHasAccessibility, member, {
|
|
30261
30048
|
modifier: member.accessibility
|
|
30262
30049
|
});
|
|
30263
30050
|
}
|
|
30264
30051
|
if (member.declare) {
|
|
30265
|
-
this.raise(TSErrors.IndexSignatureHasDeclare,
|
|
30266
|
-
at: member
|
|
30267
|
-
});
|
|
30052
|
+
this.raise(TSErrors.IndexSignatureHasDeclare, member);
|
|
30268
30053
|
}
|
|
30269
30054
|
if (member.override) {
|
|
30270
|
-
this.raise(TSErrors.IndexSignatureHasOverride,
|
|
30271
|
-
at: member
|
|
30272
|
-
});
|
|
30055
|
+
this.raise(TSErrors.IndexSignatureHasOverride, member);
|
|
30273
30056
|
}
|
|
30274
30057
|
return;
|
|
30275
30058
|
}
|
|
30276
30059
|
if (!this.state.inAbstractClass && member.abstract) {
|
|
30277
|
-
this.raise(TSErrors.NonAbstractClassHasAbstractMethod,
|
|
30278
|
-
at: member
|
|
30279
|
-
});
|
|
30060
|
+
this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
|
|
30280
30061
|
}
|
|
30281
30062
|
if (member.override) {
|
|
30282
30063
|
if (!state.hadSuperClass) {
|
|
30283
|
-
this.raise(TSErrors.OverrideNotInSubClass,
|
|
30284
|
-
at: member
|
|
30285
|
-
});
|
|
30064
|
+
this.raise(TSErrors.OverrideNotInSubClass, member);
|
|
30286
30065
|
}
|
|
30287
30066
|
}
|
|
30288
30067
|
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
@@ -30291,14 +30070,10 @@ function requireLib () {
|
|
|
30291
30070
|
const optional = this.eat(17);
|
|
30292
30071
|
if (optional) methodOrProp.optional = true;
|
|
30293
30072
|
if (methodOrProp.readonly && this.match(10)) {
|
|
30294
|
-
this.raise(TSErrors.ClassMethodHasReadonly,
|
|
30295
|
-
at: methodOrProp
|
|
30296
|
-
});
|
|
30073
|
+
this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
|
|
30297
30074
|
}
|
|
30298
30075
|
if (methodOrProp.declare && this.match(10)) {
|
|
30299
|
-
this.raise(TSErrors.ClassMethodHasDeclare,
|
|
30300
|
-
at: methodOrProp
|
|
30301
|
-
});
|
|
30076
|
+
this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
|
|
30302
30077
|
}
|
|
30303
30078
|
}
|
|
30304
30079
|
parseExpressionStatement(node, expr, decorators) {
|
|
@@ -30344,9 +30119,7 @@ function requireLib () {
|
|
|
30344
30119
|
const startLoc = this.state.startLoc;
|
|
30345
30120
|
const isDeclare = this.eatContextual(125);
|
|
30346
30121
|
if (isDeclare && (this.isContextual(125) || !this.shouldParseExportDeclaration())) {
|
|
30347
|
-
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare,
|
|
30348
|
-
at: this.state.startLoc
|
|
30349
|
-
});
|
|
30122
|
+
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
30350
30123
|
}
|
|
30351
30124
|
const isIdentifier = tokenIsIdentifier(this.state.type);
|
|
30352
30125
|
const declaration = isIdentifier && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
@@ -30382,16 +30155,13 @@ function requireLib () {
|
|
|
30382
30155
|
parseClassProperty(node) {
|
|
30383
30156
|
this.parseClassPropertyAnnotation(node);
|
|
30384
30157
|
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(29)) {
|
|
30385
|
-
this.raise(TSErrors.DeclareClassFieldHasInitializer,
|
|
30386
|
-
at: this.state.startLoc
|
|
30387
|
-
});
|
|
30158
|
+
this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
|
|
30388
30159
|
}
|
|
30389
30160
|
if (node.abstract && this.match(29)) {
|
|
30390
30161
|
const {
|
|
30391
30162
|
key
|
|
30392
30163
|
} = node;
|
|
30393
|
-
this.raise(TSErrors.AbstractPropertyHasInitializer, {
|
|
30394
|
-
at: this.state.startLoc,
|
|
30164
|
+
this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
|
|
30395
30165
|
propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
|
|
30396
30166
|
});
|
|
30397
30167
|
}
|
|
@@ -30399,13 +30169,10 @@ function requireLib () {
|
|
|
30399
30169
|
}
|
|
30400
30170
|
parseClassPrivateProperty(node) {
|
|
30401
30171
|
if (node.abstract) {
|
|
30402
|
-
this.raise(TSErrors.PrivateElementHasAbstract,
|
|
30403
|
-
at: node
|
|
30404
|
-
});
|
|
30172
|
+
this.raise(TSErrors.PrivateElementHasAbstract, node);
|
|
30405
30173
|
}
|
|
30406
30174
|
if (node.accessibility) {
|
|
30407
|
-
this.raise(TSErrors.PrivateElementHasAccessibility, {
|
|
30408
|
-
at: node,
|
|
30175
|
+
this.raise(TSErrors.PrivateElementHasAccessibility, node, {
|
|
30409
30176
|
modifier: node.accessibility
|
|
30410
30177
|
});
|
|
30411
30178
|
}
|
|
@@ -30415,26 +30182,21 @@ function requireLib () {
|
|
|
30415
30182
|
parseClassAccessorProperty(node) {
|
|
30416
30183
|
this.parseClassPropertyAnnotation(node);
|
|
30417
30184
|
if (node.optional) {
|
|
30418
|
-
this.raise(TSErrors.AccessorCannotBeOptional,
|
|
30419
|
-
at: node
|
|
30420
|
-
});
|
|
30185
|
+
this.raise(TSErrors.AccessorCannotBeOptional, node);
|
|
30421
30186
|
}
|
|
30422
30187
|
return super.parseClassAccessorProperty(node);
|
|
30423
30188
|
}
|
|
30424
30189
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
30425
30190
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
30426
30191
|
if (typeParameters && isConstructor) {
|
|
30427
|
-
this.raise(TSErrors.ConstructorHasTypeParameters,
|
|
30428
|
-
at: typeParameters
|
|
30429
|
-
});
|
|
30192
|
+
this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
|
|
30430
30193
|
}
|
|
30431
30194
|
const {
|
|
30432
30195
|
declare = false,
|
|
30433
30196
|
kind
|
|
30434
30197
|
} = method;
|
|
30435
30198
|
if (declare && (kind === "get" || kind === "set")) {
|
|
30436
|
-
this.raise(TSErrors.DeclareAccessor, {
|
|
30437
|
-
at: method,
|
|
30199
|
+
this.raise(TSErrors.DeclareAccessor, method, {
|
|
30438
30200
|
kind
|
|
30439
30201
|
});
|
|
30440
30202
|
}
|
|
@@ -30549,9 +30311,7 @@ function requireLib () {
|
|
|
30549
30311
|
reportReservedArrowTypeParam(node) {
|
|
30550
30312
|
var _node$extra;
|
|
30551
30313
|
if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
|
|
30552
|
-
this.raise(TSErrors.ReservedArrowTypeParam,
|
|
30553
|
-
at: node
|
|
30554
|
-
});
|
|
30314
|
+
this.raise(TSErrors.ReservedArrowTypeParam, node);
|
|
30555
30315
|
}
|
|
30556
30316
|
}
|
|
30557
30317
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
@@ -30605,13 +30365,9 @@ function requireLib () {
|
|
|
30605
30365
|
case "TSNonNullExpression":
|
|
30606
30366
|
case "TSTypeAssertion":
|
|
30607
30367
|
if (isLHS) {
|
|
30608
|
-
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter,
|
|
30609
|
-
at: node
|
|
30610
|
-
});
|
|
30368
|
+
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
30611
30369
|
} else {
|
|
30612
|
-
this.raise(TSErrors.UnexpectedTypeCastInParameter,
|
|
30613
|
-
at: node
|
|
30614
|
-
});
|
|
30370
|
+
this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
30615
30371
|
}
|
|
30616
30372
|
this.toAssignable(node.expression, isLHS);
|
|
30617
30373
|
break;
|
|
@@ -30692,9 +30448,7 @@ function requireLib () {
|
|
|
30692
30448
|
parseMaybeDefault(startLoc, left) {
|
|
30693
30449
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
30694
30450
|
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
|
|
30695
|
-
this.raise(TSErrors.TypeAnnotationAfterAssign,
|
|
30696
|
-
at: node.typeAnnotation
|
|
30697
|
-
});
|
|
30451
|
+
this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
|
|
30698
30452
|
}
|
|
30699
30453
|
return node;
|
|
30700
30454
|
}
|
|
@@ -30808,9 +30562,7 @@ function requireLib () {
|
|
|
30808
30562
|
} else if (this.isContextual(129)) {
|
|
30809
30563
|
if (!this.hasFollowingLineBreak()) {
|
|
30810
30564
|
node.abstract = true;
|
|
30811
|
-
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer,
|
|
30812
|
-
at: node
|
|
30813
|
-
});
|
|
30565
|
+
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node);
|
|
30814
30566
|
return this.tsParseInterfaceDeclaration(node);
|
|
30815
30567
|
}
|
|
30816
30568
|
} else {
|
|
@@ -30825,8 +30577,7 @@ function requireLib () {
|
|
|
30825
30577
|
const {
|
|
30826
30578
|
key
|
|
30827
30579
|
} = method;
|
|
30828
|
-
this.raise(TSErrors.AbstractMethodHasImplementation, {
|
|
30829
|
-
at: method,
|
|
30580
|
+
this.raise(TSErrors.AbstractMethodHasImplementation, method, {
|
|
30830
30581
|
methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
|
|
30831
30582
|
});
|
|
30832
30583
|
}
|
|
@@ -30908,9 +30659,7 @@ function requireLib () {
|
|
|
30908
30659
|
}
|
|
30909
30660
|
}
|
|
30910
30661
|
if (hasTypeSpecifier && isInTypeOnlyImportExport) {
|
|
30911
|
-
this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports,
|
|
30912
|
-
at: loc
|
|
30913
|
-
});
|
|
30662
|
+
this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
|
|
30914
30663
|
}
|
|
30915
30664
|
node[leftOfAsKey] = leftOfAs;
|
|
30916
30665
|
node[rightOfAsKey] = rightOfAs;
|
|
@@ -31097,9 +30846,7 @@ function requireLib () {
|
|
|
31097
30846
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
31098
30847
|
return this.finishNode(node, type);
|
|
31099
30848
|
} else {
|
|
31100
|
-
throw this.raise(PlaceholderErrors.ClassNameIsRequired,
|
|
31101
|
-
at: this.state.startLoc
|
|
31102
|
-
});
|
|
30849
|
+
throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
|
|
31103
30850
|
}
|
|
31104
30851
|
} else {
|
|
31105
30852
|
this.parseClassId(node, isStatement, optionalId);
|
|
@@ -31177,9 +30924,7 @@ function requireLib () {
|
|
|
31177
30924
|
}
|
|
31178
30925
|
assertNoSpace() {
|
|
31179
30926
|
if (this.state.start > this.state.lastTokEndLoc.index) {
|
|
31180
|
-
this.raise(PlaceholderErrors.UnexpectedSpace,
|
|
31181
|
-
at: this.state.lastTokEndLoc
|
|
31182
|
-
});
|
|
30927
|
+
this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
|
|
31183
30928
|
}
|
|
31184
30929
|
}
|
|
31185
30930
|
};
|
|
@@ -31368,9 +31113,7 @@ function requireLib () {
|
|
|
31368
31113
|
const name = key.type === "Identifier" ? key.name : key.value;
|
|
31369
31114
|
if (name === "__proto__") {
|
|
31370
31115
|
if (isRecord) {
|
|
31371
|
-
this.raise(Errors.RecordNoProto,
|
|
31372
|
-
at: key
|
|
31373
|
-
});
|
|
31116
|
+
this.raise(Errors.RecordNoProto, key);
|
|
31374
31117
|
return;
|
|
31375
31118
|
}
|
|
31376
31119
|
if (protoRef.used) {
|
|
@@ -31379,9 +31122,7 @@ function requireLib () {
|
|
|
31379
31122
|
refExpressionErrors.doubleProtoLoc = key.loc.start;
|
|
31380
31123
|
}
|
|
31381
31124
|
} else {
|
|
31382
|
-
this.raise(Errors.DuplicateProto,
|
|
31383
|
-
at: key
|
|
31384
|
-
});
|
|
31125
|
+
this.raise(Errors.DuplicateProto, key);
|
|
31385
31126
|
}
|
|
31386
31127
|
}
|
|
31387
31128
|
protoRef.used = true;
|
|
@@ -31398,7 +31139,7 @@ function requireLib () {
|
|
|
31398
31139
|
this.unexpected();
|
|
31399
31140
|
}
|
|
31400
31141
|
this.finalizeRemainingComments();
|
|
31401
|
-
expr.comments = this.
|
|
31142
|
+
expr.comments = this.comments;
|
|
31402
31143
|
expr.errors = this.state.errors;
|
|
31403
31144
|
if (this.options.tokens) {
|
|
31404
31145
|
expr.tokens = this.tokens;
|
|
@@ -31531,8 +31272,7 @@ function requireLib () {
|
|
|
31531
31272
|
if (this.isPrivateName(left)) {
|
|
31532
31273
|
const value = this.getPrivateNameSV(left);
|
|
31533
31274
|
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
|
|
31534
|
-
this.raise(Errors.PrivateInExpectedIn, {
|
|
31535
|
-
at: left,
|
|
31275
|
+
this.raise(Errors.PrivateInExpectedIn, left, {
|
|
31536
31276
|
identifierName: value
|
|
31537
31277
|
});
|
|
31538
31278
|
}
|
|
@@ -31562,18 +31302,14 @@ function requireLib () {
|
|
|
31562
31302
|
proposal: "minimal"
|
|
31563
31303
|
}])) {
|
|
31564
31304
|
if (this.state.type === 96 && this.prodParam.hasAwait) {
|
|
31565
|
-
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody,
|
|
31566
|
-
at: this.state.startLoc
|
|
31567
|
-
});
|
|
31305
|
+
throw this.raise(Errors.UnexpectedAwaitAfterPipelineBody, this.state.startLoc);
|
|
31568
31306
|
}
|
|
31569
31307
|
}
|
|
31570
31308
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
31571
31309
|
const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
31572
31310
|
const nextOp = this.state.type;
|
|
31573
31311
|
if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
|
|
31574
|
-
throw this.raise(Errors.MixingCoalesceWithLogical,
|
|
31575
|
-
at: this.state.startLoc
|
|
31576
|
-
});
|
|
31312
|
+
throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
|
|
31577
31313
|
}
|
|
31578
31314
|
return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
|
|
31579
31315
|
}
|
|
@@ -31592,9 +31328,7 @@ function requireLib () {
|
|
|
31592
31328
|
case "smart":
|
|
31593
31329
|
return this.withTopicBindingContext(() => {
|
|
31594
31330
|
if (this.prodParam.hasYield && this.isContextual(108)) {
|
|
31595
|
-
throw this.raise(Errors.PipeBodyIsTighter,
|
|
31596
|
-
at: this.state.startLoc
|
|
31597
|
-
});
|
|
31331
|
+
throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
|
|
31598
31332
|
}
|
|
31599
31333
|
return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
|
|
31600
31334
|
});
|
|
@@ -31619,23 +31353,18 @@ function requireLib () {
|
|
|
31619
31353
|
const body = this.parseMaybeAssign();
|
|
31620
31354
|
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
31621
31355
|
if (requiredParentheses && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
|
|
31622
|
-
this.raise(Errors.PipeUnparenthesizedBody, {
|
|
31623
|
-
at: startLoc,
|
|
31356
|
+
this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
|
|
31624
31357
|
type: body.type
|
|
31625
31358
|
});
|
|
31626
31359
|
}
|
|
31627
31360
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
31628
|
-
this.raise(Errors.PipeTopicUnused,
|
|
31629
|
-
at: startLoc
|
|
31630
|
-
});
|
|
31361
|
+
this.raise(Errors.PipeTopicUnused, startLoc);
|
|
31631
31362
|
}
|
|
31632
31363
|
return body;
|
|
31633
31364
|
}
|
|
31634
31365
|
checkExponentialAfterUnary(node) {
|
|
31635
31366
|
if (this.match(57)) {
|
|
31636
|
-
this.raise(Errors.UnexpectedTokenUnaryExponentiation,
|
|
31637
|
-
at: node.argument
|
|
31638
|
-
});
|
|
31367
|
+
this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
|
|
31639
31368
|
}
|
|
31640
31369
|
}
|
|
31641
31370
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
@@ -31662,13 +31391,9 @@ function requireLib () {
|
|
|
31662
31391
|
if (this.state.strict && isDelete) {
|
|
31663
31392
|
const arg = node.argument;
|
|
31664
31393
|
if (arg.type === "Identifier") {
|
|
31665
|
-
this.raise(Errors.StrictDelete,
|
|
31666
|
-
at: node
|
|
31667
|
-
});
|
|
31394
|
+
this.raise(Errors.StrictDelete, node);
|
|
31668
31395
|
} else if (this.hasPropertyAsPrivateName(arg)) {
|
|
31669
|
-
this.raise(Errors.DeletePrivateField,
|
|
31670
|
-
at: node
|
|
31671
|
-
});
|
|
31396
|
+
this.raise(Errors.DeletePrivateField, node);
|
|
31672
31397
|
}
|
|
31673
31398
|
}
|
|
31674
31399
|
if (!update) {
|
|
@@ -31685,9 +31410,7 @@ function requireLib () {
|
|
|
31685
31410
|
} = this.state;
|
|
31686
31411
|
const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
|
|
31687
31412
|
if (startsExpr && !this.isAmbiguousAwait()) {
|
|
31688
|
-
this.raiseOverwrite(Errors.AwaitNotInAsyncContext,
|
|
31689
|
-
at: startLoc
|
|
31690
|
-
});
|
|
31413
|
+
this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
|
|
31691
31414
|
return this.parseAwait(startLoc);
|
|
31692
31415
|
}
|
|
31693
31416
|
}
|
|
@@ -31749,9 +31472,7 @@ function requireLib () {
|
|
|
31749
31472
|
let optional = false;
|
|
31750
31473
|
if (type === 18) {
|
|
31751
31474
|
if (noCalls) {
|
|
31752
|
-
this.raise(Errors.OptionalChainingNoNew,
|
|
31753
|
-
at: this.state.startLoc
|
|
31754
|
-
});
|
|
31475
|
+
this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
|
|
31755
31476
|
if (this.lookaheadCharCode() === 40) {
|
|
31756
31477
|
state.stop = true;
|
|
31757
31478
|
return base;
|
|
@@ -31781,9 +31502,7 @@ function requireLib () {
|
|
|
31781
31502
|
this.expect(3);
|
|
31782
31503
|
} else if (this.match(138)) {
|
|
31783
31504
|
if (base.type === "Super") {
|
|
31784
|
-
this.raise(Errors.SuperPrivateField,
|
|
31785
|
-
at: startLoc
|
|
31786
|
-
});
|
|
31505
|
+
this.raise(Errors.SuperPrivateField, startLoc);
|
|
31787
31506
|
}
|
|
31788
31507
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
31789
31508
|
node.property = this.parsePrivateName();
|
|
@@ -31853,9 +31572,7 @@ function requireLib () {
|
|
|
31853
31572
|
node.tag = base;
|
|
31854
31573
|
node.quasi = this.parseTemplate(true);
|
|
31855
31574
|
if (state.optionalChainMember) {
|
|
31856
|
-
this.raise(Errors.OptionalChainingNoTemplate,
|
|
31857
|
-
at: startLoc
|
|
31858
|
-
});
|
|
31575
|
+
this.raise(Errors.OptionalChainingNoTemplate, startLoc);
|
|
31859
31576
|
}
|
|
31860
31577
|
return this.finishNode(node, "TaggedTemplateExpression");
|
|
31861
31578
|
}
|
|
@@ -31877,16 +31594,13 @@ function requireLib () {
|
|
|
31877
31594
|
}
|
|
31878
31595
|
}
|
|
31879
31596
|
if (node.arguments.length === 0 || node.arguments.length > 2) {
|
|
31880
|
-
this.raise(Errors.ImportCallArity, {
|
|
31881
|
-
at: node,
|
|
31597
|
+
this.raise(Errors.ImportCallArity, node, {
|
|
31882
31598
|
maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
|
|
31883
31599
|
});
|
|
31884
31600
|
} else {
|
|
31885
31601
|
for (const arg of node.arguments) {
|
|
31886
31602
|
if (arg.type === "SpreadElement") {
|
|
31887
|
-
this.raise(Errors.ImportCallSpreadArgument,
|
|
31888
|
-
at: arg
|
|
31889
|
-
});
|
|
31603
|
+
this.raise(Errors.ImportCallSpreadArgument, arg);
|
|
31890
31604
|
}
|
|
31891
31605
|
}
|
|
31892
31606
|
}
|
|
@@ -31905,9 +31619,7 @@ function requireLib () {
|
|
|
31905
31619
|
this.expect(12);
|
|
31906
31620
|
if (this.match(close)) {
|
|
31907
31621
|
if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
|
|
31908
|
-
this.raise(Errors.ImportCallArgumentTrailingComma,
|
|
31909
|
-
at: this.state.lastTokStartLoc
|
|
31910
|
-
});
|
|
31622
|
+
this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
|
|
31911
31623
|
}
|
|
31912
31624
|
if (nodeForExtra) {
|
|
31913
31625
|
this.addTrailingCommaExtraToNode(nodeForExtra);
|
|
@@ -31963,9 +31675,7 @@ function requireLib () {
|
|
|
31963
31675
|
return this.finishNode(node, "Import");
|
|
31964
31676
|
}
|
|
31965
31677
|
} else {
|
|
31966
|
-
this.raise(Errors.UnsupportedImport,
|
|
31967
|
-
at: this.state.lastTokStartLoc
|
|
31968
|
-
});
|
|
31678
|
+
this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
|
|
31969
31679
|
return this.finishNode(node, "Import");
|
|
31970
31680
|
}
|
|
31971
31681
|
case 78:
|
|
@@ -32039,15 +31749,12 @@ function requireLib () {
|
|
|
32039
31749
|
if (callee.type === "MemberExpression") {
|
|
32040
31750
|
return this.finishNode(node, "BindExpression");
|
|
32041
31751
|
} else {
|
|
32042
|
-
throw this.raise(Errors.UnsupportedBind,
|
|
32043
|
-
at: callee
|
|
32044
|
-
});
|
|
31752
|
+
throw this.raise(Errors.UnsupportedBind, callee);
|
|
32045
31753
|
}
|
|
32046
31754
|
}
|
|
32047
31755
|
case 138:
|
|
32048
31756
|
{
|
|
32049
|
-
this.raise(Errors.PrivateInExpectedIn, {
|
|
32050
|
-
at: this.state.startLoc,
|
|
31757
|
+
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
|
|
32051
31758
|
identifierName: this.state.value
|
|
32052
31759
|
});
|
|
32053
31760
|
return this.parsePrivateName();
|
|
@@ -32147,15 +31854,12 @@ function requireLib () {
|
|
|
32147
31854
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
32148
31855
|
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
|
|
32149
31856
|
if (!this.topicReferenceIsAllowedInCurrentContext()) {
|
|
32150
|
-
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound,
|
|
32151
|
-
at: startLoc
|
|
32152
|
-
});
|
|
31857
|
+
this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
|
|
32153
31858
|
}
|
|
32154
31859
|
this.registerTopicReference();
|
|
32155
31860
|
return this.finishNode(node, nodeType);
|
|
32156
31861
|
} else {
|
|
32157
|
-
throw this.raise(Errors.PipeTopicUnconfiguredToken, {
|
|
32158
|
-
at: startLoc,
|
|
31862
|
+
throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
|
|
32159
31863
|
token: tokenLabelName(tokenType)
|
|
32160
31864
|
});
|
|
32161
31865
|
}
|
|
@@ -32171,9 +31875,7 @@ function requireLib () {
|
|
|
32171
31875
|
case "smart":
|
|
32172
31876
|
return tokenType === 27;
|
|
32173
31877
|
default:
|
|
32174
|
-
throw this.raise(Errors.PipeTopicRequiresHackPipes,
|
|
32175
|
-
at: startLoc
|
|
32176
|
-
});
|
|
31878
|
+
throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
|
|
32177
31879
|
}
|
|
32178
31880
|
}
|
|
32179
31881
|
parseAsyncArrowUnaryFunction(node) {
|
|
@@ -32181,9 +31883,7 @@ function requireLib () {
|
|
|
32181
31883
|
const params = [this.parseIdentifier()];
|
|
32182
31884
|
this.prodParam.exit();
|
|
32183
31885
|
if (this.hasPrecedingLineBreak()) {
|
|
32184
|
-
this.raise(Errors.LineTerminatorBeforeArrow,
|
|
32185
|
-
at: this.state.curPosition()
|
|
32186
|
-
});
|
|
31886
|
+
this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
|
|
32187
31887
|
}
|
|
32188
31888
|
this.expect(19);
|
|
32189
31889
|
return this.parseArrowExpression(node, params, true);
|
|
@@ -32211,18 +31911,12 @@ function requireLib () {
|
|
|
32211
31911
|
const node = this.startNode();
|
|
32212
31912
|
this.next();
|
|
32213
31913
|
if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
|
|
32214
|
-
this.raise(Errors.SuperNotAllowed,
|
|
32215
|
-
at: node
|
|
32216
|
-
});
|
|
31914
|
+
this.raise(Errors.SuperNotAllowed, node);
|
|
32217
31915
|
} else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
|
|
32218
|
-
this.raise(Errors.UnexpectedSuper,
|
|
32219
|
-
at: node
|
|
32220
|
-
});
|
|
31916
|
+
this.raise(Errors.UnexpectedSuper, node);
|
|
32221
31917
|
}
|
|
32222
31918
|
if (!this.match(10) && !this.match(0) && !this.match(16)) {
|
|
32223
|
-
this.raise(Errors.UnsupportedSuper,
|
|
32224
|
-
at: node
|
|
32225
|
-
});
|
|
31919
|
+
this.raise(Errors.UnsupportedSuper, node);
|
|
32226
31920
|
}
|
|
32227
31921
|
return this.finishNode(node, "Super");
|
|
32228
31922
|
}
|
|
@@ -32254,8 +31948,7 @@ function requireLib () {
|
|
|
32254
31948
|
const containsEsc = this.state.containsEsc;
|
|
32255
31949
|
node.property = this.parseIdentifier(true);
|
|
32256
31950
|
if (node.property.name !== propertyName || containsEsc) {
|
|
32257
|
-
this.raise(Errors.UnsupportedMetaProperty, {
|
|
32258
|
-
at: node.property,
|
|
31951
|
+
this.raise(Errors.UnsupportedMetaProperty, node.property, {
|
|
32259
31952
|
target: meta.name,
|
|
32260
31953
|
onlyValidPropertyName: propertyName
|
|
32261
31954
|
});
|
|
@@ -32267,9 +31960,7 @@ function requireLib () {
|
|
|
32267
31960
|
this.next();
|
|
32268
31961
|
if (this.isContextual(101)) {
|
|
32269
31962
|
if (!this.inModule) {
|
|
32270
|
-
this.raise(Errors.ImportMetaOutsideModule,
|
|
32271
|
-
at: id
|
|
32272
|
-
});
|
|
31963
|
+
this.raise(Errors.ImportMetaOutsideModule, id);
|
|
32273
31964
|
}
|
|
32274
31965
|
this.sawUnambiguousESM = true;
|
|
32275
31966
|
} else if (this.isContextual(105) || this.isContextual(97)) {
|
|
@@ -32277,8 +31968,7 @@ function requireLib () {
|
|
|
32277
31968
|
if (!isSource) this.unexpected();
|
|
32278
31969
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
32279
31970
|
if (!this.options.createImportExpressions) {
|
|
32280
|
-
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, {
|
|
32281
|
-
at: this.state.startLoc,
|
|
31971
|
+
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
|
|
32282
31972
|
phase: this.state.value
|
|
32283
31973
|
});
|
|
32284
31974
|
}
|
|
@@ -32424,9 +32114,7 @@ function requireLib () {
|
|
|
32424
32114
|
this.next();
|
|
32425
32115
|
const metaProp = this.parseMetaProperty(node, meta, "target");
|
|
32426
32116
|
if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
|
|
32427
|
-
this.raise(Errors.UnexpectedNewTarget,
|
|
32428
|
-
at: metaProp
|
|
32429
|
-
});
|
|
32117
|
+
this.raise(Errors.UnexpectedNewTarget, metaProp);
|
|
32430
32118
|
}
|
|
32431
32119
|
return metaProp;
|
|
32432
32120
|
}
|
|
@@ -32448,9 +32136,7 @@ function requireLib () {
|
|
|
32448
32136
|
const callee = this.parseNoCallExpr();
|
|
32449
32137
|
node.callee = callee;
|
|
32450
32138
|
if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) {
|
|
32451
|
-
this.raise(Errors.ImportCallNotNewExpression,
|
|
32452
|
-
at: callee
|
|
32453
|
-
});
|
|
32139
|
+
this.raise(Errors.ImportCallNotNewExpression, callee);
|
|
32454
32140
|
}
|
|
32455
32141
|
}
|
|
32456
32142
|
parseTemplateElement(isTagged) {
|
|
@@ -32464,9 +32150,7 @@ function requireLib () {
|
|
|
32464
32150
|
const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
|
|
32465
32151
|
if (value === null) {
|
|
32466
32152
|
if (!isTagged) {
|
|
32467
|
-
this.raise(Errors.InvalidEscapeSequenceTemplate,
|
|
32468
|
-
at: createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1)
|
|
32469
|
-
});
|
|
32153
|
+
this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
|
|
32470
32154
|
}
|
|
32471
32155
|
}
|
|
32472
32156
|
const isTail = this.match(24);
|
|
@@ -32526,9 +32210,7 @@ function requireLib () {
|
|
|
32526
32210
|
this.checkProto(prop, isRecord, propHash, refExpressionErrors);
|
|
32527
32211
|
}
|
|
32528
32212
|
if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
|
|
32529
|
-
this.raise(Errors.InvalidRecordProperty,
|
|
32530
|
-
at: prop
|
|
32531
|
-
});
|
|
32213
|
+
this.raise(Errors.InvalidRecordProperty, prop);
|
|
32532
32214
|
}
|
|
32533
32215
|
if (prop.shorthand) {
|
|
32534
32216
|
this.addExtra(prop, "shorthand", true);
|
|
@@ -32546,7 +32228,7 @@ function requireLib () {
|
|
|
32546
32228
|
return this.finishNode(node, type);
|
|
32547
32229
|
}
|
|
32548
32230
|
addTrailingCommaExtraToNode(node) {
|
|
32549
|
-
this.addExtra(node, "trailingComma", this.state.
|
|
32231
|
+
this.addExtra(node, "trailingComma", this.state.lastTokStartLoc.index);
|
|
32550
32232
|
this.addExtra(node, "trailingCommaLoc", this.state.lastTokStartLoc, false);
|
|
32551
32233
|
}
|
|
32552
32234
|
maybeAsyncOrAccessorProp(prop) {
|
|
@@ -32556,9 +32238,7 @@ function requireLib () {
|
|
|
32556
32238
|
let decorators = [];
|
|
32557
32239
|
if (this.match(26)) {
|
|
32558
32240
|
if (this.hasPlugin("decorators")) {
|
|
32559
|
-
this.raise(Errors.UnsupportedPropertyDecorator,
|
|
32560
|
-
at: this.state.startLoc
|
|
32561
|
-
});
|
|
32241
|
+
this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
|
|
32562
32242
|
}
|
|
32563
32243
|
while (this.match(26)) {
|
|
32564
32244
|
decorators.push(this.parseDecorator());
|
|
@@ -32598,8 +32278,7 @@ function requireLib () {
|
|
|
32598
32278
|
prop.kind = keyName;
|
|
32599
32279
|
if (this.match(55)) {
|
|
32600
32280
|
isGenerator = true;
|
|
32601
|
-
this.raise(Errors.AccessorIsGenerator, {
|
|
32602
|
-
at: this.state.curPosition(),
|
|
32281
|
+
this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), {
|
|
32603
32282
|
kind: keyName
|
|
32604
32283
|
});
|
|
32605
32284
|
this.next();
|
|
@@ -32620,14 +32299,10 @@ function requireLib () {
|
|
|
32620
32299
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
32621
32300
|
const params = this.getObjectOrClassMethodParams(method);
|
|
32622
32301
|
if (params.length !== paramCount) {
|
|
32623
|
-
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity,
|
|
32624
|
-
at: method
|
|
32625
|
-
});
|
|
32302
|
+
this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
|
|
32626
32303
|
}
|
|
32627
32304
|
if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
|
|
32628
|
-
this.raise(Errors.BadSetterRestParameter,
|
|
32629
|
-
at: method
|
|
32630
|
-
});
|
|
32305
|
+
this.raise(Errors.BadSetterRestParameter, method);
|
|
32631
32306
|
}
|
|
32632
32307
|
}
|
|
32633
32308
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
@@ -32660,9 +32335,7 @@ function requireLib () {
|
|
|
32660
32335
|
refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
|
|
32661
32336
|
}
|
|
32662
32337
|
} else {
|
|
32663
|
-
this.raise(Errors.InvalidCoverInitializedName,
|
|
32664
|
-
at: shorthandAssignLoc
|
|
32665
|
-
});
|
|
32338
|
+
this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
32666
32339
|
}
|
|
32667
32340
|
prop.value = this.parseMaybeDefault(startLoc, cloneIdentifier(prop.key));
|
|
32668
32341
|
} else {
|
|
@@ -32712,9 +32385,7 @@ function requireLib () {
|
|
|
32712
32385
|
refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
32713
32386
|
}
|
|
32714
32387
|
} else {
|
|
32715
|
-
this.raise(Errors.UnexpectedPrivateField,
|
|
32716
|
-
at: privateKeyLoc
|
|
32717
|
-
});
|
|
32388
|
+
this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
32718
32389
|
}
|
|
32719
32390
|
key = this.parsePrivateName();
|
|
32720
32391
|
break;
|
|
@@ -32800,9 +32471,7 @@ function requireLib () {
|
|
|
32800
32471
|
node.body = this.parseBlock(true, false, hasStrictModeDirective => {
|
|
32801
32472
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
32802
32473
|
if (hasStrictModeDirective && nonSimple) {
|
|
32803
|
-
this.raise(Errors.IllegalLanguageModeDirective,
|
|
32804
|
-
at: (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node
|
|
32805
|
-
});
|
|
32474
|
+
this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.loc.end : node);
|
|
32806
32475
|
}
|
|
32807
32476
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
32808
32477
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
@@ -32862,8 +32531,7 @@ function requireLib () {
|
|
|
32862
32531
|
let elt;
|
|
32863
32532
|
if (this.match(12)) {
|
|
32864
32533
|
if (!allowEmpty) {
|
|
32865
|
-
this.raise(Errors.UnexpectedToken, {
|
|
32866
|
-
at: this.state.curPosition(),
|
|
32534
|
+
this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
|
|
32867
32535
|
unexpected: ","
|
|
32868
32536
|
});
|
|
32869
32537
|
}
|
|
@@ -32874,9 +32542,7 @@ function requireLib () {
|
|
|
32874
32542
|
} else if (this.match(17)) {
|
|
32875
32543
|
this.expectPlugin("partialApplication");
|
|
32876
32544
|
if (!allowPlaceholder) {
|
|
32877
|
-
this.raise(Errors.UnexpectedArgumentPlaceholder,
|
|
32878
|
-
at: this.state.startLoc
|
|
32879
|
-
});
|
|
32545
|
+
this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
|
|
32880
32546
|
}
|
|
32881
32547
|
const node = this.startNode();
|
|
32882
32548
|
this.next();
|
|
@@ -32926,47 +32592,35 @@ function requireLib () {
|
|
|
32926
32592
|
return;
|
|
32927
32593
|
}
|
|
32928
32594
|
if (checkKeywords && isKeyword(word)) {
|
|
32929
|
-
this.raise(Errors.UnexpectedKeyword, {
|
|
32930
|
-
at: startLoc,
|
|
32595
|
+
this.raise(Errors.UnexpectedKeyword, startLoc, {
|
|
32931
32596
|
keyword: word
|
|
32932
32597
|
});
|
|
32933
32598
|
return;
|
|
32934
32599
|
}
|
|
32935
32600
|
const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
|
|
32936
32601
|
if (reservedTest(word, this.inModule)) {
|
|
32937
|
-
this.raise(Errors.UnexpectedReservedWord, {
|
|
32938
|
-
at: startLoc,
|
|
32602
|
+
this.raise(Errors.UnexpectedReservedWord, startLoc, {
|
|
32939
32603
|
reservedWord: word
|
|
32940
32604
|
});
|
|
32941
32605
|
return;
|
|
32942
32606
|
} else if (word === "yield") {
|
|
32943
32607
|
if (this.prodParam.hasYield) {
|
|
32944
|
-
this.raise(Errors.YieldBindingIdentifier,
|
|
32945
|
-
at: startLoc
|
|
32946
|
-
});
|
|
32608
|
+
this.raise(Errors.YieldBindingIdentifier, startLoc);
|
|
32947
32609
|
return;
|
|
32948
32610
|
}
|
|
32949
32611
|
} else if (word === "await") {
|
|
32950
32612
|
if (this.prodParam.hasAwait) {
|
|
32951
|
-
this.raise(Errors.AwaitBindingIdentifier,
|
|
32952
|
-
at: startLoc
|
|
32953
|
-
});
|
|
32613
|
+
this.raise(Errors.AwaitBindingIdentifier, startLoc);
|
|
32954
32614
|
return;
|
|
32955
32615
|
}
|
|
32956
32616
|
if (this.scope.inStaticBlock) {
|
|
32957
|
-
this.raise(Errors.AwaitBindingIdentifierInStaticBlock,
|
|
32958
|
-
at: startLoc
|
|
32959
|
-
});
|
|
32617
|
+
this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
|
|
32960
32618
|
return;
|
|
32961
32619
|
}
|
|
32962
|
-
this.expressionScope.recordAsyncArrowParametersError(
|
|
32963
|
-
at: startLoc
|
|
32964
|
-
});
|
|
32620
|
+
this.expressionScope.recordAsyncArrowParametersError(startLoc);
|
|
32965
32621
|
} else if (word === "arguments") {
|
|
32966
32622
|
if (this.scope.inClassAndNotInNonArrowFunction) {
|
|
32967
|
-
this.raise(Errors.ArgumentsInClass,
|
|
32968
|
-
at: startLoc
|
|
32969
|
-
});
|
|
32623
|
+
this.raise(Errors.ArgumentsInClass, startLoc);
|
|
32970
32624
|
return;
|
|
32971
32625
|
}
|
|
32972
32626
|
}
|
|
@@ -32980,13 +32634,9 @@ function requireLib () {
|
|
|
32980
32634
|
}
|
|
32981
32635
|
parseAwait(startLoc) {
|
|
32982
32636
|
const node = this.startNodeAt(startLoc);
|
|
32983
|
-
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter,
|
|
32984
|
-
at: node
|
|
32985
|
-
});
|
|
32637
|
+
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
|
|
32986
32638
|
if (this.eat(55)) {
|
|
32987
|
-
this.raise(Errors.ObsoleteAwaitStar,
|
|
32988
|
-
at: node
|
|
32989
|
-
});
|
|
32639
|
+
this.raise(Errors.ObsoleteAwaitStar, node);
|
|
32990
32640
|
}
|
|
32991
32641
|
if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
|
|
32992
32642
|
if (this.isAmbiguousAwait()) {
|
|
@@ -33009,9 +32659,7 @@ function requireLib () {
|
|
|
33009
32659
|
}
|
|
33010
32660
|
parseYield() {
|
|
33011
32661
|
const node = this.startNode();
|
|
33012
|
-
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter,
|
|
33013
|
-
at: node
|
|
33014
|
-
});
|
|
32662
|
+
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
|
|
33015
32663
|
this.next();
|
|
33016
32664
|
let delegating = false;
|
|
33017
32665
|
let argument = null;
|
|
@@ -33056,9 +32704,7 @@ function requireLib () {
|
|
|
33056
32704
|
proposal: "smart"
|
|
33057
32705
|
}])) {
|
|
33058
32706
|
if (left.type === "SequenceExpression") {
|
|
33059
|
-
this.raise(Errors.PipelineHeadSequenceExpression,
|
|
33060
|
-
at: leftStartLoc
|
|
33061
|
-
});
|
|
32707
|
+
this.raise(Errors.PipelineHeadSequenceExpression, leftStartLoc);
|
|
33062
32708
|
}
|
|
33063
32709
|
}
|
|
33064
32710
|
}
|
|
@@ -33086,14 +32732,10 @@ function requireLib () {
|
|
|
33086
32732
|
}
|
|
33087
32733
|
checkSmartPipeTopicBodyEarlyErrors(startLoc) {
|
|
33088
32734
|
if (this.match(19)) {
|
|
33089
|
-
throw this.raise(Errors.PipelineBodyNoArrow,
|
|
33090
|
-
at: this.state.startLoc
|
|
33091
|
-
});
|
|
32735
|
+
throw this.raise(Errors.PipelineBodyNoArrow, this.state.startLoc);
|
|
33092
32736
|
}
|
|
33093
32737
|
if (!this.topicReferenceWasUsedInCurrentContext()) {
|
|
33094
|
-
this.raise(Errors.PipelineTopicUnused,
|
|
33095
|
-
at: startLoc
|
|
33096
|
-
});
|
|
32738
|
+
this.raise(Errors.PipelineTopicUnused, startLoc);
|
|
33097
32739
|
}
|
|
33098
32740
|
}
|
|
33099
32741
|
withTopicBindingContext(callback) {
|
|
@@ -33200,10 +32842,10 @@ function requireLib () {
|
|
|
33200
32842
|
parsePropertyNamePrefixOperator(prop) {}
|
|
33201
32843
|
}
|
|
33202
32844
|
const loopLabel = {
|
|
33203
|
-
kind:
|
|
32845
|
+
kind: 1
|
|
33204
32846
|
},
|
|
33205
32847
|
switchLabel = {
|
|
33206
|
-
kind:
|
|
32848
|
+
kind: 2
|
|
33207
32849
|
};
|
|
33208
32850
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
33209
32851
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
@@ -33317,7 +32959,7 @@ function requireLib () {
|
|
|
33317
32959
|
class StatementParser extends ExpressionParser {
|
|
33318
32960
|
parseTopLevel(file, program) {
|
|
33319
32961
|
file.program = this.parseProgram(program);
|
|
33320
|
-
file.comments = this.
|
|
32962
|
+
file.comments = this.comments;
|
|
33321
32963
|
if (this.options.tokens) {
|
|
33322
32964
|
file.tokens = babel7CompatTokens(this.tokens, this.input);
|
|
33323
32965
|
}
|
|
@@ -33329,8 +32971,7 @@ function requireLib () {
|
|
|
33329
32971
|
this.parseBlockBody(program, true, true, end);
|
|
33330
32972
|
if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
|
|
33331
32973
|
for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
|
|
33332
|
-
this.raise(Errors.ModuleExportUndefined, {
|
|
33333
|
-
at,
|
|
32974
|
+
this.raise(Errors.ModuleExportUndefined, at, {
|
|
33334
32975
|
localName
|
|
33335
32976
|
});
|
|
33336
32977
|
}
|
|
@@ -33472,9 +33113,7 @@ function requireLib () {
|
|
|
33472
33113
|
case 68:
|
|
33473
33114
|
if (this.lookaheadCharCode() === 46) break;
|
|
33474
33115
|
if (!allowFunctionDeclaration) {
|
|
33475
|
-
this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction,
|
|
33476
|
-
at: this.state.startLoc
|
|
33477
|
-
});
|
|
33116
|
+
this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
|
|
33478
33117
|
}
|
|
33479
33118
|
return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
|
|
33480
33119
|
case 80:
|
|
@@ -33493,13 +33132,9 @@ function requireLib () {
|
|
|
33493
33132
|
case 96:
|
|
33494
33133
|
if (!this.state.containsEsc && this.startsAwaitUsing()) {
|
|
33495
33134
|
if (!this.isAwaitAllowed()) {
|
|
33496
|
-
this.raise(Errors.AwaitUsingNotInAsyncContext,
|
|
33497
|
-
at: node
|
|
33498
|
-
});
|
|
33135
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, node);
|
|
33499
33136
|
} else if (!allowDeclaration) {
|
|
33500
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
33501
|
-
at: node
|
|
33502
|
-
});
|
|
33137
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
33503
33138
|
}
|
|
33504
33139
|
this.next();
|
|
33505
33140
|
return this.parseVarStatement(node, "await using");
|
|
@@ -33511,13 +33146,9 @@ function requireLib () {
|
|
|
33511
33146
|
}
|
|
33512
33147
|
this.expectPlugin("explicitResourceManagement");
|
|
33513
33148
|
if (!this.scope.inModule && this.scope.inTopLevel) {
|
|
33514
|
-
this.raise(Errors.UnexpectedUsingDeclaration,
|
|
33515
|
-
at: this.state.startLoc
|
|
33516
|
-
});
|
|
33149
|
+
this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
33517
33150
|
} else if (!allowDeclaration) {
|
|
33518
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
33519
|
-
at: this.state.startLoc
|
|
33520
|
-
});
|
|
33151
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
33521
33152
|
}
|
|
33522
33153
|
return this.parseVarStatement(node, "using");
|
|
33523
33154
|
case 100:
|
|
@@ -33537,9 +33168,7 @@ function requireLib () {
|
|
|
33537
33168
|
case 75:
|
|
33538
33169
|
{
|
|
33539
33170
|
if (!allowDeclaration) {
|
|
33540
|
-
this.raise(Errors.UnexpectedLexicalDeclaration,
|
|
33541
|
-
at: this.state.startLoc
|
|
33542
|
-
});
|
|
33171
|
+
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
33543
33172
|
}
|
|
33544
33173
|
}
|
|
33545
33174
|
case 74:
|
|
@@ -33565,9 +33194,7 @@ function requireLib () {
|
|
|
33565
33194
|
case 82:
|
|
33566
33195
|
{
|
|
33567
33196
|
if (!this.options.allowImportExportEverywhere && !topLevel) {
|
|
33568
|
-
this.raise(Errors.UnexpectedImportExport,
|
|
33569
|
-
at: this.state.startLoc
|
|
33570
|
-
});
|
|
33197
|
+
this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
|
|
33571
33198
|
}
|
|
33572
33199
|
this.next();
|
|
33573
33200
|
let result;
|
|
@@ -33589,9 +33216,7 @@ function requireLib () {
|
|
|
33589
33216
|
{
|
|
33590
33217
|
if (this.isAsyncFunction()) {
|
|
33591
33218
|
if (!allowDeclaration) {
|
|
33592
|
-
this.raise(Errors.AsyncFunctionInSingleStatementContext,
|
|
33593
|
-
at: this.state.startLoc
|
|
33594
|
-
});
|
|
33219
|
+
this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
33595
33220
|
}
|
|
33596
33221
|
this.next();
|
|
33597
33222
|
return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
|
|
@@ -33608,9 +33233,7 @@ function requireLib () {
|
|
|
33608
33233
|
}
|
|
33609
33234
|
assertModuleNodeAllowed(node) {
|
|
33610
33235
|
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
|
33611
|
-
this.raise(Errors.ImportOutsideModule,
|
|
33612
|
-
at: node
|
|
33613
|
-
});
|
|
33236
|
+
this.raise(Errors.ImportOutsideModule, node);
|
|
33614
33237
|
}
|
|
33615
33238
|
}
|
|
33616
33239
|
decoratorsEnabledBeforeExport() {
|
|
@@ -33621,9 +33244,7 @@ function requireLib () {
|
|
|
33621
33244
|
if (maybeDecorators) {
|
|
33622
33245
|
if (classNode.decorators && classNode.decorators.length > 0) {
|
|
33623
33246
|
if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
|
|
33624
|
-
this.raise(Errors.DecoratorsBeforeAfterExport,
|
|
33625
|
-
at: classNode.decorators[0]
|
|
33626
|
-
});
|
|
33247
|
+
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
33627
33248
|
}
|
|
33628
33249
|
classNode.decorators.unshift(...maybeDecorators);
|
|
33629
33250
|
} else {
|
|
@@ -33647,14 +33268,10 @@ function requireLib () {
|
|
|
33647
33268
|
this.unexpected();
|
|
33648
33269
|
}
|
|
33649
33270
|
if (!this.decoratorsEnabledBeforeExport()) {
|
|
33650
|
-
this.raise(Errors.DecoratorExportClass,
|
|
33651
|
-
at: this.state.startLoc
|
|
33652
|
-
});
|
|
33271
|
+
this.raise(Errors.DecoratorExportClass, this.state.startLoc);
|
|
33653
33272
|
}
|
|
33654
33273
|
} else if (!this.canHaveLeadingDecorator()) {
|
|
33655
|
-
throw this.raise(Errors.UnexpectedLeadingDecorator,
|
|
33656
|
-
at: this.state.startLoc
|
|
33657
|
-
});
|
|
33274
|
+
throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
|
|
33658
33275
|
}
|
|
33659
33276
|
return decorators;
|
|
33660
33277
|
}
|
|
@@ -33674,9 +33291,7 @@ function requireLib () {
|
|
|
33674
33291
|
const paramsStartLoc = this.state.startLoc;
|
|
33675
33292
|
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
33676
33293
|
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
33677
|
-
this.raise(Errors.DecoratorArgumentsOutsideParentheses,
|
|
33678
|
-
at: paramsStartLoc
|
|
33679
|
-
});
|
|
33294
|
+
this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
|
|
33680
33295
|
}
|
|
33681
33296
|
} else {
|
|
33682
33297
|
expr = this.parseIdentifier(false);
|
|
@@ -33725,14 +33340,15 @@ function requireLib () {
|
|
|
33725
33340
|
for (i = 0; i < this.state.labels.length; ++i) {
|
|
33726
33341
|
const lab = this.state.labels[i];
|
|
33727
33342
|
if (node.label == null || lab.name === node.label.name) {
|
|
33728
|
-
if (lab.kind != null && (isBreak || lab.kind ===
|
|
33343
|
+
if (lab.kind != null && (isBreak || lab.kind === 1)) {
|
|
33344
|
+
break;
|
|
33345
|
+
}
|
|
33729
33346
|
if (node.label && isBreak) break;
|
|
33730
33347
|
}
|
|
33731
33348
|
}
|
|
33732
33349
|
if (i === this.state.labels.length) {
|
|
33733
33350
|
const type = isBreak ? "BreakStatement" : "ContinueStatement";
|
|
33734
|
-
this.raise(Errors.IllegalBreakContinue, {
|
|
33735
|
-
at: node,
|
|
33351
|
+
this.raise(Errors.IllegalBreakContinue, node, {
|
|
33736
33352
|
type
|
|
33737
33353
|
});
|
|
33738
33354
|
}
|
|
@@ -33784,9 +33400,7 @@ function requireLib () {
|
|
|
33784
33400
|
if (startsWithAwaitUsing) {
|
|
33785
33401
|
kind = "await using";
|
|
33786
33402
|
if (!this.isAwaitAllowed()) {
|
|
33787
|
-
this.raise(Errors.AwaitUsingNotInAsyncContext,
|
|
33788
|
-
at: this.state.startLoc
|
|
33789
|
-
});
|
|
33403
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
|
|
33790
33404
|
}
|
|
33791
33405
|
this.next();
|
|
33792
33406
|
} else {
|
|
@@ -33797,9 +33411,7 @@ function requireLib () {
|
|
|
33797
33411
|
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
33798
33412
|
const isForIn = this.match(58);
|
|
33799
33413
|
if (isForIn && starsWithUsingDeclaration) {
|
|
33800
|
-
this.raise(Errors.ForInUsing,
|
|
33801
|
-
at: init
|
|
33802
|
-
});
|
|
33414
|
+
this.raise(Errors.ForInUsing, init);
|
|
33803
33415
|
}
|
|
33804
33416
|
if ((isForIn || this.isContextual(102)) && init.declarations.length === 1) {
|
|
33805
33417
|
return this.parseForIn(node, init, awaitAt);
|
|
@@ -33816,14 +33428,10 @@ function requireLib () {
|
|
|
33816
33428
|
const isForOf = this.isContextual(102);
|
|
33817
33429
|
if (isForOf) {
|
|
33818
33430
|
if (startsWithLet) {
|
|
33819
|
-
this.raise(Errors.ForOfLet,
|
|
33820
|
-
at: init
|
|
33821
|
-
});
|
|
33431
|
+
this.raise(Errors.ForOfLet, init);
|
|
33822
33432
|
}
|
|
33823
33433
|
if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
33824
|
-
this.raise(Errors.ForOfAsync,
|
|
33825
|
-
at: init
|
|
33826
|
-
});
|
|
33434
|
+
this.raise(Errors.ForOfAsync, init);
|
|
33827
33435
|
}
|
|
33828
33436
|
}
|
|
33829
33437
|
if (isForOf || this.match(58)) {
|
|
@@ -33857,9 +33465,7 @@ function requireLib () {
|
|
|
33857
33465
|
}
|
|
33858
33466
|
parseReturnStatement(node) {
|
|
33859
33467
|
if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
|
|
33860
|
-
this.raise(Errors.IllegalReturn,
|
|
33861
|
-
at: this.state.startLoc
|
|
33862
|
-
});
|
|
33468
|
+
this.raise(Errors.IllegalReturn, this.state.startLoc);
|
|
33863
33469
|
}
|
|
33864
33470
|
this.next();
|
|
33865
33471
|
if (this.isLineTerminator()) {
|
|
@@ -33889,9 +33495,7 @@ function requireLib () {
|
|
|
33889
33495
|
cur.test = this.parseExpression();
|
|
33890
33496
|
} else {
|
|
33891
33497
|
if (sawDefault) {
|
|
33892
|
-
this.raise(Errors.MultipleDefaultsInSwitch,
|
|
33893
|
-
at: this.state.lastTokStartLoc
|
|
33894
|
-
});
|
|
33498
|
+
this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
|
|
33895
33499
|
}
|
|
33896
33500
|
sawDefault = true;
|
|
33897
33501
|
cur.test = null;
|
|
@@ -33914,9 +33518,7 @@ function requireLib () {
|
|
|
33914
33518
|
parseThrowStatement(node) {
|
|
33915
33519
|
this.next();
|
|
33916
33520
|
if (this.hasPrecedingLineBreak()) {
|
|
33917
|
-
this.raise(Errors.NewlineAfterThrow,
|
|
33918
|
-
at: this.state.lastTokEndLoc
|
|
33919
|
-
});
|
|
33521
|
+
this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
|
|
33920
33522
|
}
|
|
33921
33523
|
node.argument = this.parseExpression();
|
|
33922
33524
|
this.semicolon();
|
|
@@ -33954,9 +33556,7 @@ function requireLib () {
|
|
|
33954
33556
|
}
|
|
33955
33557
|
node.finalizer = this.eat(67) ? this.parseBlock() : null;
|
|
33956
33558
|
if (!node.handler && !node.finalizer) {
|
|
33957
|
-
this.raise(Errors.NoCatchOrFinally,
|
|
33958
|
-
at: node
|
|
33959
|
-
});
|
|
33559
|
+
this.raise(Errors.NoCatchOrFinally, node);
|
|
33960
33560
|
}
|
|
33961
33561
|
return this.finishNode(node, "TryStatement");
|
|
33962
33562
|
}
|
|
@@ -33976,9 +33576,7 @@ function requireLib () {
|
|
|
33976
33576
|
}
|
|
33977
33577
|
parseWithStatement(node) {
|
|
33978
33578
|
if (this.state.strict) {
|
|
33979
|
-
this.raise(Errors.StrictWith,
|
|
33980
|
-
at: this.state.startLoc
|
|
33981
|
-
});
|
|
33579
|
+
this.raise(Errors.StrictWith, this.state.startLoc);
|
|
33982
33580
|
}
|
|
33983
33581
|
this.next();
|
|
33984
33582
|
node.object = this.parseHeaderExpression();
|
|
@@ -33992,13 +33590,12 @@ function requireLib () {
|
|
|
33992
33590
|
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
33993
33591
|
for (const label of this.state.labels) {
|
|
33994
33592
|
if (label.name === maybeName) {
|
|
33995
|
-
this.raise(Errors.LabelRedeclaration, {
|
|
33996
|
-
at: expr,
|
|
33593
|
+
this.raise(Errors.LabelRedeclaration, expr, {
|
|
33997
33594
|
labelName: maybeName
|
|
33998
33595
|
});
|
|
33999
33596
|
}
|
|
34000
33597
|
}
|
|
34001
|
-
const kind = tokenIsLoop(this.state.type) ?
|
|
33598
|
+
const kind = tokenIsLoop(this.state.type) ? 1 : this.match(71) ? 2 : null;
|
|
34002
33599
|
for (let i = this.state.labels.length - 1; i >= 0; i--) {
|
|
34003
33600
|
const label = this.state.labels[i];
|
|
34004
33601
|
if (label.statementStart === node.start) {
|
|
@@ -34094,14 +33691,12 @@ function requireLib () {
|
|
|
34094
33691
|
node.await = awaitAt !== null;
|
|
34095
33692
|
}
|
|
34096
33693
|
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")) {
|
|
34097
|
-
this.raise(Errors.ForInOfLoopInitializer, {
|
|
34098
|
-
at: init,
|
|
33694
|
+
this.raise(Errors.ForInOfLoopInitializer, init, {
|
|
34099
33695
|
type: isForIn ? "ForInStatement" : "ForOfStatement"
|
|
34100
33696
|
});
|
|
34101
33697
|
}
|
|
34102
33698
|
if (init.type === "AssignmentPattern") {
|
|
34103
|
-
this.raise(Errors.InvalidLhs, {
|
|
34104
|
-
at: init,
|
|
33699
|
+
this.raise(Errors.InvalidLhs, init, {
|
|
34105
33700
|
ancestor: {
|
|
34106
33701
|
type: "ForStatement"
|
|
34107
33702
|
}
|
|
@@ -34124,13 +33719,11 @@ function requireLib () {
|
|
|
34124
33719
|
decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
34125
33720
|
if (decl.init === null && !allowMissingInitializer) {
|
|
34126
33721
|
if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(102)))) {
|
|
34127
|
-
this.raise(Errors.DeclarationMissingInitializer, {
|
|
34128
|
-
at: this.state.lastTokEndLoc,
|
|
33722
|
+
this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
|
|
34129
33723
|
kind: "destructuring"
|
|
34130
33724
|
});
|
|
34131
33725
|
} else if (kind === "const" && !(this.match(58) || this.isContextual(102))) {
|
|
34132
|
-
this.raise(Errors.DeclarationMissingInitializer, {
|
|
34133
|
-
at: this.state.lastTokEndLoc,
|
|
33726
|
+
this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, {
|
|
34134
33727
|
kind: "const"
|
|
34135
33728
|
});
|
|
34136
33729
|
}
|
|
@@ -34161,9 +33754,7 @@ function requireLib () {
|
|
|
34161
33754
|
this.initFunction(node, isAsync);
|
|
34162
33755
|
if (this.match(55)) {
|
|
34163
33756
|
if (hangingDeclaration) {
|
|
34164
|
-
this.raise(Errors.GeneratorInSingleStatementContext,
|
|
34165
|
-
at: this.state.startLoc
|
|
34166
|
-
});
|
|
33757
|
+
this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
34167
33758
|
}
|
|
34168
33759
|
this.next();
|
|
34169
33760
|
node.generator = true;
|
|
@@ -34235,9 +33826,7 @@ function requireLib () {
|
|
|
34235
33826
|
while (!this.match(8)) {
|
|
34236
33827
|
if (this.eat(13)) {
|
|
34237
33828
|
if (decorators.length > 0) {
|
|
34238
|
-
throw this.raise(Errors.DecoratorSemicolon,
|
|
34239
|
-
at: this.state.lastTokEndLoc
|
|
34240
|
-
});
|
|
33829
|
+
throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
|
|
34241
33830
|
}
|
|
34242
33831
|
continue;
|
|
34243
33832
|
}
|
|
@@ -34253,18 +33842,14 @@ function requireLib () {
|
|
|
34253
33842
|
}
|
|
34254
33843
|
this.parseClassMember(classBody, member, state);
|
|
34255
33844
|
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
|
|
34256
|
-
this.raise(Errors.DecoratorConstructor,
|
|
34257
|
-
at: member
|
|
34258
|
-
});
|
|
33845
|
+
this.raise(Errors.DecoratorConstructor, member);
|
|
34259
33846
|
}
|
|
34260
33847
|
}
|
|
34261
33848
|
});
|
|
34262
33849
|
this.state.strict = oldStrict;
|
|
34263
33850
|
this.next();
|
|
34264
33851
|
if (decorators.length) {
|
|
34265
|
-
throw this.raise(Errors.TrailingDecorator,
|
|
34266
|
-
at: this.state.startLoc
|
|
34267
|
-
});
|
|
33852
|
+
throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
|
|
34268
33853
|
}
|
|
34269
33854
|
this.classScope.exit();
|
|
34270
33855
|
return this.finishNode(classBody, "ClassBody");
|
|
@@ -34322,9 +33907,7 @@ function requireLib () {
|
|
|
34322
33907
|
return;
|
|
34323
33908
|
}
|
|
34324
33909
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
34325
|
-
this.raise(Errors.ConstructorIsGenerator,
|
|
34326
|
-
at: publicMethod.key
|
|
34327
|
-
});
|
|
33910
|
+
this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
|
|
34328
33911
|
}
|
|
34329
33912
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
34330
33913
|
return;
|
|
@@ -34345,14 +33928,10 @@ function requireLib () {
|
|
|
34345
33928
|
if (isConstructor) {
|
|
34346
33929
|
publicMethod.kind = "constructor";
|
|
34347
33930
|
if (state.hadConstructor && !this.hasPlugin("typescript")) {
|
|
34348
|
-
this.raise(Errors.DuplicateConstructor,
|
|
34349
|
-
at: key
|
|
34350
|
-
});
|
|
33931
|
+
this.raise(Errors.DuplicateConstructor, key);
|
|
34351
33932
|
}
|
|
34352
33933
|
if (isConstructor && this.hasPlugin("typescript") && member.override) {
|
|
34353
|
-
this.raise(Errors.OverrideOnConstructor,
|
|
34354
|
-
at: key
|
|
34355
|
-
});
|
|
33934
|
+
this.raise(Errors.OverrideOnConstructor, key);
|
|
34356
33935
|
}
|
|
34357
33936
|
state.hadConstructor = true;
|
|
34358
33937
|
allowsDirectSuper = state.hadSuperClass;
|
|
@@ -34378,9 +33957,7 @@ function requireLib () {
|
|
|
34378
33957
|
this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
34379
33958
|
} else {
|
|
34380
33959
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
34381
|
-
this.raise(Errors.ConstructorIsAsync,
|
|
34382
|
-
at: publicMethod.key
|
|
34383
|
-
});
|
|
33960
|
+
this.raise(Errors.ConstructorIsAsync, publicMethod.key);
|
|
34384
33961
|
}
|
|
34385
33962
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
34386
33963
|
}
|
|
@@ -34393,9 +33970,7 @@ function requireLib () {
|
|
|
34393
33970
|
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
34394
33971
|
} else {
|
|
34395
33972
|
if (this.isNonstaticConstructor(publicMethod)) {
|
|
34396
|
-
this.raise(Errors.ConstructorIsAccessor,
|
|
34397
|
-
at: publicMethod.key
|
|
34398
|
-
});
|
|
33973
|
+
this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
|
|
34399
33974
|
}
|
|
34400
33975
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
34401
33976
|
}
|
|
@@ -34422,15 +33997,11 @@ function requireLib () {
|
|
|
34422
33997
|
value
|
|
34423
33998
|
} = this.state;
|
|
34424
33999
|
if ((type === 132 || type === 133) && member.static && value === "prototype") {
|
|
34425
|
-
this.raise(Errors.StaticPrototype,
|
|
34426
|
-
at: this.state.startLoc
|
|
34427
|
-
});
|
|
34000
|
+
this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
34428
34001
|
}
|
|
34429
34002
|
if (type === 138) {
|
|
34430
34003
|
if (value === "constructor") {
|
|
34431
|
-
this.raise(Errors.ConstructorClassPrivateField,
|
|
34432
|
-
at: this.state.startLoc
|
|
34433
|
-
});
|
|
34004
|
+
this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
34434
34005
|
}
|
|
34435
34006
|
const key = this.parsePrivateName();
|
|
34436
34007
|
member.key = key;
|
|
@@ -34451,16 +34022,12 @@ function requireLib () {
|
|
|
34451
34022
|
this.state.labels = oldLabels;
|
|
34452
34023
|
classBody.body.push(this.finishNode(member, "StaticBlock"));
|
|
34453
34024
|
if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
|
|
34454
|
-
this.raise(Errors.DecoratorStaticBlock,
|
|
34455
|
-
at: member
|
|
34456
|
-
});
|
|
34025
|
+
this.raise(Errors.DecoratorStaticBlock, member);
|
|
34457
34026
|
}
|
|
34458
34027
|
}
|
|
34459
34028
|
pushClassProperty(classBody, prop) {
|
|
34460
34029
|
if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
|
|
34461
|
-
this.raise(Errors.ConstructorClassField,
|
|
34462
|
-
at: prop.key
|
|
34463
|
-
});
|
|
34030
|
+
this.raise(Errors.ConstructorClassField, prop.key);
|
|
34464
34031
|
}
|
|
34465
34032
|
classBody.body.push(this.parseClassProperty(prop));
|
|
34466
34033
|
}
|
|
@@ -34473,9 +34040,7 @@ function requireLib () {
|
|
|
34473
34040
|
if (!isPrivate && !prop.computed) {
|
|
34474
34041
|
const key = prop.key;
|
|
34475
34042
|
if (key.name === "constructor" || key.value === "constructor") {
|
|
34476
|
-
this.raise(Errors.ConstructorClassField,
|
|
34477
|
-
at: key
|
|
34478
|
-
});
|
|
34043
|
+
this.raise(Errors.ConstructorClassField, key);
|
|
34479
34044
|
}
|
|
34480
34045
|
}
|
|
34481
34046
|
const node = this.parseClassAccessorProperty(prop);
|
|
@@ -34531,9 +34096,7 @@ function requireLib () {
|
|
|
34531
34096
|
if (optionalId || !isStatement) {
|
|
34532
34097
|
node.id = null;
|
|
34533
34098
|
} else {
|
|
34534
|
-
throw this.raise(Errors.MissingClassName,
|
|
34535
|
-
at: this.state.startLoc
|
|
34536
|
-
});
|
|
34099
|
+
throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
34537
34100
|
}
|
|
34538
34101
|
}
|
|
34539
34102
|
}
|
|
@@ -34551,9 +34114,7 @@ function requireLib () {
|
|
|
34551
34114
|
if (hasStar && !hasNamespace) {
|
|
34552
34115
|
if (hasDefault) this.unexpected();
|
|
34553
34116
|
if (decorators) {
|
|
34554
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
34555
|
-
at: node
|
|
34556
|
-
});
|
|
34117
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
34557
34118
|
}
|
|
34558
34119
|
this.parseExportFrom(node, true);
|
|
34559
34120
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
@@ -34569,9 +34130,7 @@ function requireLib () {
|
|
|
34569
34130
|
if (isFromRequired || hasSpecifiers) {
|
|
34570
34131
|
hasDeclaration = false;
|
|
34571
34132
|
if (decorators) {
|
|
34572
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
34573
|
-
at: node
|
|
34574
|
-
});
|
|
34133
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
34575
34134
|
}
|
|
34576
34135
|
this.parseExportFrom(node, isFromRequired);
|
|
34577
34136
|
} else {
|
|
@@ -34584,9 +34143,7 @@ function requireLib () {
|
|
|
34584
34143
|
if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
|
|
34585
34144
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
34586
34145
|
} else if (decorators) {
|
|
34587
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
34588
|
-
at: node
|
|
34589
|
-
});
|
|
34146
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
34590
34147
|
}
|
|
34591
34148
|
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
34592
34149
|
}
|
|
@@ -34597,9 +34154,7 @@ function requireLib () {
|
|
|
34597
34154
|
if (decl.type === "ClassDeclaration") {
|
|
34598
34155
|
this.maybeTakeDecorators(decorators, decl, node2);
|
|
34599
34156
|
} else if (decorators) {
|
|
34600
|
-
throw this.raise(Errors.UnsupportedDecoratorExport,
|
|
34601
|
-
at: node
|
|
34602
|
-
});
|
|
34157
|
+
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
34603
34158
|
}
|
|
34604
34159
|
this.checkExport(node2, true, true);
|
|
34605
34160
|
return this.finishNode(node2, "ExportDefaultDeclaration");
|
|
@@ -34677,16 +34232,12 @@ function requireLib () {
|
|
|
34677
34232
|
}
|
|
34678
34233
|
if (this.match(26)) {
|
|
34679
34234
|
if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
34680
|
-
this.raise(Errors.DecoratorBeforeExport,
|
|
34681
|
-
at: this.state.startLoc
|
|
34682
|
-
});
|
|
34235
|
+
this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
|
|
34683
34236
|
}
|
|
34684
34237
|
return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
34685
34238
|
}
|
|
34686
34239
|
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
34687
|
-
throw this.raise(Errors.UnsupportedDefaultExport,
|
|
34688
|
-
at: this.state.startLoc
|
|
34689
|
-
});
|
|
34240
|
+
throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
34690
34241
|
}
|
|
34691
34242
|
const res = this.parseMaybeAssignAllowIn();
|
|
34692
34243
|
this.semicolon();
|
|
@@ -34749,9 +34300,7 @@ function requireLib () {
|
|
|
34749
34300
|
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
34750
34301
|
if (this.hasPlugin("decorators")) {
|
|
34751
34302
|
if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
34752
|
-
this.raise(Errors.DecoratorBeforeExport,
|
|
34753
|
-
at: this.state.startLoc
|
|
34754
|
-
});
|
|
34303
|
+
this.raise(Errors.DecoratorBeforeExport, this.state.startLoc);
|
|
34755
34304
|
}
|
|
34756
34305
|
return true;
|
|
34757
34306
|
}
|
|
@@ -34767,9 +34316,7 @@ function requireLib () {
|
|
|
34767
34316
|
var _declaration$extra;
|
|
34768
34317
|
const declaration = node.declaration;
|
|
34769
34318
|
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
34770
|
-
this.raise(Errors.ExportDefaultFromAsIdentifier,
|
|
34771
|
-
at: declaration
|
|
34772
|
-
});
|
|
34319
|
+
this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
|
|
34773
34320
|
}
|
|
34774
34321
|
}
|
|
34775
34322
|
} else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
|
|
@@ -34784,8 +34331,7 @@ function requireLib () {
|
|
|
34784
34331
|
local
|
|
34785
34332
|
} = specifier;
|
|
34786
34333
|
if (local.type !== "Identifier") {
|
|
34787
|
-
this.raise(Errors.ExportBindingIsString, {
|
|
34788
|
-
at: specifier,
|
|
34334
|
+
this.raise(Errors.ExportBindingIsString, specifier, {
|
|
34789
34335
|
localName: local.value,
|
|
34790
34336
|
exportName
|
|
34791
34337
|
});
|
|
@@ -34832,12 +34378,9 @@ function requireLib () {
|
|
|
34832
34378
|
checkDuplicateExports(node, exportName) {
|
|
34833
34379
|
if (this.exportedIdentifiers.has(exportName)) {
|
|
34834
34380
|
if (exportName === "default") {
|
|
34835
|
-
this.raise(Errors.DuplicateDefaultExport,
|
|
34836
|
-
at: node
|
|
34837
|
-
});
|
|
34381
|
+
this.raise(Errors.DuplicateDefaultExport, node);
|
|
34838
34382
|
} else {
|
|
34839
|
-
this.raise(Errors.DuplicateExport, {
|
|
34840
|
-
at: node,
|
|
34383
|
+
this.raise(Errors.DuplicateExport, node, {
|
|
34841
34384
|
exportName
|
|
34842
34385
|
});
|
|
34843
34386
|
}
|
|
@@ -34878,8 +34421,7 @@ function requireLib () {
|
|
|
34878
34421
|
const result = this.parseStringLiteral(this.state.value);
|
|
34879
34422
|
const surrogate = result.value.match(loneSurrogate);
|
|
34880
34423
|
if (surrogate) {
|
|
34881
|
-
this.raise(Errors.ModuleExportNameHasLoneSurrogate, {
|
|
34882
|
-
at: result,
|
|
34424
|
+
this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, {
|
|
34883
34425
|
surrogateCharCode: surrogate[0].charCodeAt(0)
|
|
34884
34426
|
});
|
|
34885
34427
|
}
|
|
@@ -34905,27 +34447,19 @@ function requireLib () {
|
|
|
34905
34447
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
34906
34448
|
if (node.phase === "source") {
|
|
34907
34449
|
if (singleBindingType !== "ImportDefaultSpecifier") {
|
|
34908
|
-
this.raise(Errors.SourcePhaseImportRequiresDefault,
|
|
34909
|
-
at: specifiers[0].loc.start
|
|
34910
|
-
});
|
|
34450
|
+
this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
|
|
34911
34451
|
}
|
|
34912
34452
|
} else if (node.phase === "defer") {
|
|
34913
34453
|
if (singleBindingType !== "ImportNamespaceSpecifier") {
|
|
34914
|
-
this.raise(Errors.DeferImportRequiresNamespace,
|
|
34915
|
-
at: specifiers[0].loc.start
|
|
34916
|
-
});
|
|
34454
|
+
this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
|
|
34917
34455
|
}
|
|
34918
34456
|
} else if (node.module) {
|
|
34919
34457
|
var _node$assertions;
|
|
34920
34458
|
if (singleBindingType !== "ImportDefaultSpecifier") {
|
|
34921
|
-
this.raise(Errors.ImportReflectionNotBinding,
|
|
34922
|
-
at: specifiers[0].loc.start
|
|
34923
|
-
});
|
|
34459
|
+
this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
|
|
34924
34460
|
}
|
|
34925
34461
|
if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
|
|
34926
|
-
this.raise(Errors.ImportReflectionHasAssertion,
|
|
34927
|
-
at: node.specifiers[0].loc.start
|
|
34928
|
-
});
|
|
34462
|
+
this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
|
|
34929
34463
|
}
|
|
34930
34464
|
}
|
|
34931
34465
|
}
|
|
@@ -34947,9 +34481,7 @@ function requireLib () {
|
|
|
34947
34481
|
}
|
|
34948
34482
|
});
|
|
34949
34483
|
if (nonDefaultNamedSpecifier !== undefined) {
|
|
34950
|
-
this.raise(Errors.ImportJSONBindingNotDefault,
|
|
34951
|
-
at: nonDefaultNamedSpecifier.loc.start
|
|
34952
|
-
});
|
|
34484
|
+
this.raise(Errors.ImportJSONBindingNotDefault, nonDefaultNamedSpecifier.loc.start);
|
|
34953
34485
|
}
|
|
34954
34486
|
}
|
|
34955
34487
|
}
|
|
@@ -35056,8 +34588,7 @@ function requireLib () {
|
|
|
35056
34588
|
const node = this.startNode();
|
|
35057
34589
|
const keyName = this.state.value;
|
|
35058
34590
|
if (attrNames.has(keyName)) {
|
|
35059
|
-
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
35060
|
-
at: this.state.startLoc,
|
|
34591
|
+
this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, {
|
|
35061
34592
|
key: keyName
|
|
35062
34593
|
});
|
|
35063
34594
|
}
|
|
@@ -35069,9 +34600,7 @@ function requireLib () {
|
|
|
35069
34600
|
}
|
|
35070
34601
|
this.expect(14);
|
|
35071
34602
|
if (!this.match(133)) {
|
|
35072
|
-
throw this.raise(Errors.ModuleAttributeInvalidValue,
|
|
35073
|
-
at: this.state.startLoc
|
|
35074
|
-
});
|
|
34603
|
+
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
35075
34604
|
}
|
|
35076
34605
|
node.value = this.parseStringLiteral(this.state.value);
|
|
35077
34606
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
@@ -35086,22 +34615,17 @@ function requireLib () {
|
|
|
35086
34615
|
const node = this.startNode();
|
|
35087
34616
|
node.key = this.parseIdentifier(true);
|
|
35088
34617
|
if (node.key.name !== "type") {
|
|
35089
|
-
this.raise(Errors.ModuleAttributeDifferentFromType,
|
|
35090
|
-
at: node.key
|
|
35091
|
-
});
|
|
34618
|
+
this.raise(Errors.ModuleAttributeDifferentFromType, node.key);
|
|
35092
34619
|
}
|
|
35093
34620
|
if (attributes.has(node.key.name)) {
|
|
35094
|
-
this.raise(Errors.ModuleAttributesWithDuplicateKeys, {
|
|
35095
|
-
at: node.key,
|
|
34621
|
+
this.raise(Errors.ModuleAttributesWithDuplicateKeys, node.key, {
|
|
35096
34622
|
key: node.key.name
|
|
35097
34623
|
});
|
|
35098
34624
|
}
|
|
35099
34625
|
attributes.add(node.key.name);
|
|
35100
34626
|
this.expect(14);
|
|
35101
34627
|
if (!this.match(133)) {
|
|
35102
|
-
throw this.raise(Errors.ModuleAttributeInvalidValue,
|
|
35103
|
-
at: this.state.startLoc
|
|
35104
|
-
});
|
|
34628
|
+
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
35105
34629
|
}
|
|
35106
34630
|
node.value = this.parseStringLiteral(this.state.value);
|
|
35107
34631
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
@@ -35128,9 +34652,7 @@ function requireLib () {
|
|
|
35128
34652
|
} else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
|
|
35129
34653
|
if (this.hasPlugin("importAttributes")) {
|
|
35130
34654
|
if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
|
|
35131
|
-
this.raise(Errors.ImportAttributesUseAssert,
|
|
35132
|
-
at: this.state.startLoc
|
|
35133
|
-
});
|
|
34655
|
+
this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
|
|
35134
34656
|
}
|
|
35135
34657
|
this.addExtra(node, "deprecatedAssertSyntax", true);
|
|
35136
34658
|
} else {
|
|
@@ -35181,9 +34703,7 @@ function requireLib () {
|
|
|
35181
34703
|
first = false;
|
|
35182
34704
|
} else {
|
|
35183
34705
|
if (this.eat(14)) {
|
|
35184
|
-
throw this.raise(Errors.DestructureNamedImport,
|
|
35185
|
-
at: this.state.startLoc
|
|
35186
|
-
});
|
|
34706
|
+
throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
|
|
35187
34707
|
}
|
|
35188
34708
|
this.expect(12);
|
|
35189
34709
|
if (this.eat(8)) break;
|
|
@@ -35204,8 +34724,7 @@ function requireLib () {
|
|
|
35204
34724
|
imported
|
|
35205
34725
|
} = specifier;
|
|
35206
34726
|
if (importedIsString) {
|
|
35207
|
-
throw this.raise(Errors.ImportBindingIsString, {
|
|
35208
|
-
at: specifier,
|
|
34727
|
+
throw this.raise(Errors.ImportBindingIsString, specifier, {
|
|
35209
34728
|
importName: imported.value
|
|
35210
34729
|
});
|
|
35211
34730
|
}
|
|
@@ -35240,6 +34759,7 @@ function requireLib () {
|
|
|
35240
34759
|
file.errors = null;
|
|
35241
34760
|
this.parseTopLevel(file, program);
|
|
35242
34761
|
file.errors = this.state.errors;
|
|
34762
|
+
file.comments.length = this.state.commentsLen;
|
|
35243
34763
|
return file;
|
|
35244
34764
|
}
|
|
35245
34765
|
}
|
|
@@ -36036,4 +35556,4 @@ exports.getExtractMessagesConfig = getExtractMessagesConfig;
|
|
|
36036
35556
|
exports.rollupTask = rollupTask;
|
|
36037
35557
|
exports.rollupWatchTask = rollupWatchTask;
|
|
36038
35558
|
exports.watchTaskHandlers = watchTaskHandlers;
|
|
36039
|
-
//# sourceMappingURL=index-
|
|
35559
|
+
//# sourceMappingURL=index-FaD5mo-6.cjs.map
|