@next-core/brick-utils 2.35.0 → 2.35.3
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/CHANGELOG.md +18 -13
- package/dist/index.bundle.js +773 -564
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +773 -564
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.bundle.js
CHANGED
|
@@ -3063,40 +3063,6 @@
|
|
|
3063
3063
|
value: true
|
|
3064
3064
|
});
|
|
3065
3065
|
|
|
3066
|
-
class Position {
|
|
3067
|
-
constructor(line, col, index) {
|
|
3068
|
-
this.line = void 0;
|
|
3069
|
-
this.column = void 0;
|
|
3070
|
-
this.index = void 0;
|
|
3071
|
-
this.line = line;
|
|
3072
|
-
this.column = col;
|
|
3073
|
-
indexes.set(this, index);
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
}
|
|
3077
|
-
|
|
3078
|
-
class SourceLocation {
|
|
3079
|
-
constructor(start, end) {
|
|
3080
|
-
this.start = void 0;
|
|
3081
|
-
this.end = void 0;
|
|
3082
|
-
this.filename = void 0;
|
|
3083
|
-
this.identifierName = void 0;
|
|
3084
|
-
this.start = start;
|
|
3085
|
-
this.end = end;
|
|
3086
|
-
}
|
|
3087
|
-
|
|
3088
|
-
}
|
|
3089
|
-
|
|
3090
|
-
var indexes = new WeakMap();
|
|
3091
|
-
|
|
3092
|
-
function createPositionWithColumnOffset(position, columnOffset) {
|
|
3093
|
-
var {
|
|
3094
|
-
line,
|
|
3095
|
-
column
|
|
3096
|
-
} = position;
|
|
3097
|
-
return new Position(line, column + columnOffset, indexes.get(position) + columnOffset);
|
|
3098
|
-
}
|
|
3099
|
-
|
|
3100
3066
|
class BaseParser {
|
|
3101
3067
|
constructor() {
|
|
3102
3068
|
this.sawUnambiguousESM = false;
|
|
@@ -3379,6 +3345,7 @@
|
|
|
3379
3345
|
ImportCallArity: "`import()` requires exactly %0.",
|
|
3380
3346
|
ImportCallNotNewExpression: "Cannot use new with import(...).",
|
|
3381
3347
|
ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
|
|
3348
|
+
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
3382
3349
|
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
3383
3350
|
InvalidCodePoint: "Code point out of bounds.",
|
|
3384
3351
|
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
@@ -3543,7 +3510,7 @@
|
|
|
3543
3510
|
params[_key2 - 2] = arguments[_key2];
|
|
3544
3511
|
}
|
|
3545
3512
|
|
|
3546
|
-
var pos =
|
|
3513
|
+
var pos = loc.index;
|
|
3547
3514
|
var message = template.replace(/%(\d+)/g, (_, i) => params[i]) + " (".concat(loc.line, ":").concat(loc.column, ")");
|
|
3548
3515
|
|
|
3549
3516
|
if (this.options.errorRecovery) {
|
|
@@ -3574,7 +3541,7 @@
|
|
|
3574
3541
|
params[_key3 - 3] = arguments[_key3];
|
|
3575
3542
|
}
|
|
3576
3543
|
|
|
3577
|
-
var pos =
|
|
3544
|
+
var pos = loc.index;
|
|
3578
3545
|
var message = errorTemplate.replace(/%(\d+)/g, (_, i) => params[i]) + " (".concat(loc.line, ":").concat(loc.column, ")");
|
|
3579
3546
|
return this._raise(Object.assign({
|
|
3580
3547
|
loc,
|
|
@@ -3596,7 +3563,32 @@
|
|
|
3596
3563
|
|
|
3597
3564
|
}
|
|
3598
3565
|
|
|
3566
|
+
var {
|
|
3567
|
+
defineProperty
|
|
3568
|
+
} = Object;
|
|
3569
|
+
|
|
3570
|
+
var toUnenumerable = (object, key) => defineProperty(object, key, {
|
|
3571
|
+
enumerable: false,
|
|
3572
|
+
value: object[key]
|
|
3573
|
+
});
|
|
3574
|
+
|
|
3575
|
+
function toESTreeLocation(node) {
|
|
3576
|
+
toUnenumerable(node.loc.start, "index");
|
|
3577
|
+
toUnenumerable(node.loc.end, "index");
|
|
3578
|
+
return node;
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3599
3581
|
var estree = superClass => class extends superClass {
|
|
3582
|
+
parse() {
|
|
3583
|
+
var file = toESTreeLocation(super.parse());
|
|
3584
|
+
|
|
3585
|
+
if (this.options.tokens) {
|
|
3586
|
+
file.tokens = file.tokens.map(toESTreeLocation);
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
return file;
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3600
3592
|
parseRegExpLiteral(_ref3) {
|
|
3601
3593
|
var {
|
|
3602
3594
|
pattern,
|
|
@@ -3838,7 +3830,16 @@
|
|
|
3838
3830
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3839
3831
|
|
|
3840
3832
|
if (node != null && this.isObjectProperty(node)) {
|
|
3841
|
-
|
|
3833
|
+
var {
|
|
3834
|
+
key,
|
|
3835
|
+
value
|
|
3836
|
+
} = node;
|
|
3837
|
+
|
|
3838
|
+
if (this.isPrivateName(key)) {
|
|
3839
|
+
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3842
|
+
this.toAssignable(value, isLHS);
|
|
3842
3843
|
return node;
|
|
3843
3844
|
}
|
|
3844
3845
|
|
|
@@ -3952,6 +3953,16 @@
|
|
|
3952
3953
|
return node.method || node.kind === "get" || node.kind === "set";
|
|
3953
3954
|
}
|
|
3954
3955
|
|
|
3956
|
+
finishNodeAt(node, type, endLoc) {
|
|
3957
|
+
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
3958
|
+
}
|
|
3959
|
+
|
|
3960
|
+
resetEndLocation(node) {
|
|
3961
|
+
var endLoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.lastTokEndLoc;
|
|
3962
|
+
super.resetEndLocation(node, endLoc);
|
|
3963
|
+
toESTreeLocation(node);
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3955
3966
|
};
|
|
3956
3967
|
|
|
3957
3968
|
class TokContext {
|
|
@@ -4180,6 +4191,12 @@
|
|
|
4180
4191
|
prefix,
|
|
4181
4192
|
startsExpr
|
|
4182
4193
|
}),
|
|
4194
|
+
doubleCaret: createToken("^^", {
|
|
4195
|
+
startsExpr
|
|
4196
|
+
}),
|
|
4197
|
+
doubleAt: createToken("@@", {
|
|
4198
|
+
startsExpr
|
|
4199
|
+
}),
|
|
4183
4200
|
pipeline: createBinop("|>", 0),
|
|
4184
4201
|
nullishCoalescing: createBinop("??", 1),
|
|
4185
4202
|
logicalOR: createBinop("||", 1),
|
|
@@ -4192,6 +4209,8 @@
|
|
|
4192
4209
|
gt: createBinop("</>/<=/>=", 7),
|
|
4193
4210
|
relational: createBinop("</>/<=/>=", 7),
|
|
4194
4211
|
bitShift: createBinop("<</>>/>>>", 8),
|
|
4212
|
+
bitShiftL: createBinop("<</>>/>>>", 8),
|
|
4213
|
+
bitShiftR: createBinop("<</>>/>>>", 8),
|
|
4195
4214
|
plusMin: createToken("+/-", {
|
|
4196
4215
|
beforeExpr,
|
|
4197
4216
|
binop: 9,
|
|
@@ -4445,19 +4464,19 @@
|
|
|
4445
4464
|
};
|
|
4446
4465
|
|
|
4447
4466
|
function tokenIsIdentifier(token) {
|
|
4448
|
-
return token >=
|
|
4467
|
+
return token >= 93 && token <= 128;
|
|
4449
4468
|
}
|
|
4450
4469
|
|
|
4451
4470
|
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
4452
|
-
return token <=
|
|
4471
|
+
return token <= 92;
|
|
4453
4472
|
}
|
|
4454
4473
|
|
|
4455
4474
|
function tokenIsKeywordOrIdentifier(token) {
|
|
4456
|
-
return token >=
|
|
4475
|
+
return token >= 58 && token <= 128;
|
|
4457
4476
|
}
|
|
4458
4477
|
|
|
4459
4478
|
function tokenIsLiteralPropertyName(token) {
|
|
4460
|
-
return token >=
|
|
4479
|
+
return token >= 58 && token <= 132;
|
|
4461
4480
|
}
|
|
4462
4481
|
|
|
4463
4482
|
function tokenComesBeforeExpression(token) {
|
|
@@ -4473,19 +4492,19 @@
|
|
|
4473
4492
|
}
|
|
4474
4493
|
|
|
4475
4494
|
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
4476
|
-
return token >=
|
|
4495
|
+
return token >= 125 && token <= 127;
|
|
4477
4496
|
}
|
|
4478
4497
|
|
|
4479
4498
|
function tokenIsLoop(token) {
|
|
4480
|
-
return token >=
|
|
4499
|
+
return token >= 90 && token <= 92;
|
|
4481
4500
|
}
|
|
4482
4501
|
|
|
4483
4502
|
function tokenIsKeyword(token) {
|
|
4484
|
-
return token >=
|
|
4503
|
+
return token >= 58 && token <= 92;
|
|
4485
4504
|
}
|
|
4486
4505
|
|
|
4487
4506
|
function tokenIsOperator(token) {
|
|
4488
|
-
return token >=
|
|
4507
|
+
return token >= 39 && token <= 59;
|
|
4489
4508
|
}
|
|
4490
4509
|
|
|
4491
4510
|
function tokenIsPostfix(token) {
|
|
@@ -4497,11 +4516,11 @@
|
|
|
4497
4516
|
}
|
|
4498
4517
|
|
|
4499
4518
|
function tokenIsTSTypeOperator(token) {
|
|
4500
|
-
return token >=
|
|
4519
|
+
return token >= 117 && token <= 119;
|
|
4501
4520
|
}
|
|
4502
4521
|
|
|
4503
4522
|
function tokenIsTSDeclarationStart(token) {
|
|
4504
|
-
return token >=
|
|
4523
|
+
return token >= 120 && token <= 126;
|
|
4505
4524
|
}
|
|
4506
4525
|
|
|
4507
4526
|
function tokenLabelName(token) {
|
|
@@ -4513,7 +4532,7 @@
|
|
|
4513
4532
|
}
|
|
4514
4533
|
|
|
4515
4534
|
function tokenIsRightAssociative(token) {
|
|
4516
|
-
return token ===
|
|
4535
|
+
return token === 57;
|
|
4517
4536
|
}
|
|
4518
4537
|
|
|
4519
4538
|
function tokenIsTemplate(token) {
|
|
@@ -4541,10 +4560,44 @@
|
|
|
4541
4560
|
}
|
|
4542
4561
|
};
|
|
4543
4562
|
|
|
4544
|
-
tokenTypes[
|
|
4563
|
+
tokenTypes[138].updateContext = context => {
|
|
4545
4564
|
context.push(types.j_expr, types.j_oTag);
|
|
4546
4565
|
};
|
|
4547
4566
|
}
|
|
4567
|
+
|
|
4568
|
+
class Position {
|
|
4569
|
+
constructor(line, col, index) {
|
|
4570
|
+
this.line = void 0;
|
|
4571
|
+
this.column = void 0;
|
|
4572
|
+
this.index = void 0;
|
|
4573
|
+
this.line = line;
|
|
4574
|
+
this.column = col;
|
|
4575
|
+
this.index = index;
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4580
|
+
class SourceLocation {
|
|
4581
|
+
constructor(start, end) {
|
|
4582
|
+
this.start = void 0;
|
|
4583
|
+
this.end = void 0;
|
|
4584
|
+
this.filename = void 0;
|
|
4585
|
+
this.identifierName = void 0;
|
|
4586
|
+
this.start = start;
|
|
4587
|
+
this.end = end;
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
function createPositionWithColumnOffset(position, columnOffset) {
|
|
4593
|
+
var {
|
|
4594
|
+
line,
|
|
4595
|
+
column,
|
|
4596
|
+
index
|
|
4597
|
+
} = position;
|
|
4598
|
+
return new Position(line, column + columnOffset, index + columnOffset);
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4548
4601
|
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
4549
4602
|
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
|
4550
4603
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
@@ -4623,8 +4676,8 @@
|
|
|
4623
4676
|
return keywords.has(word);
|
|
4624
4677
|
}
|
|
4625
4678
|
|
|
4626
|
-
function isIteratorStart(current, next) {
|
|
4627
|
-
return current === 64 && next === 64;
|
|
4679
|
+
function isIteratorStart(current, next, next2) {
|
|
4680
|
+
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
4628
4681
|
}
|
|
4629
4682
|
|
|
4630
4683
|
var reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
|
|
@@ -4978,7 +5031,7 @@
|
|
|
4978
5031
|
this.comments = [];
|
|
4979
5032
|
this.commentStack = [];
|
|
4980
5033
|
this.pos = 0;
|
|
4981
|
-
this.type =
|
|
5034
|
+
this.type = 135;
|
|
4982
5035
|
this.value = null;
|
|
4983
5036
|
this.start = 0;
|
|
4984
5037
|
this.end = 0;
|
|
@@ -5033,7 +5086,7 @@
|
|
|
5033
5086
|
return code >= 48 && code <= 57;
|
|
5034
5087
|
};
|
|
5035
5088
|
|
|
5036
|
-
var VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100]);
|
|
5089
|
+
var VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
5037
5090
|
var forbiddenNumericSeparatorSiblings = {
|
|
5038
5091
|
decBinOct: [46, 66, 69, 79, 95, 98, 101, 111],
|
|
5039
5092
|
hex: [46, 88, 95, 120]
|
|
@@ -5181,7 +5234,7 @@
|
|
|
5181
5234
|
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
|
|
5182
5235
|
|
|
5183
5236
|
if (this.state.pos >= this.length) {
|
|
5184
|
-
this.finishToken(
|
|
5237
|
+
this.finishToken(135);
|
|
5185
5238
|
return;
|
|
5186
5239
|
}
|
|
5187
5240
|
|
|
@@ -5404,10 +5457,10 @@
|
|
|
5404
5457
|
}
|
|
5405
5458
|
} else if (isIdentifierStart(next)) {
|
|
5406
5459
|
++this.state.pos;
|
|
5407
|
-
this.finishToken(
|
|
5460
|
+
this.finishToken(134, this.readWord1(next));
|
|
5408
5461
|
} else if (next === 92) {
|
|
5409
5462
|
++this.state.pos;
|
|
5410
|
-
this.finishToken(
|
|
5463
|
+
this.finishToken(134, this.readWord1());
|
|
5411
5464
|
} else {
|
|
5412
5465
|
this.finishOp(27, 1);
|
|
5413
5466
|
}
|
|
@@ -5436,7 +5489,7 @@
|
|
|
5436
5489
|
if (next === 61) {
|
|
5437
5490
|
this.finishOp(31, 2);
|
|
5438
5491
|
} else {
|
|
5439
|
-
this.finishOp(
|
|
5492
|
+
this.finishOp(56, 1);
|
|
5440
5493
|
}
|
|
5441
5494
|
}
|
|
5442
5495
|
|
|
@@ -5457,14 +5510,14 @@
|
|
|
5457
5510
|
}
|
|
5458
5511
|
|
|
5459
5512
|
readToken_mult_modulo(code) {
|
|
5460
|
-
var type = code === 42 ?
|
|
5513
|
+
var type = code === 42 ? 55 : 54;
|
|
5461
5514
|
var width = 1;
|
|
5462
5515
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5463
5516
|
|
|
5464
5517
|
if (code === 42 && next === 42) {
|
|
5465
5518
|
width++;
|
|
5466
5519
|
next = this.input.charCodeAt(this.state.pos + 2);
|
|
5467
|
-
type =
|
|
5520
|
+
type = 57;
|
|
5468
5521
|
}
|
|
5469
5522
|
|
|
5470
5523
|
if (next === 61 && !this.state.inType) {
|
|
@@ -5482,7 +5535,7 @@
|
|
|
5482
5535
|
if (this.input.charCodeAt(this.state.pos + 2) === 61) {
|
|
5483
5536
|
this.finishOp(30, 3);
|
|
5484
5537
|
} else {
|
|
5485
|
-
this.finishOp(code === 124 ?
|
|
5538
|
+
this.finishOp(code === 124 ? 41 : 42, 2);
|
|
5486
5539
|
}
|
|
5487
5540
|
|
|
5488
5541
|
return;
|
|
@@ -5490,7 +5543,7 @@
|
|
|
5490
5543
|
|
|
5491
5544
|
if (code === 124) {
|
|
5492
5545
|
if (next === 62) {
|
|
5493
|
-
this.finishOp(
|
|
5546
|
+
this.finishOp(39, 2);
|
|
5494
5547
|
return;
|
|
5495
5548
|
}
|
|
5496
5549
|
|
|
@@ -5524,7 +5577,7 @@
|
|
|
5524
5577
|
return;
|
|
5525
5578
|
}
|
|
5526
5579
|
|
|
5527
|
-
this.finishOp(code === 124 ?
|
|
5580
|
+
this.finishOp(code === 124 ? 43 : 45, 1);
|
|
5528
5581
|
}
|
|
5529
5582
|
|
|
5530
5583
|
readToken_caret() {
|
|
@@ -5532,8 +5585,31 @@
|
|
|
5532
5585
|
|
|
5533
5586
|
if (next === 61 && !this.state.inType) {
|
|
5534
5587
|
this.finishOp(32, 2);
|
|
5588
|
+
} else if (next === 94 && this.hasPlugin(["pipelineOperator", {
|
|
5589
|
+
proposal: "hack",
|
|
5590
|
+
topicToken: "^^"
|
|
5591
|
+
}])) {
|
|
5592
|
+
this.finishOp(37, 2);
|
|
5593
|
+
var lookaheadCh = this.input.codePointAt(this.state.pos);
|
|
5594
|
+
|
|
5595
|
+
if (lookaheadCh === 94) {
|
|
5596
|
+
throw this.unexpected();
|
|
5597
|
+
}
|
|
5535
5598
|
} else {
|
|
5536
|
-
this.finishOp(
|
|
5599
|
+
this.finishOp(44, 1);
|
|
5600
|
+
}
|
|
5601
|
+
}
|
|
5602
|
+
|
|
5603
|
+
readToken_atSign() {
|
|
5604
|
+
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5605
|
+
|
|
5606
|
+
if (next === 64 && this.hasPlugin(["pipelineOperator", {
|
|
5607
|
+
proposal: "hack",
|
|
5608
|
+
topicToken: "@@"
|
|
5609
|
+
}])) {
|
|
5610
|
+
this.finishOp(38, 2);
|
|
5611
|
+
} else {
|
|
5612
|
+
this.finishOp(26, 1);
|
|
5537
5613
|
}
|
|
5538
5614
|
}
|
|
5539
5615
|
|
|
@@ -5548,7 +5624,7 @@
|
|
|
5548
5624
|
if (next === 61) {
|
|
5549
5625
|
this.finishOp(30, 2);
|
|
5550
5626
|
} else {
|
|
5551
|
-
this.finishOp(
|
|
5627
|
+
this.finishOp(53, 1);
|
|
5552
5628
|
}
|
|
5553
5629
|
}
|
|
5554
5630
|
|
|
@@ -5564,16 +5640,16 @@
|
|
|
5564
5640
|
return;
|
|
5565
5641
|
}
|
|
5566
5642
|
|
|
5567
|
-
this.finishOp(
|
|
5643
|
+
this.finishOp(51, 2);
|
|
5568
5644
|
return;
|
|
5569
5645
|
}
|
|
5570
5646
|
|
|
5571
5647
|
if (next === 61) {
|
|
5572
|
-
this.finishOp(
|
|
5648
|
+
this.finishOp(49, 2);
|
|
5573
5649
|
return;
|
|
5574
5650
|
}
|
|
5575
5651
|
|
|
5576
|
-
this.finishOp(
|
|
5652
|
+
this.finishOp(47, 1);
|
|
5577
5653
|
}
|
|
5578
5654
|
|
|
5579
5655
|
readToken_gt() {
|
|
@@ -5590,23 +5666,23 @@
|
|
|
5590
5666
|
return;
|
|
5591
5667
|
}
|
|
5592
5668
|
|
|
5593
|
-
this.finishOp(
|
|
5669
|
+
this.finishOp(52, size);
|
|
5594
5670
|
return;
|
|
5595
5671
|
}
|
|
5596
5672
|
|
|
5597
5673
|
if (next === 61) {
|
|
5598
|
-
this.finishOp(
|
|
5674
|
+
this.finishOp(49, 2);
|
|
5599
5675
|
return;
|
|
5600
5676
|
}
|
|
5601
5677
|
|
|
5602
|
-
this.finishOp(
|
|
5678
|
+
this.finishOp(48, 1);
|
|
5603
5679
|
}
|
|
5604
5680
|
|
|
5605
5681
|
readToken_eq_excl(code) {
|
|
5606
5682
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5607
5683
|
|
|
5608
5684
|
if (next === 61) {
|
|
5609
|
-
this.finishOp(
|
|
5685
|
+
this.finishOp(46, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
|
|
5610
5686
|
return;
|
|
5611
5687
|
}
|
|
5612
5688
|
|
|
@@ -5627,7 +5703,7 @@
|
|
|
5627
5703
|
if (next2 === 61) {
|
|
5628
5704
|
this.finishOp(30, 3);
|
|
5629
5705
|
} else {
|
|
5630
|
-
this.finishOp(
|
|
5706
|
+
this.finishOp(40, 2);
|
|
5631
5707
|
}
|
|
5632
5708
|
} else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
|
|
5633
5709
|
this.state.pos += 2;
|
|
@@ -5804,8 +5880,7 @@
|
|
|
5804
5880
|
return;
|
|
5805
5881
|
|
|
5806
5882
|
case 64:
|
|
5807
|
-
|
|
5808
|
-
this.finishToken(26);
|
|
5883
|
+
this.readToken_atSign();
|
|
5809
5884
|
return;
|
|
5810
5885
|
|
|
5811
5886
|
case 35:
|
|
@@ -5877,19 +5952,37 @@
|
|
|
5877
5952
|
++pos;
|
|
5878
5953
|
var mods = "";
|
|
5879
5954
|
|
|
5955
|
+
var nextPos = () => createPositionWithColumnOffset(startLoc, pos + 2 - start);
|
|
5956
|
+
|
|
5880
5957
|
while (pos < this.length) {
|
|
5881
5958
|
var cp = this.codePointAtPos(pos);
|
|
5882
5959
|
var char = String.fromCharCode(cp);
|
|
5883
5960
|
|
|
5884
5961
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
5962
|
+
if (cp === 118) {
|
|
5963
|
+
this.expectPlugin("regexpUnicodeSets", nextPos());
|
|
5964
|
+
|
|
5965
|
+
if (mods.includes("u")) {
|
|
5966
|
+
this.raise(ErrorMessages.IncompatibleRegExpUVFlags, {
|
|
5967
|
+
at: nextPos()
|
|
5968
|
+
});
|
|
5969
|
+
}
|
|
5970
|
+
} else if (cp === 117) {
|
|
5971
|
+
if (mods.includes("v")) {
|
|
5972
|
+
this.raise(ErrorMessages.IncompatibleRegExpUVFlags, {
|
|
5973
|
+
at: nextPos()
|
|
5974
|
+
});
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
|
|
5885
5978
|
if (mods.includes(char)) {
|
|
5886
5979
|
this.raise(ErrorMessages.DuplicateRegExpFlags, {
|
|
5887
|
-
at:
|
|
5980
|
+
at: nextPos()
|
|
5888
5981
|
});
|
|
5889
5982
|
}
|
|
5890
5983
|
} else if (isIdentifierChar(cp) || cp === 92) {
|
|
5891
5984
|
this.raise(ErrorMessages.MalformedRegExpFlags, {
|
|
5892
|
-
at:
|
|
5985
|
+
at: nextPos()
|
|
5893
5986
|
});
|
|
5894
5987
|
} else {
|
|
5895
5988
|
break;
|
|
@@ -5900,7 +5993,7 @@
|
|
|
5900
5993
|
}
|
|
5901
5994
|
|
|
5902
5995
|
this.state.pos = pos;
|
|
5903
|
-
this.finishToken(
|
|
5996
|
+
this.finishToken(133, {
|
|
5904
5997
|
pattern: content,
|
|
5905
5998
|
flags: mods
|
|
5906
5999
|
});
|
|
@@ -6007,12 +6100,12 @@
|
|
|
6007
6100
|
}
|
|
6008
6101
|
|
|
6009
6102
|
if (isBigInt) {
|
|
6010
|
-
var str = this.input.slice(
|
|
6011
|
-
this.finishToken(
|
|
6103
|
+
var str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
|
|
6104
|
+
this.finishToken(131, str);
|
|
6012
6105
|
return;
|
|
6013
6106
|
}
|
|
6014
6107
|
|
|
6015
|
-
this.finishToken(
|
|
6108
|
+
this.finishToken(130, val);
|
|
6016
6109
|
}
|
|
6017
6110
|
|
|
6018
6111
|
readNumber(startsWithDot) {
|
|
@@ -6109,17 +6202,17 @@
|
|
|
6109
6202
|
var str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
6110
6203
|
|
|
6111
6204
|
if (isBigInt) {
|
|
6112
|
-
this.finishToken(
|
|
6205
|
+
this.finishToken(131, str);
|
|
6113
6206
|
return;
|
|
6114
6207
|
}
|
|
6115
6208
|
|
|
6116
6209
|
if (isDecimal) {
|
|
6117
|
-
this.finishToken(
|
|
6210
|
+
this.finishToken(132, str);
|
|
6118
6211
|
return;
|
|
6119
6212
|
}
|
|
6120
6213
|
|
|
6121
6214
|
var val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
6122
|
-
this.finishToken(
|
|
6215
|
+
this.finishToken(130, val);
|
|
6123
6216
|
}
|
|
6124
6217
|
|
|
6125
6218
|
readCodePoint(throwOnInvalid) {
|
|
@@ -6179,7 +6272,7 @@
|
|
|
6179
6272
|
}
|
|
6180
6273
|
|
|
6181
6274
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
6182
|
-
this.finishToken(
|
|
6275
|
+
this.finishToken(129, out);
|
|
6183
6276
|
}
|
|
6184
6277
|
|
|
6185
6278
|
readTemplateContinuation() {
|
|
@@ -6260,14 +6353,12 @@
|
|
|
6260
6353
|
}
|
|
6261
6354
|
|
|
6262
6355
|
recordStrictModeErrors(message, loc) {
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
if (this.state.strict && !this.state.strictErrors.has(index)) {
|
|
6356
|
+
if (this.state.strict && !this.state.strictErrors.has(loc.index)) {
|
|
6266
6357
|
this.raise(message, {
|
|
6267
6358
|
at: loc
|
|
6268
6359
|
});
|
|
6269
6360
|
} else {
|
|
6270
|
-
this.state.strictErrors.set(index, {
|
|
6361
|
+
this.state.strictErrors.set(loc.index, {
|
|
6271
6362
|
loc,
|
|
6272
6363
|
message
|
|
6273
6364
|
});
|
|
@@ -6372,7 +6463,7 @@
|
|
|
6372
6463
|
at: codeLoc
|
|
6373
6464
|
});
|
|
6374
6465
|
} else {
|
|
6375
|
-
this.state.pos =
|
|
6466
|
+
this.state.pos = codeLoc.index - 1;
|
|
6376
6467
|
}
|
|
6377
6468
|
}
|
|
6378
6469
|
|
|
@@ -6437,7 +6528,7 @@
|
|
|
6437
6528
|
if (type !== undefined) {
|
|
6438
6529
|
this.finishToken(type, tokenLabelName(type));
|
|
6439
6530
|
} else {
|
|
6440
|
-
this.finishToken(
|
|
6531
|
+
this.finishToken(128, word);
|
|
6441
6532
|
}
|
|
6442
6533
|
}
|
|
6443
6534
|
|
|
@@ -6578,14 +6669,14 @@
|
|
|
6578
6669
|
}
|
|
6579
6670
|
|
|
6580
6671
|
recordDeclarationError(message, loc) {
|
|
6581
|
-
this.errors.set(
|
|
6672
|
+
this.errors.set(loc.index, {
|
|
6582
6673
|
message,
|
|
6583
6674
|
loc
|
|
6584
6675
|
});
|
|
6585
6676
|
}
|
|
6586
6677
|
|
|
6587
6678
|
clearDeclarationError(loc) {
|
|
6588
|
-
this.errors.delete(
|
|
6679
|
+
this.errors.delete(loc.index);
|
|
6589
6680
|
}
|
|
6590
6681
|
|
|
6591
6682
|
iterateErrors(iterator) {
|
|
@@ -6808,11 +6899,11 @@
|
|
|
6808
6899
|
}
|
|
6809
6900
|
|
|
6810
6901
|
canInsertSemicolon() {
|
|
6811
|
-
return this.match(
|
|
6902
|
+
return this.match(135) || this.match(8) || this.hasPrecedingLineBreak();
|
|
6812
6903
|
}
|
|
6813
6904
|
|
|
6814
6905
|
hasPrecedingLineBreak() {
|
|
6815
|
-
return lineBreak.test(this.input.slice(
|
|
6906
|
+
return lineBreak.test(this.input.slice(this.state.lastTokEndLoc.index, this.state.start));
|
|
6816
6907
|
}
|
|
6817
6908
|
|
|
6818
6909
|
hasFollowingLineBreak() {
|
|
@@ -6839,7 +6930,7 @@
|
|
|
6839
6930
|
assertNoSpace() {
|
|
6840
6931
|
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "Unexpected space.";
|
|
6841
6932
|
|
|
6842
|
-
if (this.state.start >
|
|
6933
|
+
if (this.state.start > this.state.lastTokEndLoc.index) {
|
|
6843
6934
|
this.raise({
|
|
6844
6935
|
code: ErrorCodes.SyntaxError,
|
|
6845
6936
|
reasonCode: "UnexpectedSpace",
|
|
@@ -6954,9 +7045,10 @@
|
|
|
6954
7045
|
var {
|
|
6955
7046
|
shorthandAssignLoc,
|
|
6956
7047
|
doubleProtoLoc,
|
|
7048
|
+
privateKeyLoc,
|
|
6957
7049
|
optionalParametersLoc
|
|
6958
7050
|
} = refExpressionErrors;
|
|
6959
|
-
var hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc;
|
|
7051
|
+
var hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
|
|
6960
7052
|
|
|
6961
7053
|
if (!andThrow) {
|
|
6962
7054
|
return hasErrors;
|
|
@@ -6974,6 +7066,12 @@
|
|
|
6974
7066
|
});
|
|
6975
7067
|
}
|
|
6976
7068
|
|
|
7069
|
+
if (privateKeyLoc != null) {
|
|
7070
|
+
this.raise(ErrorMessages.UnexpectedPrivateField, {
|
|
7071
|
+
at: privateKeyLoc
|
|
7072
|
+
});
|
|
7073
|
+
}
|
|
7074
|
+
|
|
6977
7075
|
if (optionalParametersLoc != null) {
|
|
6978
7076
|
this.unexpected(optionalParametersLoc);
|
|
6979
7077
|
}
|
|
@@ -7046,12 +7144,23 @@
|
|
|
7046
7144
|
this.prodParam.enter(paramFlags);
|
|
7047
7145
|
}
|
|
7048
7146
|
|
|
7147
|
+
checkDestructuringPrivate(refExpressionErrors) {
|
|
7148
|
+
var {
|
|
7149
|
+
privateKeyLoc
|
|
7150
|
+
} = refExpressionErrors;
|
|
7151
|
+
|
|
7152
|
+
if (privateKeyLoc !== null) {
|
|
7153
|
+
this.expectPlugin("destructuringPrivate", privateKeyLoc);
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
|
|
7049
7157
|
}
|
|
7050
7158
|
|
|
7051
7159
|
class ExpressionErrors {
|
|
7052
7160
|
constructor() {
|
|
7053
7161
|
this.shorthandAssignLoc = null;
|
|
7054
7162
|
this.doubleProtoLoc = null;
|
|
7163
|
+
this.privateKeyLoc = null;
|
|
7055
7164
|
this.optionalParametersLoc = null;
|
|
7056
7165
|
}
|
|
7057
7166
|
|
|
@@ -7167,9 +7276,9 @@
|
|
|
7167
7276
|
|
|
7168
7277
|
finishNodeAt(node, type, endLoc) {
|
|
7169
7278
|
node.type = type;
|
|
7170
|
-
node.end =
|
|
7279
|
+
node.end = endLoc.index;
|
|
7171
7280
|
node.loc.end = endLoc;
|
|
7172
|
-
if (this.options.ranges) node.range[1] =
|
|
7281
|
+
if (this.options.ranges) node.range[1] = endLoc.index;
|
|
7173
7282
|
if (this.options.attachComment) this.processComment(node);
|
|
7174
7283
|
return node;
|
|
7175
7284
|
}
|
|
@@ -7182,9 +7291,9 @@
|
|
|
7182
7291
|
|
|
7183
7292
|
resetEndLocation(node) {
|
|
7184
7293
|
var endLoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.lastTokEndLoc;
|
|
7185
|
-
node.end =
|
|
7294
|
+
node.end = endLoc.index;
|
|
7186
7295
|
node.loc.end = endLoc;
|
|
7187
|
-
if (this.options.ranges) node.range[1] =
|
|
7296
|
+
if (this.options.ranges) node.range[1] = endLoc.index;
|
|
7188
7297
|
}
|
|
7189
7298
|
|
|
7190
7299
|
resetStartLocationFromNode(node, locationNode) {
|
|
@@ -7253,7 +7362,7 @@
|
|
|
7253
7362
|
}
|
|
7254
7363
|
|
|
7255
7364
|
function isMaybeDefaultImport(type) {
|
|
7256
|
-
return tokenIsKeywordOrIdentifier(type) && type !==
|
|
7365
|
+
return tokenIsKeywordOrIdentifier(type) && type !== 97;
|
|
7257
7366
|
}
|
|
7258
7367
|
|
|
7259
7368
|
var exportSuggestions = {
|
|
@@ -7295,7 +7404,7 @@
|
|
|
7295
7404
|
}
|
|
7296
7405
|
|
|
7297
7406
|
finishToken(type, val) {
|
|
7298
|
-
if (type !==
|
|
7407
|
+
if (type !== 129 && type !== 13 && type !== 28) {
|
|
7299
7408
|
if (this.flowPragma === undefined) {
|
|
7300
7409
|
this.flowPragma = null;
|
|
7301
7410
|
}
|
|
@@ -7332,9 +7441,9 @@
|
|
|
7332
7441
|
var node = this.startNode();
|
|
7333
7442
|
var moduloLoc = this.state.startLoc;
|
|
7334
7443
|
this.next();
|
|
7335
|
-
this.expectContextual(
|
|
7444
|
+
this.expectContextual(107);
|
|
7336
7445
|
|
|
7337
|
-
if (this.state.lastTokStart >
|
|
7446
|
+
if (this.state.lastTokStart > moduloLoc.index + 1) {
|
|
7338
7447
|
this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, {
|
|
7339
7448
|
at: moduloLoc
|
|
7340
7449
|
});
|
|
@@ -7356,14 +7465,14 @@
|
|
|
7356
7465
|
var type = null;
|
|
7357
7466
|
var predicate = null;
|
|
7358
7467
|
|
|
7359
|
-
if (this.match(
|
|
7468
|
+
if (this.match(54)) {
|
|
7360
7469
|
this.state.inType = oldInType;
|
|
7361
7470
|
predicate = this.flowParsePredicate();
|
|
7362
7471
|
} else {
|
|
7363
7472
|
type = this.flowParseType();
|
|
7364
7473
|
this.state.inType = oldInType;
|
|
7365
7474
|
|
|
7366
|
-
if (this.match(
|
|
7475
|
+
if (this.match(54)) {
|
|
7367
7476
|
predicate = this.flowParsePredicate();
|
|
7368
7477
|
}
|
|
7369
7478
|
}
|
|
@@ -7383,7 +7492,7 @@
|
|
|
7383
7492
|
var typeNode = this.startNode();
|
|
7384
7493
|
var typeContainer = this.startNode();
|
|
7385
7494
|
|
|
7386
|
-
if (this.match(
|
|
7495
|
+
if (this.match(47)) {
|
|
7387
7496
|
typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7388
7497
|
} else {
|
|
7389
7498
|
typeNode.typeParameters = null;
|
|
@@ -7405,13 +7514,13 @@
|
|
|
7405
7514
|
}
|
|
7406
7515
|
|
|
7407
7516
|
flowParseDeclare(node, insideModule) {
|
|
7408
|
-
if (this.match(
|
|
7517
|
+
if (this.match(80)) {
|
|
7409
7518
|
return this.flowParseDeclareClass(node);
|
|
7410
|
-
} else if (this.match(
|
|
7519
|
+
} else if (this.match(68)) {
|
|
7411
7520
|
return this.flowParseDeclareFunction(node);
|
|
7412
|
-
} else if (this.match(
|
|
7521
|
+
} else if (this.match(74)) {
|
|
7413
7522
|
return this.flowParseDeclareVariable(node);
|
|
7414
|
-
} else if (this.eatContextual(
|
|
7523
|
+
} else if (this.eatContextual(123)) {
|
|
7415
7524
|
if (this.match(16)) {
|
|
7416
7525
|
return this.flowParseDeclareModuleExports(node);
|
|
7417
7526
|
} else {
|
|
@@ -7423,13 +7532,13 @@
|
|
|
7423
7532
|
|
|
7424
7533
|
return this.flowParseDeclareModule(node);
|
|
7425
7534
|
}
|
|
7426
|
-
} else if (this.isContextual(
|
|
7535
|
+
} else if (this.isContextual(126)) {
|
|
7427
7536
|
return this.flowParseDeclareTypeAlias(node);
|
|
7428
|
-
} else if (this.isContextual(
|
|
7537
|
+
} else if (this.isContextual(127)) {
|
|
7429
7538
|
return this.flowParseDeclareOpaqueType(node);
|
|
7430
|
-
} else if (this.isContextual(
|
|
7539
|
+
} else if (this.isContextual(125)) {
|
|
7431
7540
|
return this.flowParseDeclareInterface(node);
|
|
7432
|
-
} else if (this.match(
|
|
7541
|
+
} else if (this.match(82)) {
|
|
7433
7542
|
return this.flowParseDeclareExportDeclaration(node, insideModule);
|
|
7434
7543
|
} else {
|
|
7435
7544
|
throw this.unexpected();
|
|
@@ -7447,7 +7556,7 @@
|
|
|
7447
7556
|
flowParseDeclareModule(node) {
|
|
7448
7557
|
this.scope.enter(SCOPE_OTHER);
|
|
7449
7558
|
|
|
7450
|
-
if (this.match(
|
|
7559
|
+
if (this.match(129)) {
|
|
7451
7560
|
node.id = this.parseExprAtom();
|
|
7452
7561
|
} else {
|
|
7453
7562
|
node.id = this.parseIdentifier();
|
|
@@ -7460,10 +7569,10 @@
|
|
|
7460
7569
|
while (!this.match(8)) {
|
|
7461
7570
|
var _bodyNode = this.startNode();
|
|
7462
7571
|
|
|
7463
|
-
if (this.match(
|
|
7572
|
+
if (this.match(83)) {
|
|
7464
7573
|
this.next();
|
|
7465
7574
|
|
|
7466
|
-
if (!this.isContextual(
|
|
7575
|
+
if (!this.isContextual(126) && !this.match(87)) {
|
|
7467
7576
|
this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, {
|
|
7468
7577
|
at: this.state.lastTokStartLoc
|
|
7469
7578
|
});
|
|
@@ -7471,7 +7580,7 @@
|
|
|
7471
7580
|
|
|
7472
7581
|
this.parseImport(_bodyNode);
|
|
7473
7582
|
} else {
|
|
7474
|
-
this.expectContextual(
|
|
7583
|
+
this.expectContextual(121, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
7475
7584
|
_bodyNode = this.flowParseDeclare(_bodyNode, true);
|
|
7476
7585
|
}
|
|
7477
7586
|
|
|
@@ -7514,10 +7623,10 @@
|
|
|
7514
7623
|
}
|
|
7515
7624
|
|
|
7516
7625
|
flowParseDeclareExportDeclaration(node, insideModule) {
|
|
7517
|
-
this.expect(
|
|
7626
|
+
this.expect(82);
|
|
7518
7627
|
|
|
7519
|
-
if (this.eat(
|
|
7520
|
-
if (this.match(
|
|
7628
|
+
if (this.eat(65)) {
|
|
7629
|
+
if (this.match(68) || this.match(80)) {
|
|
7521
7630
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
7522
7631
|
} else {
|
|
7523
7632
|
node.declaration = this.flowParseType();
|
|
@@ -7527,7 +7636,7 @@
|
|
|
7527
7636
|
node.default = true;
|
|
7528
7637
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
7529
7638
|
} else {
|
|
7530
|
-
if (this.match(
|
|
7639
|
+
if (this.match(75) || this.isLet() || (this.isContextual(126) || this.isContextual(125)) && !insideModule) {
|
|
7531
7640
|
var label = this.state.value;
|
|
7532
7641
|
var suggestion = exportSuggestions[label];
|
|
7533
7642
|
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, {
|
|
@@ -7535,11 +7644,11 @@
|
|
|
7535
7644
|
}, label, suggestion);
|
|
7536
7645
|
}
|
|
7537
7646
|
|
|
7538
|
-
if (this.match(
|
|
7647
|
+
if (this.match(74) || this.match(68) || this.match(80) || this.isContextual(127)) {
|
|
7539
7648
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
7540
7649
|
node.default = false;
|
|
7541
7650
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
7542
|
-
} else if (this.match(
|
|
7651
|
+
} else if (this.match(55) || this.match(5) || this.isContextual(125) || this.isContextual(126) || this.isContextual(127)) {
|
|
7543
7652
|
node = this.parseExport(node);
|
|
7544
7653
|
|
|
7545
7654
|
if (node.type === "ExportNamedDeclaration") {
|
|
@@ -7558,7 +7667,7 @@
|
|
|
7558
7667
|
|
|
7559
7668
|
flowParseDeclareModuleExports(node) {
|
|
7560
7669
|
this.next();
|
|
7561
|
-
this.expectContextual(
|
|
7670
|
+
this.expectContextual(108);
|
|
7562
7671
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
7563
7672
|
this.semicolon();
|
|
7564
7673
|
return this.finishNode(node, "DeclareModuleExports");
|
|
@@ -7589,7 +7698,7 @@
|
|
|
7589
7698
|
node.id = this.flowParseRestrictedIdentifier(!isClass, true);
|
|
7590
7699
|
this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.loc.start);
|
|
7591
7700
|
|
|
7592
|
-
if (this.match(
|
|
7701
|
+
if (this.match(47)) {
|
|
7593
7702
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7594
7703
|
} else {
|
|
7595
7704
|
node.typeParameters = null;
|
|
@@ -7599,13 +7708,13 @@
|
|
|
7599
7708
|
node.implements = [];
|
|
7600
7709
|
node.mixins = [];
|
|
7601
7710
|
|
|
7602
|
-
if (this.eat(
|
|
7711
|
+
if (this.eat(81)) {
|
|
7603
7712
|
do {
|
|
7604
7713
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
7605
7714
|
} while (!isClass && this.eat(12));
|
|
7606
7715
|
}
|
|
7607
7716
|
|
|
7608
|
-
if (this.isContextual(
|
|
7717
|
+
if (this.isContextual(114)) {
|
|
7609
7718
|
this.next();
|
|
7610
7719
|
|
|
7611
7720
|
do {
|
|
@@ -7613,7 +7722,7 @@
|
|
|
7613
7722
|
} while (this.eat(12));
|
|
7614
7723
|
}
|
|
7615
7724
|
|
|
7616
|
-
if (this.isContextual(
|
|
7725
|
+
if (this.isContextual(110)) {
|
|
7617
7726
|
this.next();
|
|
7618
7727
|
|
|
7619
7728
|
do {
|
|
@@ -7634,7 +7743,7 @@
|
|
|
7634
7743
|
var node = this.startNode();
|
|
7635
7744
|
node.id = this.flowParseQualifiedTypeIdentifier();
|
|
7636
7745
|
|
|
7637
|
-
if (this.match(
|
|
7746
|
+
if (this.match(47)) {
|
|
7638
7747
|
node.typeParameters = this.flowParseTypeParameterInstantiation();
|
|
7639
7748
|
} else {
|
|
7640
7749
|
node.typeParameters = null;
|
|
@@ -7672,7 +7781,7 @@
|
|
|
7672
7781
|
node.id = this.flowParseRestrictedIdentifier(false, true);
|
|
7673
7782
|
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.loc.start);
|
|
7674
7783
|
|
|
7675
|
-
if (this.match(
|
|
7784
|
+
if (this.match(47)) {
|
|
7676
7785
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7677
7786
|
} else {
|
|
7678
7787
|
node.typeParameters = null;
|
|
@@ -7684,11 +7793,11 @@
|
|
|
7684
7793
|
}
|
|
7685
7794
|
|
|
7686
7795
|
flowParseOpaqueType(node, declare) {
|
|
7687
|
-
this.expectContextual(
|
|
7796
|
+
this.expectContextual(126);
|
|
7688
7797
|
node.id = this.flowParseRestrictedIdentifier(true, true);
|
|
7689
7798
|
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.loc.start);
|
|
7690
7799
|
|
|
7691
|
-
if (this.match(
|
|
7800
|
+
if (this.match(47)) {
|
|
7692
7801
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7693
7802
|
} else {
|
|
7694
7803
|
node.typeParameters = null;
|
|
@@ -7740,7 +7849,7 @@
|
|
|
7740
7849
|
node.params = [];
|
|
7741
7850
|
this.state.inType = true;
|
|
7742
7851
|
|
|
7743
|
-
if (this.match(
|
|
7852
|
+
if (this.match(47) || this.match(138)) {
|
|
7744
7853
|
this.next();
|
|
7745
7854
|
} else {
|
|
7746
7855
|
this.unexpected();
|
|
@@ -7756,12 +7865,12 @@
|
|
|
7756
7865
|
defaultRequired = true;
|
|
7757
7866
|
}
|
|
7758
7867
|
|
|
7759
|
-
if (!this.match(
|
|
7868
|
+
if (!this.match(48)) {
|
|
7760
7869
|
this.expect(12);
|
|
7761
7870
|
}
|
|
7762
|
-
} while (!this.match(
|
|
7871
|
+
} while (!this.match(48));
|
|
7763
7872
|
|
|
7764
|
-
this.expect(
|
|
7873
|
+
this.expect(48);
|
|
7765
7874
|
this.state.inType = oldInType;
|
|
7766
7875
|
return this.finishNode(node, "TypeParameterDeclaration");
|
|
7767
7876
|
}
|
|
@@ -7771,20 +7880,20 @@
|
|
|
7771
7880
|
var oldInType = this.state.inType;
|
|
7772
7881
|
node.params = [];
|
|
7773
7882
|
this.state.inType = true;
|
|
7774
|
-
this.expect(
|
|
7883
|
+
this.expect(47);
|
|
7775
7884
|
var oldNoAnonFunctionType = this.state.noAnonFunctionType;
|
|
7776
7885
|
this.state.noAnonFunctionType = false;
|
|
7777
7886
|
|
|
7778
|
-
while (!this.match(
|
|
7887
|
+
while (!this.match(48)) {
|
|
7779
7888
|
node.params.push(this.flowParseType());
|
|
7780
7889
|
|
|
7781
|
-
if (!this.match(
|
|
7890
|
+
if (!this.match(48)) {
|
|
7782
7891
|
this.expect(12);
|
|
7783
7892
|
}
|
|
7784
7893
|
}
|
|
7785
7894
|
|
|
7786
7895
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
7787
|
-
this.expect(
|
|
7896
|
+
this.expect(48);
|
|
7788
7897
|
this.state.inType = oldInType;
|
|
7789
7898
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
7790
7899
|
}
|
|
@@ -7794,27 +7903,27 @@
|
|
|
7794
7903
|
var oldInType = this.state.inType;
|
|
7795
7904
|
node.params = [];
|
|
7796
7905
|
this.state.inType = true;
|
|
7797
|
-
this.expect(
|
|
7906
|
+
this.expect(47);
|
|
7798
7907
|
|
|
7799
|
-
while (!this.match(
|
|
7908
|
+
while (!this.match(48)) {
|
|
7800
7909
|
node.params.push(this.flowParseTypeOrImplicitInstantiation());
|
|
7801
7910
|
|
|
7802
|
-
if (!this.match(
|
|
7911
|
+
if (!this.match(48)) {
|
|
7803
7912
|
this.expect(12);
|
|
7804
7913
|
}
|
|
7805
7914
|
}
|
|
7806
7915
|
|
|
7807
|
-
this.expect(
|
|
7916
|
+
this.expect(48);
|
|
7808
7917
|
this.state.inType = oldInType;
|
|
7809
7918
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
7810
7919
|
}
|
|
7811
7920
|
|
|
7812
7921
|
flowParseInterfaceType() {
|
|
7813
7922
|
var node = this.startNode();
|
|
7814
|
-
this.expectContextual(
|
|
7923
|
+
this.expectContextual(125);
|
|
7815
7924
|
node.extends = [];
|
|
7816
7925
|
|
|
7817
|
-
if (this.eat(
|
|
7926
|
+
if (this.eat(81)) {
|
|
7818
7927
|
do {
|
|
7819
7928
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
7820
7929
|
} while (this.eat(12));
|
|
@@ -7831,7 +7940,7 @@
|
|
|
7831
7940
|
}
|
|
7832
7941
|
|
|
7833
7942
|
flowParseObjectPropertyKey() {
|
|
7834
|
-
return this.match(
|
|
7943
|
+
return this.match(130) || this.match(129) ? this.parseExprAtom() : this.parseIdentifier(true);
|
|
7835
7944
|
}
|
|
7836
7945
|
|
|
7837
7946
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
@@ -7857,7 +7966,7 @@
|
|
|
7857
7966
|
this.expect(3);
|
|
7858
7967
|
this.expect(3);
|
|
7859
7968
|
|
|
7860
|
-
if (this.match(
|
|
7969
|
+
if (this.match(47) || this.match(10)) {
|
|
7861
7970
|
node.method = true;
|
|
7862
7971
|
node.optional = false;
|
|
7863
7972
|
node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
|
|
@@ -7880,13 +7989,13 @@
|
|
|
7880
7989
|
node.typeParameters = null;
|
|
7881
7990
|
node.this = null;
|
|
7882
7991
|
|
|
7883
|
-
if (this.match(
|
|
7992
|
+
if (this.match(47)) {
|
|
7884
7993
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7885
7994
|
}
|
|
7886
7995
|
|
|
7887
7996
|
this.expect(10);
|
|
7888
7997
|
|
|
7889
|
-
if (this.match(
|
|
7998
|
+
if (this.match(78)) {
|
|
7890
7999
|
node.this = this.flowParseFunctionTypeParam(true);
|
|
7891
8000
|
node.this.name = null;
|
|
7892
8001
|
|
|
@@ -7956,7 +8065,7 @@
|
|
|
7956
8065
|
var inexactStartLoc = null;
|
|
7957
8066
|
var node = this.startNode();
|
|
7958
8067
|
|
|
7959
|
-
if (allowProto && this.isContextual(
|
|
8068
|
+
if (allowProto && this.isContextual(115)) {
|
|
7960
8069
|
var lookahead = this.lookahead();
|
|
7961
8070
|
|
|
7962
8071
|
if (lookahead.type !== 14 && lookahead.type !== 17) {
|
|
@@ -7966,7 +8075,7 @@
|
|
|
7966
8075
|
}
|
|
7967
8076
|
}
|
|
7968
8077
|
|
|
7969
|
-
if (allowStatic && this.isContextual(
|
|
8078
|
+
if (allowStatic && this.isContextual(104)) {
|
|
7970
8079
|
var _lookahead = this.lookahead();
|
|
7971
8080
|
|
|
7972
8081
|
if (_lookahead.type !== 14 && _lookahead.type !== 17) {
|
|
@@ -7991,7 +8100,7 @@
|
|
|
7991
8100
|
} else {
|
|
7992
8101
|
nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
|
|
7993
8102
|
}
|
|
7994
|
-
} else if (this.match(10) || this.match(
|
|
8103
|
+
} else if (this.match(10) || this.match(47)) {
|
|
7995
8104
|
if (protoStartLoc != null) {
|
|
7996
8105
|
this.unexpected(protoStartLoc);
|
|
7997
8106
|
}
|
|
@@ -8004,7 +8113,7 @@
|
|
|
8004
8113
|
} else {
|
|
8005
8114
|
var kind = "init";
|
|
8006
8115
|
|
|
8007
|
-
if (this.isContextual(
|
|
8116
|
+
if (this.isContextual(98) || this.isContextual(103)) {
|
|
8008
8117
|
var _lookahead2 = this.lookahead();
|
|
8009
8118
|
|
|
8010
8119
|
if (tokenIsLiteralPropertyName(_lookahead2.type)) {
|
|
@@ -8092,7 +8201,7 @@
|
|
|
8092
8201
|
node.kind = kind;
|
|
8093
8202
|
var optional = false;
|
|
8094
8203
|
|
|
8095
|
-
if (this.match(
|
|
8204
|
+
if (this.match(47) || this.match(10)) {
|
|
8096
8205
|
node.method = true;
|
|
8097
8206
|
|
|
8098
8207
|
if (protoStartLoc != null) {
|
|
@@ -8180,7 +8289,7 @@
|
|
|
8180
8289
|
node.typeParameters = null;
|
|
8181
8290
|
node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
|
|
8182
8291
|
|
|
8183
|
-
if (this.match(
|
|
8292
|
+
if (this.match(47)) {
|
|
8184
8293
|
node.typeParameters = this.flowParseTypeParameterInstantiation();
|
|
8185
8294
|
}
|
|
8186
8295
|
|
|
@@ -8189,7 +8298,7 @@
|
|
|
8189
8298
|
|
|
8190
8299
|
flowParseTypeofType() {
|
|
8191
8300
|
var node = this.startNode();
|
|
8192
|
-
this.expect(
|
|
8301
|
+
this.expect(87);
|
|
8193
8302
|
node.argument = this.flowParsePrimaryType();
|
|
8194
8303
|
return this.finishNode(node, "TypeofTypeAnnotation");
|
|
8195
8304
|
}
|
|
@@ -8215,7 +8324,7 @@
|
|
|
8215
8324
|
var typeAnnotation = null;
|
|
8216
8325
|
var node = this.startNode();
|
|
8217
8326
|
var lh = this.lookahead();
|
|
8218
|
-
var isThis = this.state.type ===
|
|
8327
|
+
var isThis = this.state.type === 78;
|
|
8219
8328
|
|
|
8220
8329
|
if (lh.type === 14 || lh.type === 17) {
|
|
8221
8330
|
if (isThis && !first) {
|
|
@@ -8260,7 +8369,7 @@
|
|
|
8260
8369
|
var rest = null;
|
|
8261
8370
|
var _this = null;
|
|
8262
8371
|
|
|
8263
|
-
if (this.match(
|
|
8372
|
+
if (this.match(78)) {
|
|
8264
8373
|
_this = this.flowParseFunctionTypeParam(true);
|
|
8265
8374
|
_this.name = null;
|
|
8266
8375
|
|
|
@@ -8352,7 +8461,7 @@
|
|
|
8352
8461
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
8353
8462
|
return type;
|
|
8354
8463
|
|
|
8355
|
-
case
|
|
8464
|
+
case 47:
|
|
8356
8465
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
8357
8466
|
this.expect(10);
|
|
8358
8467
|
tmp = this.flowParseFunctionTypeParams();
|
|
@@ -8368,7 +8477,7 @@
|
|
|
8368
8477
|
this.next();
|
|
8369
8478
|
|
|
8370
8479
|
if (!this.match(11) && !this.match(21)) {
|
|
8371
|
-
if (tokenIsIdentifier(this.state.type) || this.match(
|
|
8480
|
+
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
8372
8481
|
var token = this.lookahead().type;
|
|
8373
8482
|
isGroupedType = token !== 17 && token !== 14;
|
|
8374
8483
|
} else {
|
|
@@ -8404,24 +8513,24 @@
|
|
|
8404
8513
|
node.typeParameters = null;
|
|
8405
8514
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
8406
8515
|
|
|
8407
|
-
case
|
|
8516
|
+
case 129:
|
|
8408
8517
|
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
8409
8518
|
|
|
8410
|
-
case
|
|
8411
|
-
case
|
|
8412
|
-
node.value = this.match(
|
|
8519
|
+
case 85:
|
|
8520
|
+
case 86:
|
|
8521
|
+
node.value = this.match(85);
|
|
8413
8522
|
this.next();
|
|
8414
8523
|
return this.finishNode(node, "BooleanLiteralTypeAnnotation");
|
|
8415
8524
|
|
|
8416
|
-
case
|
|
8525
|
+
case 53:
|
|
8417
8526
|
if (this.state.value === "-") {
|
|
8418
8527
|
this.next();
|
|
8419
8528
|
|
|
8420
|
-
if (this.match(
|
|
8529
|
+
if (this.match(130)) {
|
|
8421
8530
|
return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
8422
8531
|
}
|
|
8423
8532
|
|
|
8424
|
-
if (this.match(
|
|
8533
|
+
if (this.match(131)) {
|
|
8425
8534
|
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
8426
8535
|
}
|
|
8427
8536
|
|
|
@@ -8432,29 +8541,29 @@
|
|
|
8432
8541
|
|
|
8433
8542
|
throw this.unexpected();
|
|
8434
8543
|
|
|
8435
|
-
case
|
|
8544
|
+
case 130:
|
|
8436
8545
|
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
8437
8546
|
|
|
8438
|
-
case
|
|
8547
|
+
case 131:
|
|
8439
8548
|
return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
|
|
8440
8549
|
|
|
8441
|
-
case
|
|
8550
|
+
case 88:
|
|
8442
8551
|
this.next();
|
|
8443
8552
|
return this.finishNode(node, "VoidTypeAnnotation");
|
|
8444
8553
|
|
|
8445
|
-
case
|
|
8554
|
+
case 84:
|
|
8446
8555
|
this.next();
|
|
8447
8556
|
return this.finishNode(node, "NullLiteralTypeAnnotation");
|
|
8448
8557
|
|
|
8449
|
-
case
|
|
8558
|
+
case 78:
|
|
8450
8559
|
this.next();
|
|
8451
8560
|
return this.finishNode(node, "ThisTypeAnnotation");
|
|
8452
8561
|
|
|
8453
|
-
case
|
|
8562
|
+
case 55:
|
|
8454
8563
|
this.next();
|
|
8455
8564
|
return this.finishNode(node, "ExistsTypeAnnotation");
|
|
8456
8565
|
|
|
8457
|
-
case
|
|
8566
|
+
case 87:
|
|
8458
8567
|
return this.flowParseTypeofType();
|
|
8459
8568
|
|
|
8460
8569
|
default:
|
|
@@ -8463,7 +8572,7 @@
|
|
|
8463
8572
|
this.next();
|
|
8464
8573
|
return super.createIdentifier(node, label);
|
|
8465
8574
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
8466
|
-
if (this.isContextual(
|
|
8575
|
+
if (this.isContextual(125)) {
|
|
8467
8576
|
return this.flowParseInterfaceType();
|
|
8468
8577
|
}
|
|
8469
8578
|
|
|
@@ -8537,11 +8646,11 @@
|
|
|
8537
8646
|
|
|
8538
8647
|
flowParseIntersectionType() {
|
|
8539
8648
|
var node = this.startNode();
|
|
8540
|
-
this.eat(
|
|
8649
|
+
this.eat(45);
|
|
8541
8650
|
var type = this.flowParseAnonFunctionWithoutParens();
|
|
8542
8651
|
node.types = [type];
|
|
8543
8652
|
|
|
8544
|
-
while (this.eat(
|
|
8653
|
+
while (this.eat(45)) {
|
|
8545
8654
|
node.types.push(this.flowParseAnonFunctionWithoutParens());
|
|
8546
8655
|
}
|
|
8547
8656
|
|
|
@@ -8550,11 +8659,11 @@
|
|
|
8550
8659
|
|
|
8551
8660
|
flowParseUnionType() {
|
|
8552
8661
|
var node = this.startNode();
|
|
8553
|
-
this.eat(
|
|
8662
|
+
this.eat(43);
|
|
8554
8663
|
var type = this.flowParseIntersectionType();
|
|
8555
8664
|
node.types = [type];
|
|
8556
8665
|
|
|
8557
|
-
while (this.eat(
|
|
8666
|
+
while (this.eat(43)) {
|
|
8558
8667
|
node.types.push(this.flowParseIntersectionType());
|
|
8559
8668
|
}
|
|
8560
8669
|
|
|
@@ -8570,7 +8679,7 @@
|
|
|
8570
8679
|
}
|
|
8571
8680
|
|
|
8572
8681
|
flowParseTypeOrImplicitInstantiation() {
|
|
8573
|
-
if (this.state.type ===
|
|
8682
|
+
if (this.state.type === 128 && this.state.value === "_") {
|
|
8574
8683
|
var startPos = this.state.start;
|
|
8575
8684
|
var startLoc = this.state.startLoc;
|
|
8576
8685
|
var node = this.parseIdentifier();
|
|
@@ -8606,7 +8715,7 @@
|
|
|
8606
8715
|
flowParseVariance() {
|
|
8607
8716
|
var variance = null;
|
|
8608
8717
|
|
|
8609
|
-
if (this.match(
|
|
8718
|
+
if (this.match(53)) {
|
|
8610
8719
|
variance = this.startNode();
|
|
8611
8720
|
|
|
8612
8721
|
if (this.state.value === "+") {
|
|
@@ -8645,7 +8754,7 @@
|
|
|
8645
8754
|
}
|
|
8646
8755
|
|
|
8647
8756
|
parseStatement(context, topLevel) {
|
|
8648
|
-
if (this.state.strict && this.isContextual(
|
|
8757
|
+
if (this.state.strict && this.isContextual(125)) {
|
|
8649
8758
|
var lookahead = this.lookahead();
|
|
8650
8759
|
|
|
8651
8760
|
if (tokenIsKeywordOrIdentifier(lookahead.type)) {
|
|
@@ -8653,7 +8762,7 @@
|
|
|
8653
8762
|
this.next();
|
|
8654
8763
|
return this.flowParseInterface(node);
|
|
8655
8764
|
}
|
|
8656
|
-
} else if (this.shouldParseEnums() && this.isContextual(
|
|
8765
|
+
} else if (this.shouldParseEnums() && this.isContextual(122)) {
|
|
8657
8766
|
var _node = this.startNode();
|
|
8658
8767
|
|
|
8659
8768
|
this.next();
|
|
@@ -8672,7 +8781,7 @@
|
|
|
8672
8781
|
parseExpressionStatement(node, expr) {
|
|
8673
8782
|
if (expr.type === "Identifier") {
|
|
8674
8783
|
if (expr.name === "declare") {
|
|
8675
|
-
if (this.match(
|
|
8784
|
+
if (this.match(80) || tokenIsIdentifier(this.state.type) || this.match(68) || this.match(74) || this.match(82)) {
|
|
8676
8785
|
return this.flowParseDeclare(node);
|
|
8677
8786
|
}
|
|
8678
8787
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
@@ -8694,7 +8803,7 @@
|
|
|
8694
8803
|
type
|
|
8695
8804
|
} = this.state;
|
|
8696
8805
|
|
|
8697
|
-
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type ===
|
|
8806
|
+
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 122) {
|
|
8698
8807
|
return !this.state.containsEsc;
|
|
8699
8808
|
}
|
|
8700
8809
|
|
|
@@ -8706,7 +8815,7 @@
|
|
|
8706
8815
|
type
|
|
8707
8816
|
} = this.state;
|
|
8708
8817
|
|
|
8709
|
-
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type ===
|
|
8818
|
+
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 122) {
|
|
8710
8819
|
return this.state.containsEsc;
|
|
8711
8820
|
}
|
|
8712
8821
|
|
|
@@ -8714,7 +8823,7 @@
|
|
|
8714
8823
|
}
|
|
8715
8824
|
|
|
8716
8825
|
parseExportDefaultExpression() {
|
|
8717
|
-
if (this.shouldParseEnums() && this.isContextual(
|
|
8826
|
+
if (this.shouldParseEnums() && this.isContextual(122)) {
|
|
8718
8827
|
var node = this.startNode();
|
|
8719
8828
|
this.next();
|
|
8720
8829
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -8889,7 +8998,7 @@
|
|
|
8889
8998
|
}
|
|
8890
8999
|
|
|
8891
9000
|
parseExportDeclaration(node) {
|
|
8892
|
-
if (this.isContextual(
|
|
9001
|
+
if (this.isContextual(126)) {
|
|
8893
9002
|
node.exportKind = "type";
|
|
8894
9003
|
var declarationNode = this.startNode();
|
|
8895
9004
|
this.next();
|
|
@@ -8901,21 +9010,21 @@
|
|
|
8901
9010
|
} else {
|
|
8902
9011
|
return this.flowParseTypeAlias(declarationNode);
|
|
8903
9012
|
}
|
|
8904
|
-
} else if (this.isContextual(
|
|
9013
|
+
} else if (this.isContextual(127)) {
|
|
8905
9014
|
node.exportKind = "type";
|
|
8906
9015
|
|
|
8907
9016
|
var _declarationNode = this.startNode();
|
|
8908
9017
|
|
|
8909
9018
|
this.next();
|
|
8910
9019
|
return this.flowParseOpaqueType(_declarationNode, false);
|
|
8911
|
-
} else if (this.isContextual(
|
|
9020
|
+
} else if (this.isContextual(125)) {
|
|
8912
9021
|
node.exportKind = "type";
|
|
8913
9022
|
|
|
8914
9023
|
var _declarationNode2 = this.startNode();
|
|
8915
9024
|
|
|
8916
9025
|
this.next();
|
|
8917
9026
|
return this.flowParseInterface(_declarationNode2);
|
|
8918
|
-
} else if (this.shouldParseEnums() && this.isContextual(
|
|
9027
|
+
} else if (this.shouldParseEnums() && this.isContextual(122)) {
|
|
8919
9028
|
node.exportKind = "value";
|
|
8920
9029
|
|
|
8921
9030
|
var _declarationNode3 = this.startNode();
|
|
@@ -8930,7 +9039,7 @@
|
|
|
8930
9039
|
eatExportStar(node) {
|
|
8931
9040
|
if (super.eatExportStar(...arguments)) return true;
|
|
8932
9041
|
|
|
8933
|
-
if (this.isContextual(
|
|
9042
|
+
if (this.isContextual(126) && this.lookahead().type === 55) {
|
|
8934
9043
|
node.exportKind = "type";
|
|
8935
9044
|
this.next();
|
|
8936
9045
|
this.next();
|
|
@@ -8956,7 +9065,7 @@
|
|
|
8956
9065
|
parseClassId(node, isStatement, optionalId) {
|
|
8957
9066
|
super.parseClassId(node, isStatement, optionalId);
|
|
8958
9067
|
|
|
8959
|
-
if (this.match(
|
|
9068
|
+
if (this.match(47)) {
|
|
8960
9069
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
8961
9070
|
}
|
|
8962
9071
|
}
|
|
@@ -8966,7 +9075,7 @@
|
|
|
8966
9075
|
startLoc
|
|
8967
9076
|
} = this.state;
|
|
8968
9077
|
|
|
8969
|
-
if (this.isContextual(
|
|
9078
|
+
if (this.isContextual(121)) {
|
|
8970
9079
|
if (this.parseClassMemberFromModifier(classBody, member)) {
|
|
8971
9080
|
return;
|
|
8972
9081
|
}
|
|
@@ -9003,7 +9112,7 @@
|
|
|
9003
9112
|
}, fullWord);
|
|
9004
9113
|
}
|
|
9005
9114
|
|
|
9006
|
-
this.finishToken(
|
|
9115
|
+
this.finishToken(128, fullWord);
|
|
9007
9116
|
}
|
|
9008
9117
|
|
|
9009
9118
|
getTokenFromCode(code) {
|
|
@@ -9012,14 +9121,14 @@
|
|
|
9012
9121
|
if (code === 123 && next === 124) {
|
|
9013
9122
|
return this.finishOp(6, 2);
|
|
9014
9123
|
} else if (this.state.inType && (code === 62 || code === 60)) {
|
|
9015
|
-
return this.finishOp(code === 62 ?
|
|
9124
|
+
return this.finishOp(code === 62 ? 48 : 47, 1);
|
|
9016
9125
|
} else if (this.state.inType && code === 63) {
|
|
9017
9126
|
if (next === 46) {
|
|
9018
9127
|
return this.finishOp(18, 2);
|
|
9019
9128
|
}
|
|
9020
9129
|
|
|
9021
9130
|
return this.finishOp(17, 1);
|
|
9022
|
-
} else if (isIteratorStart(code, next)) {
|
|
9131
|
+
} else if (isIteratorStart(code, next, this.input.charCodeAt(this.state.pos + 2))) {
|
|
9023
9132
|
this.state.pos += 2;
|
|
9024
9133
|
return this.readIterator();
|
|
9025
9134
|
} else {
|
|
@@ -9110,7 +9219,7 @@
|
|
|
9110
9219
|
}
|
|
9111
9220
|
|
|
9112
9221
|
isClassMethod() {
|
|
9113
|
-
return this.match(
|
|
9222
|
+
return this.match(47) || super.isClassMethod();
|
|
9114
9223
|
}
|
|
9115
9224
|
|
|
9116
9225
|
isClassProperty() {
|
|
@@ -9128,7 +9237,7 @@
|
|
|
9128
9237
|
|
|
9129
9238
|
delete method.variance;
|
|
9130
9239
|
|
|
9131
|
-
if (this.match(
|
|
9240
|
+
if (this.match(47)) {
|
|
9132
9241
|
method.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
9133
9242
|
}
|
|
9134
9243
|
|
|
@@ -9160,7 +9269,7 @@
|
|
|
9160
9269
|
|
|
9161
9270
|
delete method.variance;
|
|
9162
9271
|
|
|
9163
|
-
if (this.match(
|
|
9272
|
+
if (this.match(47)) {
|
|
9164
9273
|
method.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
9165
9274
|
}
|
|
9166
9275
|
|
|
@@ -9170,11 +9279,11 @@
|
|
|
9170
9279
|
parseClassSuper(node) {
|
|
9171
9280
|
super.parseClassSuper(node);
|
|
9172
9281
|
|
|
9173
|
-
if (node.superClass && this.match(
|
|
9282
|
+
if (node.superClass && this.match(47)) {
|
|
9174
9283
|
node.superTypeParameters = this.flowParseTypeParameterInstantiation();
|
|
9175
9284
|
}
|
|
9176
9285
|
|
|
9177
|
-
if (this.isContextual(
|
|
9286
|
+
if (this.isContextual(110)) {
|
|
9178
9287
|
this.next();
|
|
9179
9288
|
var implemented = node.implements = [];
|
|
9180
9289
|
|
|
@@ -9183,7 +9292,7 @@
|
|
|
9183
9292
|
|
|
9184
9293
|
_node3.id = this.flowParseRestrictedIdentifier(true);
|
|
9185
9294
|
|
|
9186
|
-
if (this.match(
|
|
9295
|
+
if (this.match(47)) {
|
|
9187
9296
|
_node3.typeParameters = this.flowParseTypeParameterInstantiation();
|
|
9188
9297
|
} else {
|
|
9189
9298
|
_node3.typeParameters = null;
|
|
@@ -9225,7 +9334,7 @@
|
|
|
9225
9334
|
delete prop.variance;
|
|
9226
9335
|
var typeParameters;
|
|
9227
9336
|
|
|
9228
|
-
if (this.match(
|
|
9337
|
+
if (this.match(47) && !isAccessor) {
|
|
9229
9338
|
typeParameters = this.flowParseTypeParameterDeclaration();
|
|
9230
9339
|
if (!this.match(10)) this.unexpected();
|
|
9231
9340
|
}
|
|
@@ -9302,9 +9411,9 @@
|
|
|
9302
9411
|
node.importKind = "value";
|
|
9303
9412
|
var kind = null;
|
|
9304
9413
|
|
|
9305
|
-
if (this.match(
|
|
9414
|
+
if (this.match(87)) {
|
|
9306
9415
|
kind = "typeof";
|
|
9307
|
-
} else if (this.isContextual(
|
|
9416
|
+
} else if (this.isContextual(126)) {
|
|
9308
9417
|
kind = "type";
|
|
9309
9418
|
}
|
|
9310
9419
|
|
|
@@ -9314,11 +9423,11 @@
|
|
|
9314
9423
|
type
|
|
9315
9424
|
} = lh;
|
|
9316
9425
|
|
|
9317
|
-
if (kind === "type" && type ===
|
|
9426
|
+
if (kind === "type" && type === 55) {
|
|
9318
9427
|
this.unexpected(null, lh.type);
|
|
9319
9428
|
}
|
|
9320
9429
|
|
|
9321
|
-
if (isMaybeDefaultImport(type) || type === 5 || type ===
|
|
9430
|
+
if (isMaybeDefaultImport(type) || type === 5 || type === 55) {
|
|
9322
9431
|
this.next();
|
|
9323
9432
|
node.importKind = kind;
|
|
9324
9433
|
}
|
|
@@ -9341,7 +9450,7 @@
|
|
|
9341
9450
|
|
|
9342
9451
|
var isBinding = false;
|
|
9343
9452
|
|
|
9344
|
-
if (this.isContextual(
|
|
9453
|
+
if (this.isContextual(93) && !this.isLookaheadContextual("as")) {
|
|
9345
9454
|
var as_ident = this.parseIdentifier(true);
|
|
9346
9455
|
|
|
9347
9456
|
if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
@@ -9368,7 +9477,7 @@
|
|
|
9368
9477
|
specifier.importKind = null;
|
|
9369
9478
|
}
|
|
9370
9479
|
|
|
9371
|
-
if (this.eatContextual(
|
|
9480
|
+
if (this.eatContextual(93)) {
|
|
9372
9481
|
specifier.local = this.parseIdentifier();
|
|
9373
9482
|
} else {
|
|
9374
9483
|
isBinding = true;
|
|
@@ -9398,7 +9507,7 @@
|
|
|
9398
9507
|
|
|
9399
9508
|
parseBindingAtom() {
|
|
9400
9509
|
switch (this.state.type) {
|
|
9401
|
-
case
|
|
9510
|
+
case 78:
|
|
9402
9511
|
return this.parseIdentifier(true);
|
|
9403
9512
|
|
|
9404
9513
|
default:
|
|
@@ -9409,7 +9518,7 @@
|
|
|
9409
9518
|
parseFunctionParams(node, allowModifiers) {
|
|
9410
9519
|
var kind = node.kind;
|
|
9411
9520
|
|
|
9412
|
-
if (kind !== "get" && kind !== "set" && this.match(
|
|
9521
|
+
if (kind !== "get" && kind !== "set" && this.match(47)) {
|
|
9413
9522
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
9414
9523
|
}
|
|
9415
9524
|
|
|
@@ -9446,7 +9555,7 @@
|
|
|
9446
9555
|
var state = null;
|
|
9447
9556
|
var jsx;
|
|
9448
9557
|
|
|
9449
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
9558
|
+
if (this.hasPlugin("jsx") && (this.match(138) || this.match(47))) {
|
|
9450
9559
|
state = this.state.clone();
|
|
9451
9560
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9452
9561
|
if (!jsx.error) return jsx.node;
|
|
@@ -9460,7 +9569,7 @@
|
|
|
9460
9569
|
}
|
|
9461
9570
|
}
|
|
9462
9571
|
|
|
9463
|
-
if ((_jsx = jsx) != null && _jsx.error || this.match(
|
|
9572
|
+
if ((_jsx = jsx) != null && _jsx.error || this.match(47)) {
|
|
9464
9573
|
var _jsx2, _jsx3;
|
|
9465
9574
|
|
|
9466
9575
|
state = state || this.state.clone();
|
|
@@ -9576,7 +9685,7 @@
|
|
|
9576
9685
|
node.callee = base;
|
|
9577
9686
|
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
9578
9687
|
base = this.finishNode(node, "CallExpression");
|
|
9579
|
-
} else if (base.type === "Identifier" && base.name === "async" && this.match(
|
|
9688
|
+
} else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
|
|
9580
9689
|
var state = this.state.clone();
|
|
9581
9690
|
var arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || abort(), state);
|
|
9582
9691
|
if (!arrow.error && !arrow.aborted) return arrow.node;
|
|
@@ -9616,7 +9725,7 @@
|
|
|
9616
9725
|
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
9617
9726
|
node.optional = true;
|
|
9618
9727
|
return this.finishCallExpression(node, true);
|
|
9619
|
-
} else if (!noCalls && this.shouldParseTypes() && this.match(
|
|
9728
|
+
} else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
|
|
9620
9729
|
var _node4 = this.startNodeAt(startPos, startLoc);
|
|
9621
9730
|
|
|
9622
9731
|
_node4.callee = base;
|
|
@@ -9640,7 +9749,7 @@
|
|
|
9640
9749
|
parseNewArguments(node) {
|
|
9641
9750
|
var targs = null;
|
|
9642
9751
|
|
|
9643
|
-
if (this.shouldParseTypes() && this.match(
|
|
9752
|
+
if (this.shouldParseTypes() && this.match(47)) {
|
|
9644
9753
|
targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
|
|
9645
9754
|
}
|
|
9646
9755
|
|
|
@@ -9815,7 +9924,7 @@
|
|
|
9815
9924
|
var endOfInit = () => this.match(12) || this.match(8);
|
|
9816
9925
|
|
|
9817
9926
|
switch (this.state.type) {
|
|
9818
|
-
case
|
|
9927
|
+
case 130:
|
|
9819
9928
|
{
|
|
9820
9929
|
var literal = this.parseNumericLiteral(this.state.value);
|
|
9821
9930
|
|
|
@@ -9833,7 +9942,7 @@
|
|
|
9833
9942
|
};
|
|
9834
9943
|
}
|
|
9835
9944
|
|
|
9836
|
-
case
|
|
9945
|
+
case 129:
|
|
9837
9946
|
{
|
|
9838
9947
|
var _literal = this.parseStringLiteral(this.state.value);
|
|
9839
9948
|
|
|
@@ -9851,10 +9960,10 @@
|
|
|
9851
9960
|
};
|
|
9852
9961
|
}
|
|
9853
9962
|
|
|
9854
|
-
case
|
|
9855
|
-
case
|
|
9963
|
+
case 85:
|
|
9964
|
+
case 86:
|
|
9856
9965
|
{
|
|
9857
|
-
var _literal2 = this.parseBooleanLiteral(this.match(
|
|
9966
|
+
var _literal2 = this.parseBooleanLiteral(this.match(85));
|
|
9858
9967
|
|
|
9859
9968
|
if (endOfInit()) {
|
|
9860
9969
|
return {
|
|
@@ -10047,7 +10156,7 @@
|
|
|
10047
10156
|
enumName
|
|
10048
10157
|
} = _ref15;
|
|
10049
10158
|
|
|
10050
|
-
if (this.eatContextual(
|
|
10159
|
+
if (this.eatContextual(101)) {
|
|
10051
10160
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
10052
10161
|
throw this.flowEnumErrorInvalidExplicitType(this.state.startLoc, {
|
|
10053
10162
|
enumName,
|
|
@@ -10500,14 +10609,14 @@
|
|
|
10500
10609
|
if (this.state.pos === this.state.start) {
|
|
10501
10610
|
if (ch === 60 && this.state.canStartJSXElement) {
|
|
10502
10611
|
++this.state.pos;
|
|
10503
|
-
return this.finishToken(
|
|
10612
|
+
return this.finishToken(138);
|
|
10504
10613
|
}
|
|
10505
10614
|
|
|
10506
10615
|
return super.getTokenFromCode(ch);
|
|
10507
10616
|
}
|
|
10508
10617
|
|
|
10509
10618
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
10510
|
-
return this.finishToken(
|
|
10619
|
+
return this.finishToken(137, out);
|
|
10511
10620
|
|
|
10512
10621
|
case 38:
|
|
10513
10622
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -10575,7 +10684,7 @@
|
|
|
10575
10684
|
}
|
|
10576
10685
|
|
|
10577
10686
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
10578
|
-
return this.finishToken(
|
|
10687
|
+
return this.finishToken(129, out);
|
|
10579
10688
|
}
|
|
10580
10689
|
|
|
10581
10690
|
jsxReadEntity() {
|
|
@@ -10629,13 +10738,13 @@
|
|
|
10629
10738
|
ch = this.input.charCodeAt(++this.state.pos);
|
|
10630
10739
|
} while (isIdentifierChar(ch) || ch === 45);
|
|
10631
10740
|
|
|
10632
|
-
return this.finishToken(
|
|
10741
|
+
return this.finishToken(136, this.input.slice(start, this.state.pos));
|
|
10633
10742
|
}
|
|
10634
10743
|
|
|
10635
10744
|
jsxParseIdentifier() {
|
|
10636
10745
|
var node = this.startNode();
|
|
10637
10746
|
|
|
10638
|
-
if (this.match(
|
|
10747
|
+
if (this.match(136)) {
|
|
10639
10748
|
node.name = this.state.value;
|
|
10640
10749
|
} else if (tokenIsKeyword(this.state.type)) {
|
|
10641
10750
|
node.name = tokenLabelName(this.state.type);
|
|
@@ -10695,8 +10804,8 @@
|
|
|
10695
10804
|
|
|
10696
10805
|
return node;
|
|
10697
10806
|
|
|
10698
|
-
case
|
|
10699
|
-
case
|
|
10807
|
+
case 138:
|
|
10808
|
+
case 129:
|
|
10700
10809
|
return this.parseExprAtom();
|
|
10701
10810
|
|
|
10702
10811
|
default:
|
|
@@ -10707,7 +10816,7 @@
|
|
|
10707
10816
|
}
|
|
10708
10817
|
|
|
10709
10818
|
jsxParseEmptyExpression() {
|
|
10710
|
-
var node = this.startNodeAt(
|
|
10819
|
+
var node = this.startNodeAt(this.state.lastTokEndLoc.index, this.state.lastTokEndLoc);
|
|
10711
10820
|
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.startLoc);
|
|
10712
10821
|
}
|
|
10713
10822
|
|
|
@@ -10753,8 +10862,8 @@
|
|
|
10753
10862
|
jsxParseOpeningElementAt(startPos, startLoc) {
|
|
10754
10863
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10755
10864
|
|
|
10756
|
-
if (this.match(
|
|
10757
|
-
this.expect(
|
|
10865
|
+
if (this.match(139)) {
|
|
10866
|
+
this.expect(139);
|
|
10758
10867
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
10759
10868
|
}
|
|
10760
10869
|
|
|
@@ -10765,26 +10874,26 @@
|
|
|
10765
10874
|
jsxParseOpeningElementAfterName(node) {
|
|
10766
10875
|
var attributes = [];
|
|
10767
10876
|
|
|
10768
|
-
while (!this.match(
|
|
10877
|
+
while (!this.match(56) && !this.match(139)) {
|
|
10769
10878
|
attributes.push(this.jsxParseAttribute());
|
|
10770
10879
|
}
|
|
10771
10880
|
|
|
10772
10881
|
node.attributes = attributes;
|
|
10773
|
-
node.selfClosing = this.eat(
|
|
10774
|
-
this.expect(
|
|
10882
|
+
node.selfClosing = this.eat(56);
|
|
10883
|
+
this.expect(139);
|
|
10775
10884
|
return this.finishNode(node, "JSXOpeningElement");
|
|
10776
10885
|
}
|
|
10777
10886
|
|
|
10778
10887
|
jsxParseClosingElementAt(startPos, startLoc) {
|
|
10779
10888
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10780
10889
|
|
|
10781
|
-
if (this.match(
|
|
10782
|
-
this.expect(
|
|
10890
|
+
if (this.match(139)) {
|
|
10891
|
+
this.expect(139);
|
|
10783
10892
|
return this.finishNode(node, "JSXClosingFragment");
|
|
10784
10893
|
}
|
|
10785
10894
|
|
|
10786
10895
|
node.name = this.jsxParseElementName();
|
|
10787
|
-
this.expect(
|
|
10896
|
+
this.expect(139);
|
|
10788
10897
|
return this.finishNode(node, "JSXClosingElement");
|
|
10789
10898
|
}
|
|
10790
10899
|
|
|
@@ -10797,12 +10906,12 @@
|
|
|
10797
10906
|
if (!openingElement.selfClosing) {
|
|
10798
10907
|
contents: for (;;) {
|
|
10799
10908
|
switch (this.state.type) {
|
|
10800
|
-
case
|
|
10909
|
+
case 138:
|
|
10801
10910
|
startPos = this.state.start;
|
|
10802
10911
|
startLoc = this.state.startLoc;
|
|
10803
10912
|
this.next();
|
|
10804
10913
|
|
|
10805
|
-
if (this.eat(
|
|
10914
|
+
if (this.eat(56)) {
|
|
10806
10915
|
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
|
|
10807
10916
|
break contents;
|
|
10808
10917
|
}
|
|
@@ -10810,7 +10919,7 @@
|
|
|
10810
10919
|
children.push(this.jsxParseElementAt(startPos, startLoc));
|
|
10811
10920
|
break;
|
|
10812
10921
|
|
|
10813
|
-
case
|
|
10922
|
+
case 137:
|
|
10814
10923
|
children.push(this.parseExprAtom());
|
|
10815
10924
|
break;
|
|
10816
10925
|
|
|
@@ -10862,7 +10971,7 @@
|
|
|
10862
10971
|
|
|
10863
10972
|
node.children = children;
|
|
10864
10973
|
|
|
10865
|
-
if (this.match(
|
|
10974
|
+
if (this.match(47)) {
|
|
10866
10975
|
throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, {
|
|
10867
10976
|
at: this.state.startLoc
|
|
10868
10977
|
});
|
|
@@ -10886,12 +10995,12 @@
|
|
|
10886
10995
|
}
|
|
10887
10996
|
|
|
10888
10997
|
parseExprAtom(refExpressionErrors) {
|
|
10889
|
-
if (this.match(
|
|
10998
|
+
if (this.match(137)) {
|
|
10890
10999
|
return this.parseLiteral(this.state.value, "JSXText");
|
|
10891
|
-
} else if (this.match(
|
|
11000
|
+
} else if (this.match(138)) {
|
|
10892
11001
|
return this.jsxParseElement();
|
|
10893
|
-
} else if (this.match(
|
|
10894
|
-
this.replaceToken(
|
|
11002
|
+
} else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
11003
|
+
this.replaceToken(138);
|
|
10895
11004
|
return this.jsxParseElement();
|
|
10896
11005
|
} else {
|
|
10897
11006
|
return super.parseExprAtom(refExpressionErrors);
|
|
@@ -10917,7 +11026,7 @@
|
|
|
10917
11026
|
|
|
10918
11027
|
if (code === 62) {
|
|
10919
11028
|
++this.state.pos;
|
|
10920
|
-
return this.finishToken(
|
|
11029
|
+
return this.finishToken(139);
|
|
10921
11030
|
}
|
|
10922
11031
|
|
|
10923
11032
|
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
@@ -10927,7 +11036,7 @@
|
|
|
10927
11036
|
|
|
10928
11037
|
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
|
10929
11038
|
++this.state.pos;
|
|
10930
|
-
return this.finishToken(
|
|
11039
|
+
return this.finishToken(138);
|
|
10931
11040
|
}
|
|
10932
11041
|
|
|
10933
11042
|
return super.getTokenFromCode(code);
|
|
@@ -10939,15 +11048,15 @@
|
|
|
10939
11048
|
type
|
|
10940
11049
|
} = this.state;
|
|
10941
11050
|
|
|
10942
|
-
if (type ===
|
|
11051
|
+
if (type === 56 && prevType === 138) {
|
|
10943
11052
|
context.splice(-2, 2, types.j_cTag);
|
|
10944
11053
|
this.state.canStartJSXElement = false;
|
|
10945
|
-
} else if (type ===
|
|
11054
|
+
} else if (type === 138) {
|
|
10946
11055
|
context.push(types.j_oTag);
|
|
10947
|
-
} else if (type ===
|
|
11056
|
+
} else if (type === 139) {
|
|
10948
11057
|
var out = context[context.length - 1];
|
|
10949
11058
|
|
|
10950
|
-
if (out === types.j_oTag && prevType ===
|
|
11059
|
+
if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
|
|
10951
11060
|
context.pop();
|
|
10952
11061
|
this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
|
|
10953
11062
|
} else {
|
|
@@ -11163,7 +11272,7 @@
|
|
|
11163
11272
|
}
|
|
11164
11273
|
|
|
11165
11274
|
tsTokenCanFollowModifier() {
|
|
11166
|
-
return (this.match(0) || this.match(5) || this.match(
|
|
11275
|
+
return (this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(134) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
|
|
11167
11276
|
}
|
|
11168
11277
|
|
|
11169
11278
|
tsNextTokenCanFollowModifier() {
|
|
@@ -11264,7 +11373,7 @@
|
|
|
11264
11373
|
return this.match(3);
|
|
11265
11374
|
|
|
11266
11375
|
case "TypeParametersOrArguments":
|
|
11267
|
-
return this.match(
|
|
11376
|
+
return this.match(48);
|
|
11268
11377
|
}
|
|
11269
11378
|
|
|
11270
11379
|
throw new Error("Unreachable");
|
|
@@ -11330,7 +11439,7 @@
|
|
|
11330
11439
|
if (bracket) {
|
|
11331
11440
|
this.expect(0);
|
|
11332
11441
|
} else {
|
|
11333
|
-
this.expect(
|
|
11442
|
+
this.expect(47);
|
|
11334
11443
|
}
|
|
11335
11444
|
}
|
|
11336
11445
|
|
|
@@ -11339,7 +11448,7 @@
|
|
|
11339
11448
|
if (bracket) {
|
|
11340
11449
|
this.expect(3);
|
|
11341
11450
|
} else {
|
|
11342
|
-
this.expect(
|
|
11451
|
+
this.expect(48);
|
|
11343
11452
|
}
|
|
11344
11453
|
|
|
11345
11454
|
return result;
|
|
@@ -11347,10 +11456,10 @@
|
|
|
11347
11456
|
|
|
11348
11457
|
tsParseImportType() {
|
|
11349
11458
|
var node = this.startNode();
|
|
11350
|
-
this.expect(
|
|
11459
|
+
this.expect(83);
|
|
11351
11460
|
this.expect(10);
|
|
11352
11461
|
|
|
11353
|
-
if (!this.match(
|
|
11462
|
+
if (!this.match(129)) {
|
|
11354
11463
|
this.raise(TSErrors.UnsupportedImportTypeArgument, {
|
|
11355
11464
|
at: this.state.startLoc
|
|
11356
11465
|
});
|
|
@@ -11363,7 +11472,7 @@
|
|
|
11363
11472
|
node.qualifier = this.tsParseEntityName(true);
|
|
11364
11473
|
}
|
|
11365
11474
|
|
|
11366
|
-
if (this.match(
|
|
11475
|
+
if (this.match(47)) {
|
|
11367
11476
|
node.typeParameters = this.tsParseTypeArguments();
|
|
11368
11477
|
}
|
|
11369
11478
|
|
|
@@ -11387,7 +11496,7 @@
|
|
|
11387
11496
|
var node = this.startNode();
|
|
11388
11497
|
node.typeName = this.tsParseEntityName(false);
|
|
11389
11498
|
|
|
11390
|
-
if (!this.hasPrecedingLineBreak() && this.match(
|
|
11499
|
+
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
|
11391
11500
|
node.typeParameters = this.tsParseTypeArguments();
|
|
11392
11501
|
}
|
|
11393
11502
|
|
|
@@ -11411,9 +11520,9 @@
|
|
|
11411
11520
|
|
|
11412
11521
|
tsParseTypeQuery() {
|
|
11413
11522
|
var node = this.startNode();
|
|
11414
|
-
this.expect(
|
|
11523
|
+
this.expect(87);
|
|
11415
11524
|
|
|
11416
|
-
if (this.match(
|
|
11525
|
+
if (this.match(83)) {
|
|
11417
11526
|
node.exprName = this.tsParseImportType();
|
|
11418
11527
|
} else {
|
|
11419
11528
|
node.exprName = this.tsParseEntityName(true);
|
|
@@ -11425,13 +11534,13 @@
|
|
|
11425
11534
|
tsParseTypeParameter() {
|
|
11426
11535
|
var node = this.startNode();
|
|
11427
11536
|
node.name = this.tsParseTypeParameterName();
|
|
11428
|
-
node.constraint = this.tsEatThenParseType(
|
|
11537
|
+
node.constraint = this.tsEatThenParseType(81);
|
|
11429
11538
|
node.default = this.tsEatThenParseType(29);
|
|
11430
11539
|
return this.finishNode(node, "TSTypeParameter");
|
|
11431
11540
|
}
|
|
11432
11541
|
|
|
11433
11542
|
tsTryParseTypeParameters() {
|
|
11434
|
-
if (this.match(
|
|
11543
|
+
if (this.match(47)) {
|
|
11435
11544
|
return this.tsParseTypeParameters();
|
|
11436
11545
|
}
|
|
11437
11546
|
}
|
|
@@ -11439,7 +11548,7 @@
|
|
|
11439
11548
|
tsParseTypeParameters() {
|
|
11440
11549
|
var node = this.startNode();
|
|
11441
11550
|
|
|
11442
|
-
if (this.match(
|
|
11551
|
+
if (this.match(47) || this.match(138)) {
|
|
11443
11552
|
this.next();
|
|
11444
11553
|
} else {
|
|
11445
11554
|
this.unexpected();
|
|
@@ -11464,7 +11573,7 @@
|
|
|
11464
11573
|
}
|
|
11465
11574
|
|
|
11466
11575
|
tsTryNextParseConstantContext() {
|
|
11467
|
-
if (this.lookahead().type ===
|
|
11576
|
+
if (this.lookahead().type === 75) {
|
|
11468
11577
|
this.next();
|
|
11469
11578
|
return this.tsParseTypeReference();
|
|
11470
11579
|
}
|
|
@@ -11543,7 +11652,7 @@
|
|
|
11543
11652
|
if (this.eat(17)) node.optional = true;
|
|
11544
11653
|
var nodeAny = node;
|
|
11545
11654
|
|
|
11546
|
-
if (this.match(10) || this.match(
|
|
11655
|
+
if (this.match(10) || this.match(47)) {
|
|
11547
11656
|
if (readonly) {
|
|
11548
11657
|
this.raise(TSErrors.ReadonlyForMethodSignature, {
|
|
11549
11658
|
node
|
|
@@ -11552,7 +11661,7 @@
|
|
|
11552
11661
|
|
|
11553
11662
|
var method = nodeAny;
|
|
11554
11663
|
|
|
11555
|
-
if (method.kind && this.match(
|
|
11664
|
+
if (method.kind && this.match(47)) {
|
|
11556
11665
|
this.raise(TSErrors.AccesorCannotHaveTypeParameters, {
|
|
11557
11666
|
at: this.state.curPosition()
|
|
11558
11667
|
});
|
|
@@ -11625,15 +11734,15 @@
|
|
|
11625
11734
|
tsParseTypeMember() {
|
|
11626
11735
|
var node = this.startNode();
|
|
11627
11736
|
|
|
11628
|
-
if (this.match(10) || this.match(
|
|
11737
|
+
if (this.match(10) || this.match(47)) {
|
|
11629
11738
|
return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
|
|
11630
11739
|
}
|
|
11631
11740
|
|
|
11632
|
-
if (this.match(
|
|
11741
|
+
if (this.match(77)) {
|
|
11633
11742
|
var id = this.startNode();
|
|
11634
11743
|
this.next();
|
|
11635
11744
|
|
|
11636
|
-
if (this.match(10) || this.match(
|
|
11745
|
+
if (this.match(10) || this.match(47)) {
|
|
11637
11746
|
return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
|
|
11638
11747
|
} else {
|
|
11639
11748
|
node.key = this.createIdentifier(id, "new");
|
|
@@ -11674,11 +11783,11 @@
|
|
|
11674
11783
|
tsIsStartOfMappedType() {
|
|
11675
11784
|
this.next();
|
|
11676
11785
|
|
|
11677
|
-
if (this.eat(
|
|
11678
|
-
return this.isContextual(
|
|
11786
|
+
if (this.eat(53)) {
|
|
11787
|
+
return this.isContextual(118);
|
|
11679
11788
|
}
|
|
11680
11789
|
|
|
11681
|
-
if (this.isContextual(
|
|
11790
|
+
if (this.isContextual(118)) {
|
|
11682
11791
|
this.next();
|
|
11683
11792
|
}
|
|
11684
11793
|
|
|
@@ -11693,13 +11802,13 @@
|
|
|
11693
11802
|
}
|
|
11694
11803
|
|
|
11695
11804
|
this.next();
|
|
11696
|
-
return this.match(
|
|
11805
|
+
return this.match(58);
|
|
11697
11806
|
}
|
|
11698
11807
|
|
|
11699
11808
|
tsParseMappedTypeParameter() {
|
|
11700
11809
|
var node = this.startNode();
|
|
11701
11810
|
node.name = this.tsParseTypeParameterName();
|
|
11702
|
-
node.constraint = this.tsExpectThenParseType(
|
|
11811
|
+
node.constraint = this.tsExpectThenParseType(58);
|
|
11703
11812
|
return this.finishNode(node, "TSTypeParameter");
|
|
11704
11813
|
}
|
|
11705
11814
|
|
|
@@ -11707,20 +11816,20 @@
|
|
|
11707
11816
|
var node = this.startNode();
|
|
11708
11817
|
this.expect(5);
|
|
11709
11818
|
|
|
11710
|
-
if (this.match(
|
|
11819
|
+
if (this.match(53)) {
|
|
11711
11820
|
node.readonly = this.state.value;
|
|
11712
11821
|
this.next();
|
|
11713
|
-
this.expectContextual(
|
|
11714
|
-
} else if (this.eatContextual(
|
|
11822
|
+
this.expectContextual(118);
|
|
11823
|
+
} else if (this.eatContextual(118)) {
|
|
11715
11824
|
node.readonly = true;
|
|
11716
11825
|
}
|
|
11717
11826
|
|
|
11718
11827
|
this.expect(0);
|
|
11719
11828
|
node.typeParameter = this.tsParseMappedTypeParameter();
|
|
11720
|
-
node.nameType = this.eatContextual(
|
|
11829
|
+
node.nameType = this.eatContextual(93) ? this.tsParseType() : null;
|
|
11721
11830
|
this.expect(3);
|
|
11722
11831
|
|
|
11723
|
-
if (this.match(
|
|
11832
|
+
if (this.match(53)) {
|
|
11724
11833
|
node.optional = this.state.value;
|
|
11725
11834
|
this.next();
|
|
11726
11835
|
this.expect(17);
|
|
@@ -11837,11 +11946,11 @@
|
|
|
11837
11946
|
|
|
11838
11947
|
node.literal = (() => {
|
|
11839
11948
|
switch (this.state.type) {
|
|
11840
|
-
case
|
|
11841
|
-
case
|
|
11842
|
-
case
|
|
11843
|
-
case
|
|
11844
|
-
case
|
|
11949
|
+
case 130:
|
|
11950
|
+
case 131:
|
|
11951
|
+
case 129:
|
|
11952
|
+
case 85:
|
|
11953
|
+
case 86:
|
|
11845
11954
|
return this.parseExprAtom();
|
|
11846
11955
|
|
|
11847
11956
|
default:
|
|
@@ -11866,7 +11975,7 @@
|
|
|
11866
11975
|
tsParseThisTypeOrThisTypePredicate() {
|
|
11867
11976
|
var thisKeyword = this.tsParseThisTypeNode();
|
|
11868
11977
|
|
|
11869
|
-
if (this.isContextual(
|
|
11978
|
+
if (this.isContextual(113) && !this.hasPrecedingLineBreak()) {
|
|
11870
11979
|
return this.tsParseThisTypePredicate(thisKeyword);
|
|
11871
11980
|
} else {
|
|
11872
11981
|
return thisKeyword;
|
|
@@ -11875,19 +11984,19 @@
|
|
|
11875
11984
|
|
|
11876
11985
|
tsParseNonArrayType() {
|
|
11877
11986
|
switch (this.state.type) {
|
|
11878
|
-
case
|
|
11879
|
-
case
|
|
11880
|
-
case
|
|
11881
|
-
case
|
|
11882
|
-
case
|
|
11987
|
+
case 129:
|
|
11988
|
+
case 130:
|
|
11989
|
+
case 131:
|
|
11990
|
+
case 85:
|
|
11991
|
+
case 86:
|
|
11883
11992
|
return this.tsParseLiteralTypeNode();
|
|
11884
11993
|
|
|
11885
|
-
case
|
|
11994
|
+
case 53:
|
|
11886
11995
|
if (this.state.value === "-") {
|
|
11887
11996
|
var node = this.startNode();
|
|
11888
11997
|
var nextToken = this.lookahead();
|
|
11889
11998
|
|
|
11890
|
-
if (nextToken.type !==
|
|
11999
|
+
if (nextToken.type !== 130 && nextToken.type !== 131) {
|
|
11891
12000
|
throw this.unexpected();
|
|
11892
12001
|
}
|
|
11893
12002
|
|
|
@@ -11897,13 +12006,13 @@
|
|
|
11897
12006
|
|
|
11898
12007
|
break;
|
|
11899
12008
|
|
|
11900
|
-
case
|
|
12009
|
+
case 78:
|
|
11901
12010
|
return this.tsParseThisTypeOrThisTypePredicate();
|
|
11902
12011
|
|
|
11903
|
-
case
|
|
12012
|
+
case 87:
|
|
11904
12013
|
return this.tsParseTypeQuery();
|
|
11905
12014
|
|
|
11906
|
-
case
|
|
12015
|
+
case 83:
|
|
11907
12016
|
return this.tsParseImportType();
|
|
11908
12017
|
|
|
11909
12018
|
case 5:
|
|
@@ -11925,8 +12034,8 @@
|
|
|
11925
12034
|
type
|
|
11926
12035
|
} = this.state;
|
|
11927
12036
|
|
|
11928
|
-
if (tokenIsIdentifier(type) || type ===
|
|
11929
|
-
var nodeType = type ===
|
|
12037
|
+
if (tokenIsIdentifier(type) || type === 88 || type === 84) {
|
|
12038
|
+
var nodeType = type === 88 ? "TSVoidKeyword" : type === 84 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
|
|
11930
12039
|
|
|
11931
12040
|
if (nodeType !== undefined && this.lookaheadCharCode() !== 46) {
|
|
11932
12041
|
var _node6 = this.startNode();
|
|
@@ -11994,7 +12103,7 @@
|
|
|
11994
12103
|
|
|
11995
12104
|
tsParseInferType() {
|
|
11996
12105
|
var node = this.startNode();
|
|
11997
|
-
this.expectContextual(
|
|
12106
|
+
this.expectContextual(112);
|
|
11998
12107
|
var typeParameter = this.startNode();
|
|
11999
12108
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
12000
12109
|
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
|
@@ -12003,7 +12112,7 @@
|
|
|
12003
12112
|
|
|
12004
12113
|
tsParseTypeOperatorOrHigher() {
|
|
12005
12114
|
var isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
|
|
12006
|
-
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(
|
|
12115
|
+
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
|
|
12007
12116
|
}
|
|
12008
12117
|
|
|
12009
12118
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
@@ -12024,15 +12133,15 @@
|
|
|
12024
12133
|
}
|
|
12025
12134
|
|
|
12026
12135
|
tsParseIntersectionTypeOrHigher() {
|
|
12027
|
-
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this),
|
|
12136
|
+
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 45);
|
|
12028
12137
|
}
|
|
12029
12138
|
|
|
12030
12139
|
tsParseUnionTypeOrHigher() {
|
|
12031
|
-
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this),
|
|
12140
|
+
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 43);
|
|
12032
12141
|
}
|
|
12033
12142
|
|
|
12034
12143
|
tsIsStartOfFunctionType() {
|
|
12035
|
-
if (this.match(
|
|
12144
|
+
if (this.match(47)) {
|
|
12036
12145
|
return true;
|
|
12037
12146
|
}
|
|
12038
12147
|
|
|
@@ -12040,7 +12149,7 @@
|
|
|
12040
12149
|
}
|
|
12041
12150
|
|
|
12042
12151
|
tsSkipParameterStart() {
|
|
12043
|
-
if (tokenIsIdentifier(this.state.type) || this.match(
|
|
12152
|
+
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
12044
12153
|
this.next();
|
|
12045
12154
|
return true;
|
|
12046
12155
|
}
|
|
@@ -12113,7 +12222,7 @@
|
|
|
12113
12222
|
var node = this.startNode();
|
|
12114
12223
|
var asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
|
|
12115
12224
|
|
|
12116
|
-
if (asserts && this.match(
|
|
12225
|
+
if (asserts && this.match(78)) {
|
|
12117
12226
|
var thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
|
|
12118
12227
|
|
|
12119
12228
|
if (thisTypePredicate.type === "TSThisType") {
|
|
@@ -12168,21 +12277,21 @@
|
|
|
12168
12277
|
tsParseTypePredicatePrefix() {
|
|
12169
12278
|
var id = this.parseIdentifier();
|
|
12170
12279
|
|
|
12171
|
-
if (this.isContextual(
|
|
12280
|
+
if (this.isContextual(113) && !this.hasPrecedingLineBreak()) {
|
|
12172
12281
|
this.next();
|
|
12173
12282
|
return id;
|
|
12174
12283
|
}
|
|
12175
12284
|
}
|
|
12176
12285
|
|
|
12177
12286
|
tsParseTypePredicateAsserts() {
|
|
12178
|
-
if (this.state.type !==
|
|
12287
|
+
if (this.state.type !== 106) {
|
|
12179
12288
|
return false;
|
|
12180
12289
|
}
|
|
12181
12290
|
|
|
12182
12291
|
var containsEsc = this.state.containsEsc;
|
|
12183
12292
|
this.next();
|
|
12184
12293
|
|
|
12185
|
-
if (!tokenIsIdentifier(this.state.type) && !this.match(
|
|
12294
|
+
if (!tokenIsIdentifier(this.state.type) && !this.match(78)) {
|
|
12186
12295
|
return false;
|
|
12187
12296
|
}
|
|
12188
12297
|
|
|
@@ -12209,7 +12318,7 @@
|
|
|
12209
12318
|
assert(this.state.inType);
|
|
12210
12319
|
var type = this.tsParseNonConditionalType();
|
|
12211
12320
|
|
|
12212
|
-
if (this.hasPrecedingLineBreak() || !this.eat(
|
|
12321
|
+
if (this.hasPrecedingLineBreak() || !this.eat(81)) {
|
|
12213
12322
|
return type;
|
|
12214
12323
|
}
|
|
12215
12324
|
|
|
@@ -12224,7 +12333,7 @@
|
|
|
12224
12333
|
}
|
|
12225
12334
|
|
|
12226
12335
|
isAbstractConstructorSignature() {
|
|
12227
|
-
return this.isContextual(
|
|
12336
|
+
return this.isContextual(120) && this.lookahead().type === 77;
|
|
12228
12337
|
}
|
|
12229
12338
|
|
|
12230
12339
|
tsParseNonConditionalType() {
|
|
@@ -12232,7 +12341,7 @@
|
|
|
12232
12341
|
return this.tsParseFunctionOrConstructorType("TSFunctionType");
|
|
12233
12342
|
}
|
|
12234
12343
|
|
|
12235
|
-
if (this.match(
|
|
12344
|
+
if (this.match(77)) {
|
|
12236
12345
|
return this.tsParseFunctionOrConstructorType("TSConstructorType");
|
|
12237
12346
|
} else if (this.isAbstractConstructorSignature()) {
|
|
12238
12347
|
return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
|
|
@@ -12253,7 +12362,7 @@
|
|
|
12253
12362
|
var _const = this.tsTryNextParseConstantContext();
|
|
12254
12363
|
|
|
12255
12364
|
node.typeAnnotation = _const || this.tsNextThenParseType();
|
|
12256
|
-
this.expect(
|
|
12365
|
+
this.expect(48);
|
|
12257
12366
|
node.expression = this.parseMaybeUnary();
|
|
12258
12367
|
return this.finishNode(node, "TSTypeAssertion");
|
|
12259
12368
|
}
|
|
@@ -12275,7 +12384,7 @@
|
|
|
12275
12384
|
var node = this.startNode();
|
|
12276
12385
|
node.expression = this.tsParseEntityName(false);
|
|
12277
12386
|
|
|
12278
|
-
if (this.match(
|
|
12387
|
+
if (this.match(47)) {
|
|
12279
12388
|
node.typeParameters = this.tsParseTypeArguments();
|
|
12280
12389
|
}
|
|
12281
12390
|
|
|
@@ -12295,7 +12404,7 @@
|
|
|
12295
12404
|
|
|
12296
12405
|
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12297
12406
|
|
|
12298
|
-
if (this.eat(
|
|
12407
|
+
if (this.eat(81)) {
|
|
12299
12408
|
node.extends = this.tsParseHeritageClause("extends");
|
|
12300
12409
|
}
|
|
12301
12410
|
|
|
@@ -12312,7 +12421,7 @@
|
|
|
12312
12421
|
node.typeAnnotation = this.tsInType(() => {
|
|
12313
12422
|
this.expect(29);
|
|
12314
12423
|
|
|
12315
|
-
if (this.isContextual(
|
|
12424
|
+
if (this.isContextual(111) && this.lookahead().type !== 16) {
|
|
12316
12425
|
var _node8 = this.startNode();
|
|
12317
12426
|
|
|
12318
12427
|
this.next();
|
|
@@ -12368,7 +12477,7 @@
|
|
|
12368
12477
|
|
|
12369
12478
|
tsParseEnumMember() {
|
|
12370
12479
|
var node = this.startNode();
|
|
12371
|
-
node.id = this.match(
|
|
12480
|
+
node.id = this.match(129) ? this.parseExprAtom() : this.parseIdentifier(true);
|
|
12372
12481
|
|
|
12373
12482
|
if (this.eat(29)) {
|
|
12374
12483
|
node.initializer = this.parseMaybeAssignAllowIn();
|
|
@@ -12420,10 +12529,10 @@
|
|
|
12420
12529
|
}
|
|
12421
12530
|
|
|
12422
12531
|
tsParseAmbientExternalModuleDeclaration(node) {
|
|
12423
|
-
if (this.isContextual(
|
|
12532
|
+
if (this.isContextual(109)) {
|
|
12424
12533
|
node.global = true;
|
|
12425
12534
|
node.id = this.parseIdentifier();
|
|
12426
|
-
} else if (this.match(
|
|
12535
|
+
} else if (this.match(129)) {
|
|
12427
12536
|
node.id = this.parseExprAtom();
|
|
12428
12537
|
} else {
|
|
12429
12538
|
this.unexpected();
|
|
@@ -12461,7 +12570,7 @@
|
|
|
12461
12570
|
}
|
|
12462
12571
|
|
|
12463
12572
|
tsIsExternalModuleReference() {
|
|
12464
|
-
return this.isContextual(
|
|
12573
|
+
return this.isContextual(116) && this.lookaheadCharCode() === 40;
|
|
12465
12574
|
}
|
|
12466
12575
|
|
|
12467
12576
|
tsParseModuleReference() {
|
|
@@ -12470,10 +12579,10 @@
|
|
|
12470
12579
|
|
|
12471
12580
|
tsParseExternalModuleReference() {
|
|
12472
12581
|
var node = this.startNode();
|
|
12473
|
-
this.expectContextual(
|
|
12582
|
+
this.expectContextual(116);
|
|
12474
12583
|
this.expect(10);
|
|
12475
12584
|
|
|
12476
|
-
if (!this.match(
|
|
12585
|
+
if (!this.match(129)) {
|
|
12477
12586
|
throw this.unexpected();
|
|
12478
12587
|
}
|
|
12479
12588
|
|
|
@@ -12516,33 +12625,33 @@
|
|
|
12516
12625
|
var starttype = this.state.type;
|
|
12517
12626
|
var kind;
|
|
12518
12627
|
|
|
12519
|
-
if (this.isContextual(
|
|
12520
|
-
starttype =
|
|
12628
|
+
if (this.isContextual(99)) {
|
|
12629
|
+
starttype = 74;
|
|
12521
12630
|
kind = "let";
|
|
12522
12631
|
}
|
|
12523
12632
|
|
|
12524
12633
|
return this.tsInAmbientContext(() => {
|
|
12525
12634
|
switch (starttype) {
|
|
12526
|
-
case
|
|
12635
|
+
case 68:
|
|
12527
12636
|
nany.declare = true;
|
|
12528
12637
|
return this.parseFunctionStatement(nany, false, true);
|
|
12529
12638
|
|
|
12530
|
-
case
|
|
12639
|
+
case 80:
|
|
12531
12640
|
nany.declare = true;
|
|
12532
12641
|
return this.parseClass(nany, true, false);
|
|
12533
12642
|
|
|
12534
|
-
case
|
|
12535
|
-
if (this.match(
|
|
12536
|
-
this.expect(
|
|
12537
|
-
this.expectContextual(
|
|
12643
|
+
case 75:
|
|
12644
|
+
if (this.match(75) && this.isLookaheadContextual("enum")) {
|
|
12645
|
+
this.expect(75);
|
|
12646
|
+
this.expectContextual(122);
|
|
12538
12647
|
return this.tsParseEnumDeclaration(nany, true);
|
|
12539
12648
|
}
|
|
12540
12649
|
|
|
12541
|
-
case
|
|
12650
|
+
case 74:
|
|
12542
12651
|
kind = kind || this.state.value;
|
|
12543
12652
|
return this.parseVarStatement(nany, kind);
|
|
12544
12653
|
|
|
12545
|
-
case
|
|
12654
|
+
case 109:
|
|
12546
12655
|
return this.tsParseAmbientExternalModuleDeclaration(nany);
|
|
12547
12656
|
|
|
12548
12657
|
default:
|
|
@@ -12596,7 +12705,7 @@
|
|
|
12596
12705
|
tsParseDeclaration(node, value, next) {
|
|
12597
12706
|
switch (value) {
|
|
12598
12707
|
case "abstract":
|
|
12599
|
-
if (this.tsCheckLineTerminator(next) && (this.match(
|
|
12708
|
+
if (this.tsCheckLineTerminator(next) && (this.match(80) || tokenIsIdentifier(this.state.type))) {
|
|
12600
12709
|
return this.tsParseAbstractDeclaration(node);
|
|
12601
12710
|
}
|
|
12602
12711
|
|
|
@@ -12619,7 +12728,7 @@
|
|
|
12619
12728
|
|
|
12620
12729
|
case "module":
|
|
12621
12730
|
if (this.tsCheckLineTerminator(next)) {
|
|
12622
|
-
if (this.match(
|
|
12731
|
+
if (this.match(129)) {
|
|
12623
12732
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
12624
12733
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
12625
12734
|
return this.tsParseModuleOrNamespaceDeclaration(node);
|
|
@@ -12655,7 +12764,7 @@
|
|
|
12655
12764
|
}
|
|
12656
12765
|
|
|
12657
12766
|
tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
|
|
12658
|
-
if (!this.match(
|
|
12767
|
+
if (!this.match(47)) {
|
|
12659
12768
|
return undefined;
|
|
12660
12769
|
}
|
|
12661
12770
|
|
|
@@ -12678,10 +12787,18 @@
|
|
|
12678
12787
|
return this.parseArrowExpression(res, null, true);
|
|
12679
12788
|
}
|
|
12680
12789
|
|
|
12790
|
+
tsParseTypeArgumentsInExpression() {
|
|
12791
|
+
if (this.reScan_lt() !== 47) {
|
|
12792
|
+
return undefined;
|
|
12793
|
+
}
|
|
12794
|
+
|
|
12795
|
+
return this.tsParseTypeArguments();
|
|
12796
|
+
}
|
|
12797
|
+
|
|
12681
12798
|
tsParseTypeArguments() {
|
|
12682
12799
|
var node = this.startNode();
|
|
12683
12800
|
node.params = this.tsInType(() => this.tsInNoContext(() => {
|
|
12684
|
-
this.expect(
|
|
12801
|
+
this.expect(47);
|
|
12685
12802
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
12686
12803
|
}));
|
|
12687
12804
|
|
|
@@ -12691,7 +12808,7 @@
|
|
|
12691
12808
|
});
|
|
12692
12809
|
}
|
|
12693
12810
|
|
|
12694
|
-
this.expect(
|
|
12811
|
+
this.expect(48);
|
|
12695
12812
|
return this.finishNode(node, "TSTypeParameterInstantiation");
|
|
12696
12813
|
}
|
|
12697
12814
|
|
|
@@ -12839,7 +12956,7 @@
|
|
|
12839
12956
|
this.next();
|
|
12840
12957
|
}
|
|
12841
12958
|
|
|
12842
|
-
if (this.match(
|
|
12959
|
+
if (this.match(47) || this.match(51)) {
|
|
12843
12960
|
var missingParenErrorLoc;
|
|
12844
12961
|
var result = this.tsTryParseAndCatch(() => {
|
|
12845
12962
|
if (!noCalls && this.atPossibleAsyncArrow(base)) {
|
|
@@ -12852,7 +12969,7 @@
|
|
|
12852
12969
|
|
|
12853
12970
|
var node = this.startNodeAt(startPos, startLoc);
|
|
12854
12971
|
node.callee = base;
|
|
12855
|
-
var typeArguments = this.
|
|
12972
|
+
var typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
12856
12973
|
|
|
12857
12974
|
if (typeArguments) {
|
|
12858
12975
|
if (isOptionalCall && !this.match(10)) {
|
|
@@ -12892,9 +13009,9 @@
|
|
|
12892
13009
|
}
|
|
12893
13010
|
|
|
12894
13011
|
parseNewArguments(node) {
|
|
12895
|
-
if (this.match(
|
|
13012
|
+
if (this.match(47) || this.match(51)) {
|
|
12896
13013
|
var typeParameters = this.tsTryParseAndCatch(() => {
|
|
12897
|
-
var args = this.
|
|
13014
|
+
var args = this.tsParseTypeArgumentsInExpression();
|
|
12898
13015
|
if (!this.match(10)) this.unexpected();
|
|
12899
13016
|
return args;
|
|
12900
13017
|
});
|
|
@@ -12908,7 +13025,7 @@
|
|
|
12908
13025
|
}
|
|
12909
13026
|
|
|
12910
13027
|
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
|
|
12911
|
-
if (tokenOperatorPrecedence(
|
|
13028
|
+
if (tokenOperatorPrecedence(58) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual(93)) {
|
|
12912
13029
|
var node = this.startNodeAt(leftStartPos, leftStartLoc);
|
|
12913
13030
|
node.expression = left;
|
|
12914
13031
|
|
|
@@ -12935,10 +13052,10 @@
|
|
|
12935
13052
|
parseImport(node) {
|
|
12936
13053
|
node.importKind = "value";
|
|
12937
13054
|
|
|
12938
|
-
if (tokenIsIdentifier(this.state.type) || this.match(
|
|
13055
|
+
if (tokenIsIdentifier(this.state.type) || this.match(55) || this.match(5)) {
|
|
12939
13056
|
var ahead = this.lookahead();
|
|
12940
13057
|
|
|
12941
|
-
if (this.isContextual(
|
|
13058
|
+
if (this.isContextual(126) && ahead.type !== 12 && ahead.type !== 97 && ahead.type !== 29) {
|
|
12942
13059
|
node.importKind = "type";
|
|
12943
13060
|
this.next();
|
|
12944
13061
|
ahead = this.lookahead();
|
|
@@ -12961,10 +13078,10 @@
|
|
|
12961
13078
|
}
|
|
12962
13079
|
|
|
12963
13080
|
parseExport(node) {
|
|
12964
|
-
if (this.match(
|
|
13081
|
+
if (this.match(83)) {
|
|
12965
13082
|
this.next();
|
|
12966
13083
|
|
|
12967
|
-
if (this.isContextual(
|
|
13084
|
+
if (this.isContextual(126) && this.lookaheadCharCode() !== 61) {
|
|
12968
13085
|
node.importKind = "type";
|
|
12969
13086
|
this.next();
|
|
12970
13087
|
} else {
|
|
@@ -12977,14 +13094,14 @@
|
|
|
12977
13094
|
assign.expression = this.parseExpression();
|
|
12978
13095
|
this.semicolon();
|
|
12979
13096
|
return this.finishNode(assign, "TSExportAssignment");
|
|
12980
|
-
} else if (this.eatContextual(
|
|
13097
|
+
} else if (this.eatContextual(93)) {
|
|
12981
13098
|
var decl = node;
|
|
12982
|
-
this.expectContextual(
|
|
13099
|
+
this.expectContextual(124);
|
|
12983
13100
|
decl.id = this.parseIdentifier();
|
|
12984
13101
|
this.semicolon();
|
|
12985
13102
|
return this.finishNode(decl, "TSNamespaceExportDeclaration");
|
|
12986
13103
|
} else {
|
|
12987
|
-
if (this.isContextual(
|
|
13104
|
+
if (this.isContextual(126) && this.lookahead().type === 5) {
|
|
12988
13105
|
this.next();
|
|
12989
13106
|
node.exportKind = "type";
|
|
12990
13107
|
} else {
|
|
@@ -12996,7 +13113,7 @@
|
|
|
12996
13113
|
}
|
|
12997
13114
|
|
|
12998
13115
|
isAbstractClass() {
|
|
12999
|
-
return this.isContextual(
|
|
13116
|
+
return this.isContextual(120) && this.lookahead().type === 80;
|
|
13000
13117
|
}
|
|
13001
13118
|
|
|
13002
13119
|
parseExportDefaultExpression() {
|
|
@@ -13008,7 +13125,7 @@
|
|
|
13008
13125
|
return cls;
|
|
13009
13126
|
}
|
|
13010
13127
|
|
|
13011
|
-
if (this.match(
|
|
13128
|
+
if (this.match(125)) {
|
|
13012
13129
|
var interfaceNode = this.startNode();
|
|
13013
13130
|
this.next();
|
|
13014
13131
|
var result = this.tsParseInterfaceDeclaration(interfaceNode);
|
|
@@ -13019,13 +13136,13 @@
|
|
|
13019
13136
|
}
|
|
13020
13137
|
|
|
13021
13138
|
parseStatementContent(context, topLevel) {
|
|
13022
|
-
if (this.state.type ===
|
|
13139
|
+
if (this.state.type === 75) {
|
|
13023
13140
|
var ahead = this.lookahead();
|
|
13024
13141
|
|
|
13025
|
-
if (ahead.type ===
|
|
13142
|
+
if (ahead.type === 122) {
|
|
13026
13143
|
var node = this.startNode();
|
|
13027
13144
|
this.next();
|
|
13028
|
-
this.expectContextual(
|
|
13145
|
+
this.expectContextual(122);
|
|
13029
13146
|
return this.tsParseEnumDeclaration(node, true);
|
|
13030
13147
|
}
|
|
13031
13148
|
}
|
|
@@ -13048,7 +13165,7 @@
|
|
|
13048
13165
|
}
|
|
13049
13166
|
|
|
13050
13167
|
tsIsStartOfStaticBlocks() {
|
|
13051
|
-
return this.isContextual(
|
|
13168
|
+
return this.isContextual(104) && this.lookaheadCharCode() === 123;
|
|
13052
13169
|
}
|
|
13053
13170
|
|
|
13054
13171
|
parseClassMember(classBody, member, state) {
|
|
@@ -13196,9 +13313,9 @@
|
|
|
13196
13313
|
parseExportDeclaration(node) {
|
|
13197
13314
|
var startPos = this.state.start;
|
|
13198
13315
|
var startLoc = this.state.startLoc;
|
|
13199
|
-
var isDeclare = this.eatContextual(
|
|
13316
|
+
var isDeclare = this.eatContextual(121);
|
|
13200
13317
|
|
|
13201
|
-
if (isDeclare && (this.isContextual(
|
|
13318
|
+
if (isDeclare && (this.isContextual(121) || !this.shouldParseExportDeclaration())) {
|
|
13202
13319
|
throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, {
|
|
13203
13320
|
at: this.state.startLoc
|
|
13204
13321
|
});
|
|
@@ -13227,7 +13344,7 @@
|
|
|
13227
13344
|
}
|
|
13228
13345
|
|
|
13229
13346
|
parseClassId(node, isStatement, optionalId) {
|
|
13230
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
13347
|
+
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
13231
13348
|
return;
|
|
13232
13349
|
}
|
|
13233
13350
|
|
|
@@ -13317,11 +13434,11 @@
|
|
|
13317
13434
|
parseClassSuper(node) {
|
|
13318
13435
|
super.parseClassSuper(node);
|
|
13319
13436
|
|
|
13320
|
-
if (node.superClass && this.match(
|
|
13321
|
-
node.superTypeParameters = this.
|
|
13437
|
+
if (node.superClass && (this.match(47) || this.match(51))) {
|
|
13438
|
+
node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
|
|
13322
13439
|
}
|
|
13323
13440
|
|
|
13324
|
-
if (this.eatContextual(
|
|
13441
|
+
if (this.eatContextual(110)) {
|
|
13325
13442
|
node.implements = this.tsParseHeritageClause("implements");
|
|
13326
13443
|
}
|
|
13327
13444
|
}
|
|
@@ -13377,7 +13494,7 @@
|
|
|
13377
13494
|
var jsx;
|
|
13378
13495
|
var typeCast;
|
|
13379
13496
|
|
|
13380
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
13497
|
+
if (this.hasPlugin("jsx") && (this.match(138) || this.match(47))) {
|
|
13381
13498
|
state = this.state.clone();
|
|
13382
13499
|
jsx = this.tryParse(() => super.parseMaybeAssign(...args), state);
|
|
13383
13500
|
if (!jsx.error) return jsx.node;
|
|
@@ -13391,7 +13508,7 @@
|
|
|
13391
13508
|
}
|
|
13392
13509
|
}
|
|
13393
13510
|
|
|
13394
|
-
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(
|
|
13511
|
+
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(47)) {
|
|
13395
13512
|
return super.parseMaybeAssign(...args);
|
|
13396
13513
|
}
|
|
13397
13514
|
|
|
@@ -13459,7 +13576,7 @@
|
|
|
13459
13576
|
}
|
|
13460
13577
|
|
|
13461
13578
|
parseMaybeUnary(refExpressionErrors) {
|
|
13462
|
-
if (!this.hasPlugin("jsx") && this.match(
|
|
13579
|
+
if (!this.hasPlugin("jsx") && this.match(47)) {
|
|
13463
13580
|
return this.tsParseTypeAssertion();
|
|
13464
13581
|
} else {
|
|
13465
13582
|
return super.parseMaybeUnary(refExpressionErrors);
|
|
@@ -13591,7 +13708,7 @@
|
|
|
13591
13708
|
|
|
13592
13709
|
parseBindingAtom() {
|
|
13593
13710
|
switch (this.state.type) {
|
|
13594
|
-
case
|
|
13711
|
+
case 78:
|
|
13595
13712
|
return this.parseIdentifier(true);
|
|
13596
13713
|
|
|
13597
13714
|
default:
|
|
@@ -13600,8 +13717,8 @@
|
|
|
13600
13717
|
}
|
|
13601
13718
|
|
|
13602
13719
|
parseMaybeDecoratorArguments(expr) {
|
|
13603
|
-
if (this.match(
|
|
13604
|
-
var typeArguments = this.
|
|
13720
|
+
if (this.match(47) || this.match(51)) {
|
|
13721
|
+
var typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
13605
13722
|
|
|
13606
13723
|
if (this.match(10)) {
|
|
13607
13724
|
var call = super.parseMaybeDecoratorArguments(expr);
|
|
@@ -13625,7 +13742,7 @@
|
|
|
13625
13742
|
}
|
|
13626
13743
|
|
|
13627
13744
|
isClassMethod() {
|
|
13628
|
-
return this.match(
|
|
13745
|
+
return this.match(47) || super.isClassMethod();
|
|
13629
13746
|
}
|
|
13630
13747
|
|
|
13631
13748
|
isClassProperty() {
|
|
@@ -13647,11 +13764,11 @@
|
|
|
13647
13764
|
getTokenFromCode(code) {
|
|
13648
13765
|
if (this.state.inType) {
|
|
13649
13766
|
if (code === 62) {
|
|
13650
|
-
return this.finishOp(
|
|
13767
|
+
return this.finishOp(48, 1);
|
|
13651
13768
|
}
|
|
13652
13769
|
|
|
13653
13770
|
if (code === 60) {
|
|
13654
|
-
return this.finishOp(
|
|
13771
|
+
return this.finishOp(47, 1);
|
|
13655
13772
|
}
|
|
13656
13773
|
}
|
|
13657
13774
|
|
|
@@ -13663,15 +13780,29 @@
|
|
|
13663
13780
|
type
|
|
13664
13781
|
} = this.state;
|
|
13665
13782
|
|
|
13666
|
-
if (type ===
|
|
13783
|
+
if (type === 47) {
|
|
13667
13784
|
this.state.pos -= 1;
|
|
13668
13785
|
this.readToken_lt();
|
|
13669
|
-
} else if (type ===
|
|
13786
|
+
} else if (type === 48) {
|
|
13670
13787
|
this.state.pos -= 1;
|
|
13671
13788
|
this.readToken_gt();
|
|
13672
13789
|
}
|
|
13673
13790
|
}
|
|
13674
13791
|
|
|
13792
|
+
reScan_lt() {
|
|
13793
|
+
var {
|
|
13794
|
+
type
|
|
13795
|
+
} = this.state;
|
|
13796
|
+
|
|
13797
|
+
if (type === 51) {
|
|
13798
|
+
this.state.pos -= 2;
|
|
13799
|
+
this.finishOp(47, 1);
|
|
13800
|
+
return 47;
|
|
13801
|
+
}
|
|
13802
|
+
|
|
13803
|
+
return type;
|
|
13804
|
+
}
|
|
13805
|
+
|
|
13675
13806
|
toAssignableList(exprList) {
|
|
13676
13807
|
for (var i = 0; i < exprList.length; i++) {
|
|
13677
13808
|
var expr = exprList[i];
|
|
@@ -13722,8 +13853,8 @@
|
|
|
13722
13853
|
}
|
|
13723
13854
|
|
|
13724
13855
|
jsxParseOpeningElementAfterName(node) {
|
|
13725
|
-
if (this.match(
|
|
13726
|
-
var typeArguments = this.tsTryParseAndCatch(() => this.
|
|
13856
|
+
if (this.match(47) || this.match(51)) {
|
|
13857
|
+
var typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
|
|
13727
13858
|
if (typeArguments) node.typeParameters = typeArguments;
|
|
13728
13859
|
}
|
|
13729
13860
|
|
|
@@ -13777,10 +13908,10 @@
|
|
|
13777
13908
|
}
|
|
13778
13909
|
|
|
13779
13910
|
tsParseAbstractDeclaration(node) {
|
|
13780
|
-
if (this.match(
|
|
13911
|
+
if (this.match(80)) {
|
|
13781
13912
|
node.abstract = true;
|
|
13782
13913
|
return this.parseClass(node, true, false);
|
|
13783
|
-
} else if (this.isContextual(
|
|
13914
|
+
} else if (this.isContextual(125)) {
|
|
13784
13915
|
if (!this.hasFollowingLineBreak()) {
|
|
13785
13916
|
node.abstract = true;
|
|
13786
13917
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, {
|
|
@@ -13790,7 +13921,7 @@
|
|
|
13790
13921
|
return this.tsParseInterfaceDeclaration(node);
|
|
13791
13922
|
}
|
|
13792
13923
|
} else {
|
|
13793
|
-
this.unexpected(null,
|
|
13924
|
+
this.unexpected(null, 80);
|
|
13794
13925
|
}
|
|
13795
13926
|
}
|
|
13796
13927
|
|
|
@@ -13867,10 +13998,10 @@
|
|
|
13867
13998
|
var canParseAsKeyword = true;
|
|
13868
13999
|
var loc = leftOfAs.loc.start;
|
|
13869
14000
|
|
|
13870
|
-
if (this.isContextual(
|
|
14001
|
+
if (this.isContextual(93)) {
|
|
13871
14002
|
var firstAs = this.parseIdentifier();
|
|
13872
14003
|
|
|
13873
|
-
if (this.isContextual(
|
|
14004
|
+
if (this.isContextual(93)) {
|
|
13874
14005
|
var secondAs = this.parseIdentifier();
|
|
13875
14006
|
|
|
13876
14007
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
@@ -13905,7 +14036,7 @@
|
|
|
13905
14036
|
var kindKey = isImport ? "importKind" : "exportKind";
|
|
13906
14037
|
node[kindKey] = hasTypeSpecifier ? "type" : "value";
|
|
13907
14038
|
|
|
13908
|
-
if (canParseAsKeyword && this.eatContextual(
|
|
14039
|
+
if (canParseAsKeyword && this.eatContextual(93)) {
|
|
13909
14040
|
node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
|
|
13910
14041
|
}
|
|
13911
14042
|
|
|
@@ -13926,13 +14057,13 @@
|
|
|
13926
14057
|
|
|
13927
14058
|
var placeholders = superClass => class extends superClass {
|
|
13928
14059
|
parsePlaceholder(expectedNode) {
|
|
13929
|
-
if (this.match(
|
|
14060
|
+
if (this.match(140)) {
|
|
13930
14061
|
var node = this.startNode();
|
|
13931
14062
|
this.next();
|
|
13932
14063
|
this.assertNoSpace("Unexpected space in placeholder.");
|
|
13933
14064
|
node.name = super.parseIdentifier(true);
|
|
13934
14065
|
this.assertNoSpace("Unexpected space in placeholder.");
|
|
13935
|
-
this.expect(
|
|
14066
|
+
this.expect(140);
|
|
13936
14067
|
return this.finishPlaceholder(node, expectedNode);
|
|
13937
14068
|
}
|
|
13938
14069
|
}
|
|
@@ -13945,7 +14076,7 @@
|
|
|
13945
14076
|
|
|
13946
14077
|
getTokenFromCode(code) {
|
|
13947
14078
|
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
13948
|
-
return this.finishOp(
|
|
14079
|
+
return this.finishOp(140, 2);
|
|
13949
14080
|
}
|
|
13950
14081
|
|
|
13951
14082
|
return super.getTokenFromCode(...arguments);
|
|
@@ -13985,14 +14116,14 @@
|
|
|
13985
14116
|
return true;
|
|
13986
14117
|
}
|
|
13987
14118
|
|
|
13988
|
-
if (!this.isContextual(
|
|
14119
|
+
if (!this.isContextual(99)) {
|
|
13989
14120
|
return false;
|
|
13990
14121
|
}
|
|
13991
14122
|
|
|
13992
14123
|
if (context) return false;
|
|
13993
14124
|
var nextToken = this.lookahead();
|
|
13994
14125
|
|
|
13995
|
-
if (nextToken.type ===
|
|
14126
|
+
if (nextToken.type === 140) {
|
|
13996
14127
|
return true;
|
|
13997
14128
|
}
|
|
13998
14129
|
|
|
@@ -14038,7 +14169,7 @@
|
|
|
14038
14169
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
14039
14170
|
|
|
14040
14171
|
if (placeholder) {
|
|
14041
|
-
if (this.match(
|
|
14172
|
+
if (this.match(81) || this.match(140) || this.match(5)) {
|
|
14042
14173
|
node.id = placeholder;
|
|
14043
14174
|
} else if (optionalId || !isStatement) {
|
|
14044
14175
|
node.id = null;
|
|
@@ -14062,7 +14193,7 @@
|
|
|
14062
14193
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
14063
14194
|
if (!placeholder) return super.parseExport(...arguments);
|
|
14064
14195
|
|
|
14065
|
-
if (!this.isContextual(
|
|
14196
|
+
if (!this.isContextual(97) && !this.match(12)) {
|
|
14066
14197
|
node.specifiers = [];
|
|
14067
14198
|
node.source = null;
|
|
14068
14199
|
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
@@ -14077,11 +14208,11 @@
|
|
|
14077
14208
|
}
|
|
14078
14209
|
|
|
14079
14210
|
isExportDefaultSpecifier() {
|
|
14080
|
-
if (this.match(
|
|
14211
|
+
if (this.match(65)) {
|
|
14081
14212
|
var next = this.nextTokenStart();
|
|
14082
14213
|
|
|
14083
14214
|
if (this.isUnparsedContextual(next, "from")) {
|
|
14084
|
-
if (this.input.startsWith(tokenLabelName(
|
|
14215
|
+
if (this.input.startsWith(tokenLabelName(140), this.nextTokenStartSince(next + 4))) {
|
|
14085
14216
|
return true;
|
|
14086
14217
|
}
|
|
14087
14218
|
}
|
|
@@ -14116,7 +14247,7 @@
|
|
|
14116
14247
|
if (!placeholder) return super.parseImport(...arguments);
|
|
14117
14248
|
node.specifiers = [];
|
|
14118
14249
|
|
|
14119
|
-
if (!this.isContextual(
|
|
14250
|
+
if (!this.isContextual(97) && !this.match(12)) {
|
|
14120
14251
|
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
|
14121
14252
|
this.semicolon();
|
|
14122
14253
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -14132,7 +14263,7 @@
|
|
|
14132
14263
|
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
|
|
14133
14264
|
}
|
|
14134
14265
|
|
|
14135
|
-
this.expectContextual(
|
|
14266
|
+
this.expectContextual(97);
|
|
14136
14267
|
node.source = this.parseImportSource();
|
|
14137
14268
|
this.semicolon();
|
|
14138
14269
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -14146,7 +14277,7 @@
|
|
|
14146
14277
|
|
|
14147
14278
|
var v8intrinsic = superClass => class extends superClass {
|
|
14148
14279
|
parseV8Intrinsic() {
|
|
14149
|
-
if (this.match(
|
|
14280
|
+
if (this.match(54)) {
|
|
14150
14281
|
var v8IntrinsicStartLoc = this.state.startLoc;
|
|
14151
14282
|
var node = this.startNode();
|
|
14152
14283
|
this.next();
|
|
@@ -14213,7 +14344,7 @@
|
|
|
14213
14344
|
}
|
|
14214
14345
|
|
|
14215
14346
|
var PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
|
|
14216
|
-
var TOPIC_TOKENS = ["^", "%", "#"];
|
|
14347
|
+
var TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
|
|
14217
14348
|
var RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
|
14218
14349
|
|
|
14219
14350
|
function validatePlugins(plugins) {
|
|
@@ -14396,8 +14527,19 @@
|
|
|
14396
14527
|
break;
|
|
14397
14528
|
|
|
14398
14529
|
case "ObjectProperty":
|
|
14399
|
-
|
|
14400
|
-
|
|
14530
|
+
{
|
|
14531
|
+
var {
|
|
14532
|
+
key,
|
|
14533
|
+
value
|
|
14534
|
+
} = node;
|
|
14535
|
+
|
|
14536
|
+
if (this.isPrivateName(key)) {
|
|
14537
|
+
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
|
|
14538
|
+
}
|
|
14539
|
+
|
|
14540
|
+
this.toAssignable(value, isLHS);
|
|
14541
|
+
break;
|
|
14542
|
+
}
|
|
14401
14543
|
|
|
14402
14544
|
case "SpreadElement":
|
|
14403
14545
|
{
|
|
@@ -14637,6 +14779,10 @@
|
|
|
14637
14779
|
|
|
14638
14780
|
if (type === 21) {
|
|
14639
14781
|
return this.parseBindingRestProperty(prop);
|
|
14782
|
+
} else if (type === 134) {
|
|
14783
|
+
this.expectPlugin("destructuringPrivate", startLoc);
|
|
14784
|
+
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
14785
|
+
prop.key = this.parsePrivateName();
|
|
14640
14786
|
} else {
|
|
14641
14787
|
this.parsePropertyName(prop);
|
|
14642
14788
|
}
|
|
@@ -14829,7 +14975,7 @@
|
|
|
14829
14975
|
this.nextToken();
|
|
14830
14976
|
var expr = this.parseExpression();
|
|
14831
14977
|
|
|
14832
|
-
if (!this.match(
|
|
14978
|
+
if (!this.match(135)) {
|
|
14833
14979
|
this.unexpected();
|
|
14834
14980
|
}
|
|
14835
14981
|
|
|
@@ -14890,7 +15036,7 @@
|
|
|
14890
15036
|
var startPos = this.state.start;
|
|
14891
15037
|
var startLoc = this.state.startLoc;
|
|
14892
15038
|
|
|
14893
|
-
if (this.isContextual(
|
|
15039
|
+
if (this.isContextual(105)) {
|
|
14894
15040
|
if (this.prodParam.hasYield) {
|
|
14895
15041
|
var _left2 = this.parseYield();
|
|
14896
15042
|
|
|
@@ -14933,13 +15079,18 @@
|
|
|
14933
15079
|
if (this.match(29)) {
|
|
14934
15080
|
node.left = this.toAssignable(left, true);
|
|
14935
15081
|
|
|
14936
|
-
if (refExpressionErrors.doubleProtoLoc != null &&
|
|
15082
|
+
if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startPos) {
|
|
14937
15083
|
refExpressionErrors.doubleProtoLoc = null;
|
|
14938
15084
|
}
|
|
14939
15085
|
|
|
14940
|
-
if (refExpressionErrors.shorthandAssignLoc != null &&
|
|
15086
|
+
if (refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startPos) {
|
|
14941
15087
|
refExpressionErrors.shorthandAssignLoc = null;
|
|
14942
15088
|
}
|
|
15089
|
+
|
|
15090
|
+
if (refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startPos) {
|
|
15091
|
+
this.checkDestructuringPrivate(refExpressionErrors);
|
|
15092
|
+
refExpressionErrors.privateKeyLoc = null;
|
|
15093
|
+
}
|
|
14943
15094
|
} else {
|
|
14944
15095
|
node.left = left;
|
|
14945
15096
|
}
|
|
@@ -14982,7 +15133,7 @@
|
|
|
14982
15133
|
}
|
|
14983
15134
|
|
|
14984
15135
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
14985
|
-
return this.match(
|
|
15136
|
+
return this.match(134) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
14986
15137
|
}
|
|
14987
15138
|
|
|
14988
15139
|
parseExprOps(refExpressionErrors) {
|
|
@@ -15002,7 +15153,7 @@
|
|
|
15002
15153
|
if (this.isPrivateName(left)) {
|
|
15003
15154
|
var value = this.getPrivateNameSV(left);
|
|
15004
15155
|
|
|
15005
|
-
if (minPrec >= tokenOperatorPrecedence(
|
|
15156
|
+
if (minPrec >= tokenOperatorPrecedence(58) || !this.prodParam.hasIn || !this.match(58)) {
|
|
15006
15157
|
this.raise(ErrorMessages.PrivateInExpectedIn, {
|
|
15007
15158
|
node: left
|
|
15008
15159
|
}, value);
|
|
@@ -15013,11 +15164,11 @@
|
|
|
15013
15164
|
|
|
15014
15165
|
var op = this.state.type;
|
|
15015
15166
|
|
|
15016
|
-
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(
|
|
15167
|
+
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(58))) {
|
|
15017
15168
|
var prec = tokenOperatorPrecedence(op);
|
|
15018
15169
|
|
|
15019
15170
|
if (prec > minPrec) {
|
|
15020
|
-
if (op ===
|
|
15171
|
+
if (op === 39) {
|
|
15021
15172
|
this.expectPlugin("pipelineOperator");
|
|
15022
15173
|
|
|
15023
15174
|
if (this.state.inFSharpPipelineDirectBody) {
|
|
@@ -15030,19 +15181,19 @@
|
|
|
15030
15181
|
var node = this.startNodeAt(leftStartPos, leftStartLoc);
|
|
15031
15182
|
node.left = left;
|
|
15032
15183
|
node.operator = this.state.value;
|
|
15033
|
-
var logical = op ===
|
|
15034
|
-
var coalesce = op ===
|
|
15184
|
+
var logical = op === 41 || op === 42;
|
|
15185
|
+
var coalesce = op === 40;
|
|
15035
15186
|
|
|
15036
15187
|
if (coalesce) {
|
|
15037
|
-
prec = tokenOperatorPrecedence(
|
|
15188
|
+
prec = tokenOperatorPrecedence(42);
|
|
15038
15189
|
}
|
|
15039
15190
|
|
|
15040
15191
|
this.next();
|
|
15041
15192
|
|
|
15042
|
-
if (op ===
|
|
15193
|
+
if (op === 39 && this.hasPlugin(["pipelineOperator", {
|
|
15043
15194
|
proposal: "minimal"
|
|
15044
15195
|
}])) {
|
|
15045
|
-
if (this.state.type ===
|
|
15196
|
+
if (this.state.type === 96 && this.prodParam.hasAwait) {
|
|
15046
15197
|
throw this.raise(ErrorMessages.UnexpectedAwaitAfterPipelineBody, {
|
|
15047
15198
|
at: this.state.startLoc
|
|
15048
15199
|
});
|
|
@@ -15053,7 +15204,7 @@
|
|
|
15053
15204
|
this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
15054
15205
|
var nextOp = this.state.type;
|
|
15055
15206
|
|
|
15056
|
-
if (coalesce && (nextOp ===
|
|
15207
|
+
if (coalesce && (nextOp === 41 || nextOp === 42) || logical && nextOp === 40) {
|
|
15057
15208
|
throw this.raise(ErrorMessages.MixingCoalesceWithLogical, {
|
|
15058
15209
|
at: this.state.startLoc
|
|
15059
15210
|
});
|
|
@@ -15071,7 +15222,7 @@
|
|
|
15071
15222
|
var startLoc = this.state.startLoc;
|
|
15072
15223
|
|
|
15073
15224
|
switch (op) {
|
|
15074
|
-
case
|
|
15225
|
+
case 39:
|
|
15075
15226
|
switch (this.getPluginOption("pipelineOperator", "proposal")) {
|
|
15076
15227
|
case "hack":
|
|
15077
15228
|
return this.withTopicBindingContext(() => {
|
|
@@ -15080,7 +15231,7 @@
|
|
|
15080
15231
|
|
|
15081
15232
|
case "smart":
|
|
15082
15233
|
return this.withTopicBindingContext(() => {
|
|
15083
|
-
if (this.prodParam.hasYield && this.isContextual(
|
|
15234
|
+
if (this.prodParam.hasYield && this.isContextual(105)) {
|
|
15084
15235
|
throw this.raise(ErrorMessages.PipeBodyIsTighter, {
|
|
15085
15236
|
at: this.state.startLoc
|
|
15086
15237
|
}, this.state.value);
|
|
@@ -15130,7 +15281,7 @@
|
|
|
15130
15281
|
}
|
|
15131
15282
|
|
|
15132
15283
|
checkExponentialAfterUnary(node) {
|
|
15133
|
-
if (this.match(
|
|
15284
|
+
if (this.match(57)) {
|
|
15134
15285
|
this.raise(ErrorMessages.UnexpectedTokenUnaryExponentiation, {
|
|
15135
15286
|
node: node.argument
|
|
15136
15287
|
});
|
|
@@ -15140,7 +15291,7 @@
|
|
|
15140
15291
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
15141
15292
|
var startPos = this.state.start;
|
|
15142
15293
|
var startLoc = this.state.startLoc;
|
|
15143
|
-
var isAwait = this.isContextual(
|
|
15294
|
+
var isAwait = this.isContextual(96);
|
|
15144
15295
|
|
|
15145
15296
|
if (isAwait && this.isAwaitAllowed()) {
|
|
15146
15297
|
this.next();
|
|
@@ -15158,11 +15309,11 @@
|
|
|
15158
15309
|
node.operator = this.state.value;
|
|
15159
15310
|
node.prefix = true;
|
|
15160
15311
|
|
|
15161
|
-
if (this.match(
|
|
15312
|
+
if (this.match(72)) {
|
|
15162
15313
|
this.expectPlugin("throwExpressions");
|
|
15163
15314
|
}
|
|
15164
15315
|
|
|
15165
|
-
var isDelete = this.match(
|
|
15316
|
+
var isDelete = this.match(89);
|
|
15166
15317
|
this.next();
|
|
15167
15318
|
node.argument = this.parseMaybeUnary(null, true);
|
|
15168
15319
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
@@ -15194,7 +15345,7 @@
|
|
|
15194
15345
|
type
|
|
15195
15346
|
} = this.state;
|
|
15196
15347
|
|
|
15197
|
-
var _startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(
|
|
15348
|
+
var _startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54);
|
|
15198
15349
|
|
|
15199
15350
|
if (_startsExpr && !this.isAmbiguousAwait()) {
|
|
15200
15351
|
this.raiseOverwrite(startLoc, ErrorMessages.AwaitNotInAsyncContext);
|
|
@@ -15303,7 +15454,7 @@
|
|
|
15303
15454
|
if (computed) {
|
|
15304
15455
|
node.property = this.parseExpression();
|
|
15305
15456
|
this.expect(3);
|
|
15306
|
-
} else if (this.match(
|
|
15457
|
+
} else if (this.match(134)) {
|
|
15307
15458
|
if (base.type === "Super") {
|
|
15308
15459
|
this.raise(ErrorMessages.SuperPrivateField, {
|
|
15309
15460
|
at: startLoc
|
|
@@ -15340,13 +15491,17 @@
|
|
|
15340
15491
|
this.next();
|
|
15341
15492
|
var node = this.startNodeAt(startPos, startLoc);
|
|
15342
15493
|
node.callee = base;
|
|
15494
|
+
var {
|
|
15495
|
+
maybeAsyncArrow,
|
|
15496
|
+
optionalChainMember
|
|
15497
|
+
} = state;
|
|
15343
15498
|
|
|
15344
|
-
if (
|
|
15499
|
+
if (maybeAsyncArrow) {
|
|
15345
15500
|
this.expressionScope.enter(newAsyncArrowScope());
|
|
15346
15501
|
refExpressionErrors = new ExpressionErrors();
|
|
15347
15502
|
}
|
|
15348
15503
|
|
|
15349
|
-
if (
|
|
15504
|
+
if (optionalChainMember) {
|
|
15350
15505
|
node.optional = optional;
|
|
15351
15506
|
}
|
|
15352
15507
|
|
|
@@ -15356,15 +15511,16 @@
|
|
|
15356
15511
|
node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
|
|
15357
15512
|
}
|
|
15358
15513
|
|
|
15359
|
-
this.finishCallExpression(node,
|
|
15514
|
+
this.finishCallExpression(node, optionalChainMember);
|
|
15360
15515
|
|
|
15361
|
-
if (
|
|
15516
|
+
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
|
|
15362
15517
|
state.stop = true;
|
|
15518
|
+
this.checkDestructuringPrivate(refExpressionErrors);
|
|
15363
15519
|
this.expressionScope.validateAsPattern();
|
|
15364
15520
|
this.expressionScope.exit();
|
|
15365
15521
|
node = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node);
|
|
15366
15522
|
} else {
|
|
15367
|
-
if (
|
|
15523
|
+
if (maybeAsyncArrow) {
|
|
15368
15524
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
15369
15525
|
this.expressionScope.exit();
|
|
15370
15526
|
}
|
|
@@ -15395,7 +15551,7 @@
|
|
|
15395
15551
|
}
|
|
15396
15552
|
|
|
15397
15553
|
atPossibleAsyncArrow(base) {
|
|
15398
|
-
return base.type === "Identifier" && base.name === "async" &&
|
|
15554
|
+
return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
|
|
15399
15555
|
}
|
|
15400
15556
|
|
|
15401
15557
|
finishCallExpression(node, optional) {
|
|
@@ -15496,10 +15652,10 @@
|
|
|
15496
15652
|
} = this.state;
|
|
15497
15653
|
|
|
15498
15654
|
switch (type) {
|
|
15499
|
-
case
|
|
15655
|
+
case 79:
|
|
15500
15656
|
return this.parseSuper();
|
|
15501
15657
|
|
|
15502
|
-
case
|
|
15658
|
+
case 83:
|
|
15503
15659
|
node = this.startNode();
|
|
15504
15660
|
this.next();
|
|
15505
15661
|
|
|
@@ -15515,42 +15671,42 @@
|
|
|
15515
15671
|
|
|
15516
15672
|
return this.finishNode(node, "Import");
|
|
15517
15673
|
|
|
15518
|
-
case
|
|
15674
|
+
case 78:
|
|
15519
15675
|
node = this.startNode();
|
|
15520
15676
|
this.next();
|
|
15521
15677
|
return this.finishNode(node, "ThisExpression");
|
|
15522
15678
|
|
|
15523
|
-
case
|
|
15679
|
+
case 90:
|
|
15524
15680
|
{
|
|
15525
15681
|
return this.parseDo(this.startNode(), false);
|
|
15526
15682
|
}
|
|
15527
15683
|
|
|
15528
|
-
case
|
|
15684
|
+
case 56:
|
|
15529
15685
|
case 31:
|
|
15530
15686
|
{
|
|
15531
15687
|
this.readRegexp();
|
|
15532
15688
|
return this.parseRegExpLiteral(this.state.value);
|
|
15533
15689
|
}
|
|
15534
15690
|
|
|
15535
|
-
case
|
|
15691
|
+
case 130:
|
|
15536
15692
|
return this.parseNumericLiteral(this.state.value);
|
|
15537
15693
|
|
|
15538
|
-
case
|
|
15694
|
+
case 131:
|
|
15539
15695
|
return this.parseBigIntLiteral(this.state.value);
|
|
15540
15696
|
|
|
15541
|
-
case
|
|
15697
|
+
case 132:
|
|
15542
15698
|
return this.parseDecimalLiteral(this.state.value);
|
|
15543
15699
|
|
|
15544
|
-
case
|
|
15700
|
+
case 129:
|
|
15545
15701
|
return this.parseStringLiteral(this.state.value);
|
|
15546
15702
|
|
|
15547
|
-
case
|
|
15703
|
+
case 84:
|
|
15548
15704
|
return this.parseNullLiteral();
|
|
15549
15705
|
|
|
15550
|
-
case
|
|
15706
|
+
case 85:
|
|
15551
15707
|
return this.parseBooleanLiteral(true);
|
|
15552
15708
|
|
|
15553
|
-
case
|
|
15709
|
+
case 86:
|
|
15554
15710
|
return this.parseBooleanLiteral(false);
|
|
15555
15711
|
|
|
15556
15712
|
case 10:
|
|
@@ -15581,18 +15737,18 @@
|
|
|
15581
15737
|
return this.parseObjectLike(8, false, false, refExpressionErrors);
|
|
15582
15738
|
}
|
|
15583
15739
|
|
|
15584
|
-
case
|
|
15740
|
+
case 68:
|
|
15585
15741
|
return this.parseFunctionOrFunctionSent();
|
|
15586
15742
|
|
|
15587
15743
|
case 26:
|
|
15588
15744
|
this.parseDecorators();
|
|
15589
15745
|
|
|
15590
|
-
case
|
|
15746
|
+
case 80:
|
|
15591
15747
|
node = this.startNode();
|
|
15592
15748
|
this.takeDecorators(node);
|
|
15593
15749
|
return this.parseClass(node, false);
|
|
15594
15750
|
|
|
15595
|
-
case
|
|
15751
|
+
case 77:
|
|
15596
15752
|
return this.parseNewOrNewTarget();
|
|
15597
15753
|
|
|
15598
15754
|
case 25:
|
|
@@ -15615,7 +15771,7 @@
|
|
|
15615
15771
|
}
|
|
15616
15772
|
}
|
|
15617
15773
|
|
|
15618
|
-
case
|
|
15774
|
+
case 134:
|
|
15619
15775
|
{
|
|
15620
15776
|
this.raise(ErrorMessages.PrivateInExpectedIn, {
|
|
15621
15777
|
at: this.state.startLoc
|
|
@@ -15625,16 +15781,22 @@
|
|
|
15625
15781
|
|
|
15626
15782
|
case 33:
|
|
15627
15783
|
{
|
|
15628
|
-
return this.parseTopicReferenceThenEqualsSign(
|
|
15784
|
+
return this.parseTopicReferenceThenEqualsSign(54, "%");
|
|
15629
15785
|
}
|
|
15630
15786
|
|
|
15631
15787
|
case 32:
|
|
15632
15788
|
{
|
|
15633
|
-
return this.parseTopicReferenceThenEqualsSign(
|
|
15789
|
+
return this.parseTopicReferenceThenEqualsSign(44, "^");
|
|
15634
15790
|
}
|
|
15635
15791
|
|
|
15636
|
-
case
|
|
15637
|
-
case
|
|
15792
|
+
case 37:
|
|
15793
|
+
case 38:
|
|
15794
|
+
{
|
|
15795
|
+
return this.parseTopicReference("hack");
|
|
15796
|
+
}
|
|
15797
|
+
|
|
15798
|
+
case 44:
|
|
15799
|
+
case 54:
|
|
15638
15800
|
case 27:
|
|
15639
15801
|
{
|
|
15640
15802
|
var pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
|
|
@@ -15646,7 +15808,7 @@
|
|
|
15646
15808
|
}
|
|
15647
15809
|
}
|
|
15648
15810
|
|
|
15649
|
-
case
|
|
15811
|
+
case 47:
|
|
15650
15812
|
{
|
|
15651
15813
|
var lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
15652
15814
|
|
|
@@ -15660,7 +15822,7 @@
|
|
|
15660
15822
|
|
|
15661
15823
|
default:
|
|
15662
15824
|
if (tokenIsIdentifier(type)) {
|
|
15663
|
-
if (this.isContextual(
|
|
15825
|
+
if (this.isContextual(123) && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) {
|
|
15664
15826
|
return this.parseModuleExpression();
|
|
15665
15827
|
}
|
|
15666
15828
|
|
|
@@ -15674,7 +15836,7 @@
|
|
|
15674
15836
|
type: _type
|
|
15675
15837
|
} = this.state;
|
|
15676
15838
|
|
|
15677
|
-
if (_type ===
|
|
15839
|
+
if (_type === 68) {
|
|
15678
15840
|
this.resetPreviousNodeTrailingComments(id);
|
|
15679
15841
|
this.next();
|
|
15680
15842
|
return this.parseFunction(this.startNodeAtNode(id), undefined, true);
|
|
@@ -15684,7 +15846,7 @@
|
|
|
15684
15846
|
} else {
|
|
15685
15847
|
return id;
|
|
15686
15848
|
}
|
|
15687
|
-
} else if (_type ===
|
|
15849
|
+
} else if (_type === 90) {
|
|
15688
15850
|
this.resetPreviousNodeTrailingComments(id);
|
|
15689
15851
|
return this.parseDo(this.startNodeAtNode(id), true);
|
|
15690
15852
|
}
|
|
@@ -15844,7 +16006,7 @@
|
|
|
15844
16006
|
var meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
15845
16007
|
this.next();
|
|
15846
16008
|
|
|
15847
|
-
if (this.match(
|
|
16009
|
+
if (this.match(102)) {
|
|
15848
16010
|
this.expectPlugin("functionSent");
|
|
15849
16011
|
} else if (!this.hasPlugin("functionSent")) {
|
|
15850
16012
|
this.unexpected();
|
|
@@ -15874,7 +16036,7 @@
|
|
|
15874
16036
|
var id = this.createIdentifier(this.startNodeAtNode(node), "import");
|
|
15875
16037
|
this.next();
|
|
15876
16038
|
|
|
15877
|
-
if (this.isContextual(
|
|
16039
|
+
if (this.isContextual(100)) {
|
|
15878
16040
|
if (!this.inModule) {
|
|
15879
16041
|
this.raise(SourceTypeModuleErrorMessages.ImportMetaOutsideModule, {
|
|
15880
16042
|
node: id
|
|
@@ -15987,6 +16149,7 @@
|
|
|
15987
16149
|
var arrowNode = this.startNodeAt(startPos, startLoc);
|
|
15988
16150
|
|
|
15989
16151
|
if (canBeArrow && this.shouldParseArrow(exprList) && (arrowNode = this.parseArrow(arrowNode))) {
|
|
16152
|
+
this.checkDestructuringPrivate(refExpressionErrors);
|
|
15990
16153
|
this.expressionScope.validateAsPattern();
|
|
15991
16154
|
this.expressionScope.exit();
|
|
15992
16155
|
this.parseArrowExpression(arrowNode, exprList, false);
|
|
@@ -16016,7 +16179,7 @@
|
|
|
16016
16179
|
if (!this.options.createParenthesizedExpressions) {
|
|
16017
16180
|
this.addExtra(val, "parenthesized", true);
|
|
16018
16181
|
this.addExtra(val, "parenStart", startPos);
|
|
16019
|
-
this.takeSurroundingComments(val, startPos,
|
|
16182
|
+
this.takeSurroundingComments(val, startPos, this.state.lastTokEndLoc.index);
|
|
16020
16183
|
return val;
|
|
16021
16184
|
}
|
|
16022
16185
|
|
|
@@ -16209,7 +16372,7 @@
|
|
|
16209
16372
|
}
|
|
16210
16373
|
|
|
16211
16374
|
maybeAsyncOrAccessorProp(prop) {
|
|
16212
|
-
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(
|
|
16375
|
+
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(55));
|
|
16213
16376
|
}
|
|
16214
16377
|
|
|
16215
16378
|
parsePropertyDefinition(refExpressionErrors) {
|
|
@@ -16250,10 +16413,10 @@
|
|
|
16250
16413
|
startLoc = this.state.startLoc;
|
|
16251
16414
|
}
|
|
16252
16415
|
|
|
16253
|
-
var isGenerator = this.eat(
|
|
16416
|
+
var isGenerator = this.eat(55);
|
|
16254
16417
|
this.parsePropertyNamePrefixOperator(prop);
|
|
16255
16418
|
var containsEsc = this.state.containsEsc;
|
|
16256
|
-
var key = this.parsePropertyName(prop);
|
|
16419
|
+
var key = this.parsePropertyName(prop, refExpressionErrors);
|
|
16257
16420
|
|
|
16258
16421
|
if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
|
|
16259
16422
|
var keyName = key.name;
|
|
@@ -16261,7 +16424,7 @@
|
|
|
16261
16424
|
if (keyName === "async" && !this.hasPrecedingLineBreak()) {
|
|
16262
16425
|
isAsync = true;
|
|
16263
16426
|
this.resetPreviousNodeTrailingComments(key);
|
|
16264
|
-
isGenerator = this.eat(
|
|
16427
|
+
isGenerator = this.eat(55);
|
|
16265
16428
|
this.parsePropertyName(prop);
|
|
16266
16429
|
}
|
|
16267
16430
|
|
|
@@ -16270,7 +16433,7 @@
|
|
|
16270
16433
|
this.resetPreviousNodeTrailingComments(key);
|
|
16271
16434
|
prop.kind = keyName;
|
|
16272
16435
|
|
|
16273
|
-
if (this.match(
|
|
16436
|
+
if (this.match(55)) {
|
|
16274
16437
|
isGenerator = true;
|
|
16275
16438
|
this.raise(ErrorMessages.AccessorIsGenerator, {
|
|
16276
16439
|
at: this.state.curPosition()
|
|
@@ -16370,7 +16533,7 @@
|
|
|
16370
16533
|
return node;
|
|
16371
16534
|
}
|
|
16372
16535
|
|
|
16373
|
-
parsePropertyName(prop) {
|
|
16536
|
+
parsePropertyName(prop, refExpressionErrors) {
|
|
16374
16537
|
if (this.eat(0)) {
|
|
16375
16538
|
prop.computed = true;
|
|
16376
16539
|
prop.key = this.parseMaybeAssignAllowIn();
|
|
@@ -16386,27 +16549,36 @@
|
|
|
16386
16549
|
key = this.parseIdentifier(true);
|
|
16387
16550
|
} else {
|
|
16388
16551
|
switch (type) {
|
|
16389
|
-
case
|
|
16552
|
+
case 130:
|
|
16390
16553
|
key = this.parseNumericLiteral(value);
|
|
16391
16554
|
break;
|
|
16392
16555
|
|
|
16393
|
-
case
|
|
16556
|
+
case 129:
|
|
16394
16557
|
key = this.parseStringLiteral(value);
|
|
16395
16558
|
break;
|
|
16396
16559
|
|
|
16397
|
-
case
|
|
16560
|
+
case 131:
|
|
16398
16561
|
key = this.parseBigIntLiteral(value);
|
|
16399
16562
|
break;
|
|
16400
16563
|
|
|
16401
|
-
case
|
|
16564
|
+
case 132:
|
|
16402
16565
|
key = this.parseDecimalLiteral(value);
|
|
16403
16566
|
break;
|
|
16404
16567
|
|
|
16405
|
-
case
|
|
16568
|
+
case 134:
|
|
16406
16569
|
{
|
|
16407
|
-
this.
|
|
16408
|
-
|
|
16409
|
-
|
|
16570
|
+
var privateKeyLoc = this.state.startLoc;
|
|
16571
|
+
|
|
16572
|
+
if (refExpressionErrors != null) {
|
|
16573
|
+
if (refExpressionErrors.privateKeyLoc === null) {
|
|
16574
|
+
refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
16575
|
+
}
|
|
16576
|
+
} else {
|
|
16577
|
+
this.raise(ErrorMessages.UnexpectedPrivateField, {
|
|
16578
|
+
at: privateKeyLoc
|
|
16579
|
+
});
|
|
16580
|
+
}
|
|
16581
|
+
|
|
16410
16582
|
key = this.parsePrivateName();
|
|
16411
16583
|
break;
|
|
16412
16584
|
}
|
|
@@ -16418,7 +16590,7 @@
|
|
|
16418
16590
|
|
|
16419
16591
|
prop.key = key;
|
|
16420
16592
|
|
|
16421
|
-
if (type !==
|
|
16593
|
+
if (type !== 134) {
|
|
16422
16594
|
prop.computed = false;
|
|
16423
16595
|
}
|
|
16424
16596
|
}
|
|
@@ -16640,7 +16812,7 @@
|
|
|
16640
16812
|
|
|
16641
16813
|
if (liberal) {
|
|
16642
16814
|
if (tokenIsKeyword) {
|
|
16643
|
-
this.replaceToken(
|
|
16815
|
+
this.replaceToken(128);
|
|
16644
16816
|
}
|
|
16645
16817
|
} else {
|
|
16646
16818
|
this.checkReservedWord(name, startLoc, tokenIsKeyword, false);
|
|
@@ -16721,7 +16893,7 @@
|
|
|
16721
16893
|
var node = this.startNodeAt(startPos, startLoc);
|
|
16722
16894
|
this.expressionScope.recordParameterInitializerError(node.loc.start, ErrorMessages.AwaitExpressionFormalParameter);
|
|
16723
16895
|
|
|
16724
|
-
if (this.eat(
|
|
16896
|
+
if (this.eat(55)) {
|
|
16725
16897
|
this.raise(ErrorMessages.ObsoleteAwaitStar, {
|
|
16726
16898
|
node
|
|
16727
16899
|
});
|
|
@@ -16747,7 +16919,7 @@
|
|
|
16747
16919
|
var {
|
|
16748
16920
|
type
|
|
16749
16921
|
} = this.state;
|
|
16750
|
-
return type ===
|
|
16922
|
+
return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 133 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
|
|
16751
16923
|
}
|
|
16752
16924
|
|
|
16753
16925
|
parseYield() {
|
|
@@ -16758,11 +16930,11 @@
|
|
|
16758
16930
|
var argument = null;
|
|
16759
16931
|
|
|
16760
16932
|
if (!this.hasPrecedingLineBreak()) {
|
|
16761
|
-
delegating = this.eat(
|
|
16933
|
+
delegating = this.eat(55);
|
|
16762
16934
|
|
|
16763
16935
|
switch (this.state.type) {
|
|
16764
16936
|
case 13:
|
|
16765
|
-
case
|
|
16937
|
+
case 135:
|
|
16766
16938
|
case 8:
|
|
16767
16939
|
case 11:
|
|
16768
16940
|
case 3:
|
|
@@ -16980,7 +17152,7 @@
|
|
|
16980
17152
|
|
|
16981
17153
|
if (typeof type === "number") {
|
|
16982
17154
|
{
|
|
16983
|
-
if (type ===
|
|
17155
|
+
if (type === 134) {
|
|
16984
17156
|
var {
|
|
16985
17157
|
loc,
|
|
16986
17158
|
start,
|
|
@@ -16997,7 +17169,7 @@
|
|
|
16997
17169
|
startLoc: loc.start,
|
|
16998
17170
|
endLoc: hashEndLoc
|
|
16999
17171
|
}), new Token({
|
|
17000
|
-
type: getExportedToken(
|
|
17172
|
+
type: getExportedToken(128),
|
|
17001
17173
|
value: value,
|
|
17002
17174
|
start: hashEndPos,
|
|
17003
17175
|
end: end,
|
|
@@ -17102,7 +17274,7 @@
|
|
|
17102
17274
|
}
|
|
17103
17275
|
|
|
17104
17276
|
parseProgram(program) {
|
|
17105
|
-
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
17277
|
+
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 135;
|
|
17106
17278
|
var sourceType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.sourceType;
|
|
17107
17279
|
program.sourceType = sourceType;
|
|
17108
17280
|
program.interpreter = this.parseInterpreterDirective();
|
|
@@ -17147,7 +17319,7 @@
|
|
|
17147
17319
|
}
|
|
17148
17320
|
|
|
17149
17321
|
isLet(context) {
|
|
17150
|
-
if (!this.isContextual(
|
|
17322
|
+
if (!this.isContextual(99)) {
|
|
17151
17323
|
return false;
|
|
17152
17324
|
}
|
|
17153
17325
|
|
|
@@ -17196,27 +17368,27 @@
|
|
|
17196
17368
|
var kind;
|
|
17197
17369
|
|
|
17198
17370
|
if (this.isLet(context)) {
|
|
17199
|
-
starttype =
|
|
17371
|
+
starttype = 74;
|
|
17200
17372
|
kind = "let";
|
|
17201
17373
|
}
|
|
17202
17374
|
|
|
17203
17375
|
switch (starttype) {
|
|
17204
|
-
case
|
|
17376
|
+
case 60:
|
|
17205
17377
|
return this.parseBreakContinueStatement(node, true);
|
|
17206
17378
|
|
|
17207
|
-
case
|
|
17379
|
+
case 63:
|
|
17208
17380
|
return this.parseBreakContinueStatement(node, false);
|
|
17209
17381
|
|
|
17210
|
-
case
|
|
17382
|
+
case 64:
|
|
17211
17383
|
return this.parseDebuggerStatement(node);
|
|
17212
17384
|
|
|
17213
|
-
case
|
|
17385
|
+
case 90:
|
|
17214
17386
|
return this.parseDoStatement(node);
|
|
17215
17387
|
|
|
17216
|
-
case
|
|
17388
|
+
case 91:
|
|
17217
17389
|
return this.parseForStatement(node);
|
|
17218
17390
|
|
|
17219
|
-
case
|
|
17391
|
+
case 68:
|
|
17220
17392
|
if (this.lookaheadCharCode() === 46) break;
|
|
17221
17393
|
|
|
17222
17394
|
if (context) {
|
|
@@ -17233,27 +17405,27 @@
|
|
|
17233
17405
|
|
|
17234
17406
|
return this.parseFunctionStatement(node, false, !context);
|
|
17235
17407
|
|
|
17236
|
-
case
|
|
17408
|
+
case 80:
|
|
17237
17409
|
if (context) this.unexpected();
|
|
17238
17410
|
return this.parseClass(node, true);
|
|
17239
17411
|
|
|
17240
|
-
case
|
|
17412
|
+
case 69:
|
|
17241
17413
|
return this.parseIfStatement(node);
|
|
17242
17414
|
|
|
17243
|
-
case
|
|
17415
|
+
case 70:
|
|
17244
17416
|
return this.parseReturnStatement(node);
|
|
17245
17417
|
|
|
17246
|
-
case
|
|
17418
|
+
case 71:
|
|
17247
17419
|
return this.parseSwitchStatement(node);
|
|
17248
17420
|
|
|
17249
|
-
case
|
|
17421
|
+
case 72:
|
|
17250
17422
|
return this.parseThrowStatement(node);
|
|
17251
17423
|
|
|
17252
|
-
case
|
|
17424
|
+
case 73:
|
|
17253
17425
|
return this.parseTryStatement(node);
|
|
17254
17426
|
|
|
17255
|
-
case
|
|
17256
|
-
case
|
|
17427
|
+
case 75:
|
|
17428
|
+
case 74:
|
|
17257
17429
|
kind = kind || this.state.value;
|
|
17258
17430
|
|
|
17259
17431
|
if (context && kind !== "var") {
|
|
@@ -17264,10 +17436,10 @@
|
|
|
17264
17436
|
|
|
17265
17437
|
return this.parseVarStatement(node, kind);
|
|
17266
17438
|
|
|
17267
|
-
case
|
|
17439
|
+
case 92:
|
|
17268
17440
|
return this.parseWhileStatement(node);
|
|
17269
17441
|
|
|
17270
|
-
case
|
|
17442
|
+
case 76:
|
|
17271
17443
|
return this.parseWithStatement(node);
|
|
17272
17444
|
|
|
17273
17445
|
case 5:
|
|
@@ -17276,7 +17448,7 @@
|
|
|
17276
17448
|
case 13:
|
|
17277
17449
|
return this.parseEmptyStatement(node);
|
|
17278
17450
|
|
|
17279
|
-
case
|
|
17451
|
+
case 83:
|
|
17280
17452
|
{
|
|
17281
17453
|
var nextTokenCharCode = this.lookaheadCharCode();
|
|
17282
17454
|
|
|
@@ -17285,7 +17457,7 @@
|
|
|
17285
17457
|
}
|
|
17286
17458
|
}
|
|
17287
17459
|
|
|
17288
|
-
case
|
|
17460
|
+
case 82:
|
|
17289
17461
|
{
|
|
17290
17462
|
if (!this.options.allowImportExportEverywhere && !topLevel) {
|
|
17291
17463
|
this.raise(ErrorMessages.UnexpectedImportExport, {
|
|
@@ -17296,7 +17468,7 @@
|
|
|
17296
17468
|
this.next();
|
|
17297
17469
|
var result;
|
|
17298
17470
|
|
|
17299
|
-
if (starttype ===
|
|
17471
|
+
if (starttype === 83) {
|
|
17300
17472
|
result = this.parseImport(node);
|
|
17301
17473
|
|
|
17302
17474
|
if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
|
|
@@ -17358,7 +17530,7 @@
|
|
|
17358
17530
|
}
|
|
17359
17531
|
|
|
17360
17532
|
canHaveLeadingDecorator() {
|
|
17361
|
-
return this.match(
|
|
17533
|
+
return this.match(80);
|
|
17362
17534
|
}
|
|
17363
17535
|
|
|
17364
17536
|
parseDecorators(allowExport) {
|
|
@@ -17369,7 +17541,7 @@
|
|
|
17369
17541
|
currentContextDecorators.push(decorator);
|
|
17370
17542
|
}
|
|
17371
17543
|
|
|
17372
|
-
if (this.match(
|
|
17544
|
+
if (this.match(82)) {
|
|
17373
17545
|
if (!allowExport) {
|
|
17374
17546
|
this.unexpected();
|
|
17375
17547
|
}
|
|
@@ -17485,7 +17657,7 @@
|
|
|
17485
17657
|
this.state.labels.push(loopLabel);
|
|
17486
17658
|
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("do"));
|
|
17487
17659
|
this.state.labels.pop();
|
|
17488
|
-
this.expect(
|
|
17660
|
+
this.expect(92);
|
|
17489
17661
|
node.test = this.parseHeaderExpression();
|
|
17490
17662
|
this.eat(13);
|
|
17491
17663
|
return this.finishNode(node, "DoWhileStatement");
|
|
@@ -17496,7 +17668,7 @@
|
|
|
17496
17668
|
this.state.labels.push(loopLabel);
|
|
17497
17669
|
var awaitAt = null;
|
|
17498
17670
|
|
|
17499
|
-
if (this.isAwaitAllowed() && this.eatContextual(
|
|
17671
|
+
if (this.isAwaitAllowed() && this.eatContextual(96)) {
|
|
17500
17672
|
awaitAt = this.state.lastTokStartLoc;
|
|
17501
17673
|
}
|
|
17502
17674
|
|
|
@@ -17511,10 +17683,10 @@
|
|
|
17511
17683
|
return this.parseFor(node, null);
|
|
17512
17684
|
}
|
|
17513
17685
|
|
|
17514
|
-
var startsWithLet = this.isContextual(
|
|
17686
|
+
var startsWithLet = this.isContextual(99);
|
|
17515
17687
|
var isLet = startsWithLet && this.isLetKeyword();
|
|
17516
17688
|
|
|
17517
|
-
if (this.match(
|
|
17689
|
+
if (this.match(74) || this.match(75) || isLet) {
|
|
17518
17690
|
var _init = this.startNode();
|
|
17519
17691
|
|
|
17520
17692
|
var kind = isLet ? "let" : this.state.value;
|
|
@@ -17522,7 +17694,7 @@
|
|
|
17522
17694
|
this.parseVar(_init, true, kind);
|
|
17523
17695
|
this.finishNode(_init, "VariableDeclaration");
|
|
17524
17696
|
|
|
17525
|
-
if ((this.match(
|
|
17697
|
+
if ((this.match(58) || this.isContextual(101)) && _init.declarations.length === 1) {
|
|
17526
17698
|
return this.parseForIn(node, _init, awaitAt);
|
|
17527
17699
|
}
|
|
17528
17700
|
|
|
@@ -17533,10 +17705,10 @@
|
|
|
17533
17705
|
return this.parseFor(node, _init);
|
|
17534
17706
|
}
|
|
17535
17707
|
|
|
17536
|
-
var startsWithAsync = this.isContextual(
|
|
17708
|
+
var startsWithAsync = this.isContextual(95);
|
|
17537
17709
|
var refExpressionErrors = new ExpressionErrors();
|
|
17538
17710
|
var init = this.parseExpression(true, refExpressionErrors);
|
|
17539
|
-
var isForOf = this.isContextual(
|
|
17711
|
+
var isForOf = this.isContextual(101);
|
|
17540
17712
|
|
|
17541
17713
|
if (isForOf) {
|
|
17542
17714
|
if (startsWithLet) {
|
|
@@ -17552,7 +17724,8 @@
|
|
|
17552
17724
|
}
|
|
17553
17725
|
}
|
|
17554
17726
|
|
|
17555
|
-
if (isForOf || this.match(
|
|
17727
|
+
if (isForOf || this.match(58)) {
|
|
17728
|
+
this.checkDestructuringPrivate(refExpressionErrors);
|
|
17556
17729
|
this.toAssignable(init, true);
|
|
17557
17730
|
var description = isForOf ? "for-of statement" : "for-in statement";
|
|
17558
17731
|
this.checkLVal(init, description);
|
|
@@ -17577,7 +17750,7 @@
|
|
|
17577
17750
|
this.next();
|
|
17578
17751
|
node.test = this.parseHeaderExpression();
|
|
17579
17752
|
node.consequent = this.parseStatement("if");
|
|
17580
|
-
node.alternate = this.eat(
|
|
17753
|
+
node.alternate = this.eat(66) ? this.parseStatement("if") : null;
|
|
17581
17754
|
return this.finishNode(node, "IfStatement");
|
|
17582
17755
|
}
|
|
17583
17756
|
|
|
@@ -17610,8 +17783,8 @@
|
|
|
17610
17783
|
var cur;
|
|
17611
17784
|
|
|
17612
17785
|
for (var sawDefault; !this.match(8);) {
|
|
17613
|
-
if (this.match(
|
|
17614
|
-
var isCase = this.match(
|
|
17786
|
+
if (this.match(61) || this.match(65)) {
|
|
17787
|
+
var isCase = this.match(61);
|
|
17615
17788
|
if (cur) this.finishNode(cur, "SwitchCase");
|
|
17616
17789
|
cases.push(cur = this.startNode());
|
|
17617
17790
|
cur.consequent = [];
|
|
@@ -17674,7 +17847,7 @@
|
|
|
17674
17847
|
node.block = this.parseBlock();
|
|
17675
17848
|
node.handler = null;
|
|
17676
17849
|
|
|
17677
|
-
if (this.match(
|
|
17850
|
+
if (this.match(62)) {
|
|
17678
17851
|
var clause = this.startNode();
|
|
17679
17852
|
this.next();
|
|
17680
17853
|
|
|
@@ -17692,7 +17865,7 @@
|
|
|
17692
17865
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17693
17866
|
}
|
|
17694
17867
|
|
|
17695
|
-
node.finalizer = this.eat(
|
|
17868
|
+
node.finalizer = this.eat(67) ? this.parseBlock() : null;
|
|
17696
17869
|
|
|
17697
17870
|
if (!node.handler && !node.finalizer) {
|
|
17698
17871
|
this.raise(ErrorMessages.NoCatchOrFinally, {
|
|
@@ -17746,7 +17919,7 @@
|
|
|
17746
17919
|
}
|
|
17747
17920
|
}
|
|
17748
17921
|
|
|
17749
|
-
var kind = tokenIsLoop(this.state.type) ? "loop" : this.match(
|
|
17922
|
+
var kind = tokenIsLoop(this.state.type) ? "loop" : this.match(71) ? "switch" : null;
|
|
17750
17923
|
|
|
17751
17924
|
for (var i = this.state.labels.length - 1; i >= 0; i--) {
|
|
17752
17925
|
var _label = this.state.labels[i];
|
|
@@ -17864,7 +18037,7 @@
|
|
|
17864
18037
|
}
|
|
17865
18038
|
|
|
17866
18039
|
parseForIn(node, init, awaitAt) {
|
|
17867
|
-
var isForIn = this.match(
|
|
18040
|
+
var isForIn = this.match(58);
|
|
17868
18041
|
this.next();
|
|
17869
18042
|
|
|
17870
18043
|
if (isForIn) {
|
|
@@ -17906,13 +18079,13 @@
|
|
|
17906
18079
|
if (this.eat(29)) {
|
|
17907
18080
|
decl.init = isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
17908
18081
|
} else {
|
|
17909
|
-
if (kind === "const" && !(this.match(
|
|
18082
|
+
if (kind === "const" && !(this.match(58) || this.isContextual(101))) {
|
|
17910
18083
|
if (!isTypescript) {
|
|
17911
18084
|
this.raise(ErrorMessages.DeclarationMissingInitializer, {
|
|
17912
18085
|
at: this.state.lastTokEndLoc
|
|
17913
18086
|
}, "Const declarations");
|
|
17914
18087
|
}
|
|
17915
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(
|
|
18088
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(101)))) {
|
|
17916
18089
|
this.raise(ErrorMessages.DeclarationMissingInitializer, {
|
|
17917
18090
|
at: this.state.lastTokEndLoc
|
|
17918
18091
|
}, "Complex binding patterns");
|
|
@@ -17941,13 +18114,13 @@
|
|
|
17941
18114
|
var requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID);
|
|
17942
18115
|
this.initFunction(node, isAsync);
|
|
17943
18116
|
|
|
17944
|
-
if (this.match(
|
|
18117
|
+
if (this.match(55) && isHangingStatement) {
|
|
17945
18118
|
this.raise(ErrorMessages.GeneratorInSingleStatementContext, {
|
|
17946
18119
|
at: this.state.startLoc
|
|
17947
18120
|
});
|
|
17948
18121
|
}
|
|
17949
18122
|
|
|
17950
|
-
node.generator = this.eat(
|
|
18123
|
+
node.generator = this.eat(55);
|
|
17951
18124
|
|
|
17952
18125
|
if (isStatement) {
|
|
17953
18126
|
node.id = this.parseFunctionId(requireId);
|
|
@@ -18098,7 +18271,7 @@
|
|
|
18098
18271
|
}
|
|
18099
18272
|
|
|
18100
18273
|
parseClassMember(classBody, member, state) {
|
|
18101
|
-
var isStatic = this.isContextual(
|
|
18274
|
+
var isStatic = this.isContextual(104);
|
|
18102
18275
|
|
|
18103
18276
|
if (isStatic) {
|
|
18104
18277
|
if (this.parseClassMemberFromModifier(classBody, member)) {
|
|
@@ -18119,14 +18292,15 @@
|
|
|
18119
18292
|
var privateMethod = member;
|
|
18120
18293
|
var publicProp = member;
|
|
18121
18294
|
var privateProp = member;
|
|
18295
|
+
var accessorProp = member;
|
|
18122
18296
|
var method = publicMethod;
|
|
18123
18297
|
var publicMember = publicMethod;
|
|
18124
18298
|
member.static = isStatic;
|
|
18125
18299
|
this.parsePropertyNamePrefixOperator(member);
|
|
18126
18300
|
|
|
18127
|
-
if (this.eat(
|
|
18301
|
+
if (this.eat(55)) {
|
|
18128
18302
|
method.kind = "method";
|
|
18129
|
-
var isPrivateName = this.match(
|
|
18303
|
+
var isPrivateName = this.match(134);
|
|
18130
18304
|
this.parseClassElementName(method);
|
|
18131
18305
|
|
|
18132
18306
|
if (isPrivateName) {
|
|
@@ -18145,7 +18319,7 @@
|
|
|
18145
18319
|
}
|
|
18146
18320
|
|
|
18147
18321
|
var isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc;
|
|
18148
|
-
var isPrivate = this.match(
|
|
18322
|
+
var isPrivate = this.match(134);
|
|
18149
18323
|
var key = this.parseClassElementName(member);
|
|
18150
18324
|
var maybeQuestionTokenStartLoc = this.state.startLoc;
|
|
18151
18325
|
this.parsePostMemberNameModifiers(publicMember);
|
|
@@ -18189,7 +18363,7 @@
|
|
|
18189
18363
|
}
|
|
18190
18364
|
} else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
|
|
18191
18365
|
this.resetPreviousNodeTrailingComments(key);
|
|
18192
|
-
var isGenerator = this.eat(
|
|
18366
|
+
var isGenerator = this.eat(55);
|
|
18193
18367
|
|
|
18194
18368
|
if (publicMember.optional) {
|
|
18195
18369
|
this.unexpected(maybeQuestionTokenStartLoc);
|
|
@@ -18197,7 +18371,7 @@
|
|
|
18197
18371
|
|
|
18198
18372
|
method.kind = "method";
|
|
18199
18373
|
|
|
18200
|
-
var _isPrivate = this.match(
|
|
18374
|
+
var _isPrivate = this.match(134);
|
|
18201
18375
|
|
|
18202
18376
|
this.parseClassElementName(method);
|
|
18203
18377
|
this.parsePostMemberNameModifiers(publicMember);
|
|
@@ -18213,11 +18387,11 @@
|
|
|
18213
18387
|
|
|
18214
18388
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
18215
18389
|
}
|
|
18216
|
-
} else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(
|
|
18390
|
+
} else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(55) && this.isLineTerminator())) {
|
|
18217
18391
|
this.resetPreviousNodeTrailingComments(key);
|
|
18218
18392
|
method.kind = key.name;
|
|
18219
18393
|
|
|
18220
|
-
var _isPrivate2 = this.match(
|
|
18394
|
+
var _isPrivate2 = this.match(134);
|
|
18221
18395
|
|
|
18222
18396
|
this.parseClassElementName(publicMethod);
|
|
18223
18397
|
|
|
@@ -18234,6 +18408,14 @@
|
|
|
18234
18408
|
}
|
|
18235
18409
|
|
|
18236
18410
|
this.checkGetterSetterParams(publicMethod);
|
|
18411
|
+
} else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
|
|
18412
|
+
this.expectPlugin("decoratorAutoAccessors");
|
|
18413
|
+
this.resetPreviousNodeTrailingComments(key);
|
|
18414
|
+
|
|
18415
|
+
var _isPrivate3 = this.match(134);
|
|
18416
|
+
|
|
18417
|
+
this.parseClassElementName(publicProp);
|
|
18418
|
+
this.pushClassAccessorProperty(classBody, accessorProp, _isPrivate3);
|
|
18237
18419
|
} else if (this.isLineTerminator()) {
|
|
18238
18420
|
if (isPrivate) {
|
|
18239
18421
|
this.pushClassPrivateProperty(classBody, privateProp);
|
|
@@ -18251,13 +18433,13 @@
|
|
|
18251
18433
|
value
|
|
18252
18434
|
} = this.state;
|
|
18253
18435
|
|
|
18254
|
-
if ((type ===
|
|
18436
|
+
if ((type === 128 || type === 129) && member.static && value === "prototype") {
|
|
18255
18437
|
this.raise(ErrorMessages.StaticPrototype, {
|
|
18256
18438
|
at: this.state.startLoc
|
|
18257
18439
|
});
|
|
18258
18440
|
}
|
|
18259
18441
|
|
|
18260
|
-
if (type ===
|
|
18442
|
+
if (type === 134) {
|
|
18261
18443
|
if (value === "constructor") {
|
|
18262
18444
|
this.raise(ErrorMessages.ConstructorClassPrivateField, {
|
|
18263
18445
|
at: this.state.startLoc
|
|
@@ -18309,6 +18491,25 @@
|
|
|
18309
18491
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), CLASS_ELEMENT_OTHER, node.key.loc.start);
|
|
18310
18492
|
}
|
|
18311
18493
|
|
|
18494
|
+
pushClassAccessorProperty(classBody, prop, isPrivate) {
|
|
18495
|
+
if (!isPrivate && !prop.computed) {
|
|
18496
|
+
var key = prop.key;
|
|
18497
|
+
|
|
18498
|
+
if (key.name === "constructor" || key.value === "constructor") {
|
|
18499
|
+
this.raise(ErrorMessages.ConstructorClassField, {
|
|
18500
|
+
node: key
|
|
18501
|
+
});
|
|
18502
|
+
}
|
|
18503
|
+
}
|
|
18504
|
+
|
|
18505
|
+
var node = this.parseClassAccessorProperty(prop);
|
|
18506
|
+
classBody.body.push(node);
|
|
18507
|
+
|
|
18508
|
+
if (isPrivate) {
|
|
18509
|
+
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), CLASS_ELEMENT_OTHER, node.key.loc.start);
|
|
18510
|
+
}
|
|
18511
|
+
}
|
|
18512
|
+
|
|
18312
18513
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
18313
18514
|
classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true));
|
|
18314
18515
|
}
|
|
@@ -18338,6 +18539,12 @@
|
|
|
18338
18539
|
return this.finishNode(node, "ClassProperty");
|
|
18339
18540
|
}
|
|
18340
18541
|
|
|
18542
|
+
parseClassAccessorProperty(node) {
|
|
18543
|
+
this.parseInitializer(node);
|
|
18544
|
+
this.semicolon();
|
|
18545
|
+
return this.finishNode(node, "ClassAccessorProperty");
|
|
18546
|
+
}
|
|
18547
|
+
|
|
18341
18548
|
parseInitializer(node) {
|
|
18342
18549
|
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
|
|
18343
18550
|
this.expressionScope.enter(newExpressionScope());
|
|
@@ -18369,7 +18576,7 @@
|
|
|
18369
18576
|
}
|
|
18370
18577
|
|
|
18371
18578
|
parseClassSuper(node) {
|
|
18372
|
-
node.superClass = this.eat(
|
|
18579
|
+
node.superClass = this.eat(81) ? this.parseExprSubscripts() : null;
|
|
18373
18580
|
}
|
|
18374
18581
|
|
|
18375
18582
|
parseExport(node) {
|
|
@@ -18406,7 +18613,7 @@
|
|
|
18406
18613
|
return this.finishNode(node, "ExportNamedDeclaration");
|
|
18407
18614
|
}
|
|
18408
18615
|
|
|
18409
|
-
if (this.eat(
|
|
18616
|
+
if (this.eat(65)) {
|
|
18410
18617
|
node.declaration = this.parseExportDefaultExpression();
|
|
18411
18618
|
this.checkExport(node, true, true);
|
|
18412
18619
|
return this.finishNode(node, "ExportDefaultDeclaration");
|
|
@@ -18416,7 +18623,7 @@
|
|
|
18416
18623
|
}
|
|
18417
18624
|
|
|
18418
18625
|
eatExportStar(node) {
|
|
18419
|
-
return this.eat(
|
|
18626
|
+
return this.eat(55);
|
|
18420
18627
|
}
|
|
18421
18628
|
|
|
18422
18629
|
maybeParseExportDefaultSpecifier(node) {
|
|
@@ -18432,7 +18639,7 @@
|
|
|
18432
18639
|
}
|
|
18433
18640
|
|
|
18434
18641
|
maybeParseExportNamespaceSpecifier(node) {
|
|
18435
|
-
if (this.isContextual(
|
|
18642
|
+
if (this.isContextual(93)) {
|
|
18436
18643
|
if (!node.specifiers) node.specifiers = [];
|
|
18437
18644
|
var specifier = this.startNodeAt(this.state.lastTokStart, this.state.lastTokStartLoc);
|
|
18438
18645
|
this.next();
|
|
@@ -18479,7 +18686,7 @@
|
|
|
18479
18686
|
}
|
|
18480
18687
|
|
|
18481
18688
|
isAsyncFunction() {
|
|
18482
|
-
if (!this.isContextual(
|
|
18689
|
+
if (!this.isContextual(95)) return false;
|
|
18483
18690
|
var next = this.nextTokenStart();
|
|
18484
18691
|
return !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function");
|
|
18485
18692
|
}
|
|
@@ -18488,7 +18695,7 @@
|
|
|
18488
18695
|
var expr = this.startNode();
|
|
18489
18696
|
var isAsync = this.isAsyncFunction();
|
|
18490
18697
|
|
|
18491
|
-
if (this.match(
|
|
18698
|
+
if (this.match(68) || isAsync) {
|
|
18492
18699
|
this.next();
|
|
18493
18700
|
|
|
18494
18701
|
if (isAsync) {
|
|
@@ -18498,7 +18705,7 @@
|
|
|
18498
18705
|
return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync);
|
|
18499
18706
|
}
|
|
18500
18707
|
|
|
18501
|
-
if (this.match(
|
|
18708
|
+
if (this.match(80)) {
|
|
18502
18709
|
return this.parseClass(expr, true, true);
|
|
18503
18710
|
}
|
|
18504
18711
|
|
|
@@ -18513,7 +18720,7 @@
|
|
|
18513
18720
|
return this.parseClass(expr, true, true);
|
|
18514
18721
|
}
|
|
18515
18722
|
|
|
18516
|
-
if (this.match(
|
|
18723
|
+
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
18517
18724
|
throw this.raise(ErrorMessages.UnsupportedDefaultExport, {
|
|
18518
18725
|
at: this.state.startLoc
|
|
18519
18726
|
});
|
|
@@ -18534,21 +18741,21 @@
|
|
|
18534
18741
|
} = this.state;
|
|
18535
18742
|
|
|
18536
18743
|
if (tokenIsIdentifier(type)) {
|
|
18537
|
-
if (type ===
|
|
18744
|
+
if (type === 95 && !this.state.containsEsc || type === 99) {
|
|
18538
18745
|
return false;
|
|
18539
18746
|
}
|
|
18540
18747
|
|
|
18541
|
-
if ((type ===
|
|
18748
|
+
if ((type === 126 || type === 125) && !this.state.containsEsc) {
|
|
18542
18749
|
var {
|
|
18543
18750
|
type: nextType
|
|
18544
18751
|
} = this.lookahead();
|
|
18545
18752
|
|
|
18546
|
-
if (tokenIsIdentifier(nextType) && nextType !==
|
|
18753
|
+
if (tokenIsIdentifier(nextType) && nextType !== 97 || nextType === 5) {
|
|
18547
18754
|
this.expectOnePlugin(["flow", "typescript"]);
|
|
18548
18755
|
return false;
|
|
18549
18756
|
}
|
|
18550
18757
|
}
|
|
18551
|
-
} else if (!this.match(
|
|
18758
|
+
} else if (!this.match(65)) {
|
|
18552
18759
|
return false;
|
|
18553
18760
|
}
|
|
18554
18761
|
|
|
@@ -18559,7 +18766,7 @@
|
|
|
18559
18766
|
return true;
|
|
18560
18767
|
}
|
|
18561
18768
|
|
|
18562
|
-
if (this.match(
|
|
18769
|
+
if (this.match(65) && hasFrom) {
|
|
18563
18770
|
var nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
|
|
18564
18771
|
return nextAfterFrom === 34 || nextAfterFrom === 39;
|
|
18565
18772
|
}
|
|
@@ -18568,7 +18775,7 @@
|
|
|
18568
18775
|
}
|
|
18569
18776
|
|
|
18570
18777
|
parseExportFrom(node, expect) {
|
|
18571
|
-
if (this.eatContextual(
|
|
18778
|
+
if (this.eatContextual(97)) {
|
|
18572
18779
|
node.source = this.parseImportSource();
|
|
18573
18780
|
this.checkExport(node);
|
|
18574
18781
|
var assertions = this.maybeParseImportAssertions();
|
|
@@ -18602,7 +18809,7 @@
|
|
|
18602
18809
|
}
|
|
18603
18810
|
}
|
|
18604
18811
|
|
|
18605
|
-
return type ===
|
|
18812
|
+
return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
|
|
18606
18813
|
}
|
|
18607
18814
|
|
|
18608
18815
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
@@ -18711,8 +18918,8 @@
|
|
|
18711
18918
|
if (this.eat(8)) break;
|
|
18712
18919
|
}
|
|
18713
18920
|
|
|
18714
|
-
var isMaybeTypeOnly = this.isContextual(
|
|
18715
|
-
var isString = this.match(
|
|
18921
|
+
var isMaybeTypeOnly = this.isContextual(126);
|
|
18922
|
+
var isString = this.match(129);
|
|
18716
18923
|
var node = this.startNode();
|
|
18717
18924
|
node.local = this.parseModuleExportName();
|
|
18718
18925
|
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
@@ -18722,7 +18929,7 @@
|
|
|
18722
18929
|
}
|
|
18723
18930
|
|
|
18724
18931
|
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
18725
|
-
if (this.eatContextual(
|
|
18932
|
+
if (this.eatContextual(93)) {
|
|
18726
18933
|
node.exported = this.parseModuleExportName();
|
|
18727
18934
|
} else if (isString) {
|
|
18728
18935
|
node.exported = cloneStringLiteral(node.local);
|
|
@@ -18734,7 +18941,7 @@
|
|
|
18734
18941
|
}
|
|
18735
18942
|
|
|
18736
18943
|
parseModuleExportName() {
|
|
18737
|
-
if (this.match(
|
|
18944
|
+
if (this.match(129)) {
|
|
18738
18945
|
var result = this.parseStringLiteral(this.state.value);
|
|
18739
18946
|
var surrogate = result.value.match(loneSurrogate);
|
|
18740
18947
|
|
|
@@ -18753,12 +18960,12 @@
|
|
|
18753
18960
|
parseImport(node) {
|
|
18754
18961
|
node.specifiers = [];
|
|
18755
18962
|
|
|
18756
|
-
if (!this.match(
|
|
18963
|
+
if (!this.match(129)) {
|
|
18757
18964
|
var hasDefault = this.maybeParseDefaultImportSpecifier(node);
|
|
18758
18965
|
var parseNext = !hasDefault || this.eat(12);
|
|
18759
18966
|
var hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
|
|
18760
18967
|
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
|
|
18761
|
-
this.expectContextual(
|
|
18968
|
+
this.expectContextual(97);
|
|
18762
18969
|
}
|
|
18763
18970
|
|
|
18764
18971
|
node.source = this.parseImportSource();
|
|
@@ -18779,7 +18986,7 @@
|
|
|
18779
18986
|
}
|
|
18780
18987
|
|
|
18781
18988
|
parseImportSource() {
|
|
18782
|
-
if (!this.match(
|
|
18989
|
+
if (!this.match(129)) this.unexpected();
|
|
18783
18990
|
return this.parseExprAtom();
|
|
18784
18991
|
}
|
|
18785
18992
|
|
|
@@ -18813,7 +19020,7 @@
|
|
|
18813
19020
|
|
|
18814
19021
|
attrNames.add(keyName);
|
|
18815
19022
|
|
|
18816
|
-
if (this.match(
|
|
19023
|
+
if (this.match(129)) {
|
|
18817
19024
|
node.key = this.parseStringLiteral(keyName);
|
|
18818
19025
|
} else {
|
|
18819
19026
|
node.key = this.parseIdentifier(true);
|
|
@@ -18821,7 +19028,7 @@
|
|
|
18821
19028
|
|
|
18822
19029
|
this.expect(14);
|
|
18823
19030
|
|
|
18824
|
-
if (!this.match(
|
|
19031
|
+
if (!this.match(129)) {
|
|
18825
19032
|
throw this.raise(ErrorMessages.ModuleAttributeInvalidValue, {
|
|
18826
19033
|
at: this.state.startLoc
|
|
18827
19034
|
});
|
|
@@ -18836,7 +19043,7 @@
|
|
|
18836
19043
|
}
|
|
18837
19044
|
|
|
18838
19045
|
maybeParseModuleAttributes() {
|
|
18839
|
-
if (this.match(
|
|
19046
|
+
if (this.match(76) && !this.hasPrecedingLineBreak()) {
|
|
18840
19047
|
this.expectPlugin("moduleAttributes");
|
|
18841
19048
|
this.next();
|
|
18842
19049
|
} else {
|
|
@@ -18866,7 +19073,7 @@
|
|
|
18866
19073
|
attributes.add(node.key.name);
|
|
18867
19074
|
this.expect(14);
|
|
18868
19075
|
|
|
18869
|
-
if (!this.match(
|
|
19076
|
+
if (!this.match(129)) {
|
|
18870
19077
|
throw this.raise(ErrorMessages.ModuleAttributeInvalidValue, {
|
|
18871
19078
|
at: this.state.startLoc
|
|
18872
19079
|
});
|
|
@@ -18881,7 +19088,7 @@
|
|
|
18881
19088
|
}
|
|
18882
19089
|
|
|
18883
19090
|
maybeParseImportAssertions() {
|
|
18884
|
-
if (this.isContextual(
|
|
19091
|
+
if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
|
|
18885
19092
|
this.expectPlugin("importAssertions");
|
|
18886
19093
|
this.next();
|
|
18887
19094
|
} else {
|
|
@@ -18905,10 +19112,10 @@
|
|
|
18905
19112
|
}
|
|
18906
19113
|
|
|
18907
19114
|
maybeParseStarImportSpecifier(node) {
|
|
18908
|
-
if (this.match(
|
|
19115
|
+
if (this.match(55)) {
|
|
18909
19116
|
var specifier = this.startNode();
|
|
18910
19117
|
this.next();
|
|
18911
|
-
this.expectContextual(
|
|
19118
|
+
this.expectContextual(93);
|
|
18912
19119
|
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier", "import namespace specifier");
|
|
18913
19120
|
return true;
|
|
18914
19121
|
}
|
|
@@ -18935,8 +19142,8 @@
|
|
|
18935
19142
|
}
|
|
18936
19143
|
|
|
18937
19144
|
var specifier = this.startNode();
|
|
18938
|
-
var importedIsString = this.match(
|
|
18939
|
-
var isMaybeTypeOnly = this.isContextual(
|
|
19145
|
+
var importedIsString = this.match(129);
|
|
19146
|
+
var isMaybeTypeOnly = this.isContextual(126);
|
|
18940
19147
|
specifier.imported = this.parseModuleExportName();
|
|
18941
19148
|
var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
|
|
18942
19149
|
node.specifiers.push(importSpecifier);
|
|
@@ -18944,7 +19151,7 @@
|
|
|
18944
19151
|
}
|
|
18945
19152
|
|
|
18946
19153
|
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
18947
|
-
if (this.eatContextual(
|
|
19154
|
+
if (this.eatContextual(93)) {
|
|
18948
19155
|
specifier.local = this.parseIdentifier();
|
|
18949
19156
|
} else {
|
|
18950
19157
|
var {
|
|
@@ -20073,11 +20280,13 @@
|
|
|
20073
20280
|
// istanbul ignore else
|
|
20074
20281
|
if (editor.includes(".")) {
|
|
20075
20282
|
var namespace = editor.split(".")[0];
|
|
20076
|
-
var find = brickMap.get(namespace);
|
|
20283
|
+
var find = brickMap.get(namespace); // There maybe no `editorsJsFilePath`.
|
|
20077
20284
|
|
|
20078
20285
|
if (find) {
|
|
20079
|
-
|
|
20080
|
-
|
|
20286
|
+
if (find.editorsJsFilePath) {
|
|
20287
|
+
deps.add(find.editorsJsFilePath);
|
|
20288
|
+
dll.add("editor-bricks-helper");
|
|
20289
|
+
}
|
|
20081
20290
|
} else {
|
|
20082
20291
|
// eslint-disable-next-line no-console
|
|
20083
20292
|
console.error("the name of editor is `".concat(editor, "` and it don't match any editor package"));
|