@next-core/brick-utils 2.37.18 → 2.37.21
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 +22 -3
- package/dist/index.bundle.js +234 -345
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +234 -345
- package/dist/index.esm.js.map +1 -1
- package/dist/types/JsonStorage.d.ts +3 -3
- package/package.json +5 -5
package/dist/index.bundle.js
CHANGED
|
@@ -3613,8 +3613,8 @@
|
|
|
3613
3613
|
});
|
|
3614
3614
|
|
|
3615
3615
|
function toESTreeLocation(node) {
|
|
3616
|
-
|
|
3617
|
-
|
|
3616
|
+
toUnenumerable(node.loc.start, "index");
|
|
3617
|
+
toUnenumerable(node.loc.end, "index");
|
|
3618
3618
|
return node;
|
|
3619
3619
|
}
|
|
3620
3620
|
|
|
@@ -3888,9 +3888,10 @@
|
|
|
3888
3888
|
}
|
|
3889
3889
|
|
|
3890
3890
|
this.toAssignable(value, isLHS);
|
|
3891
|
-
|
|
3892
|
-
super.toAssignable(node, isLHS);
|
|
3891
|
+
return node;
|
|
3893
3892
|
}
|
|
3893
|
+
|
|
3894
|
+
return super.toAssignable(node, isLHS);
|
|
3894
3895
|
}
|
|
3895
3896
|
|
|
3896
3897
|
toAssignableObjectExpressionProp(prop) {
|
|
@@ -3903,7 +3904,11 @@
|
|
|
3903
3904
|
at: prop.key
|
|
3904
3905
|
});
|
|
3905
3906
|
} else {
|
|
3906
|
-
|
|
3907
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
3908
|
+
args[_key3 - 1] = arguments[_key3];
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3911
|
+
super.toAssignableObjectExpressionProp(prop, ...args);
|
|
3907
3912
|
}
|
|
3908
3913
|
}
|
|
3909
3914
|
|
|
@@ -4000,11 +4005,6 @@
|
|
|
4000
4005
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
4001
4006
|
}
|
|
4002
4007
|
|
|
4003
|
-
resetStartLocation(node, start, startLoc) {
|
|
4004
|
-
super.resetStartLocation(node, start, startLoc);
|
|
4005
|
-
toESTreeLocation(node);
|
|
4006
|
-
}
|
|
4007
|
-
|
|
4008
4008
|
resetEndLocation(node) {
|
|
4009
4009
|
var endLoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.lastTokEndLoc;
|
|
4010
4010
|
super.resetEndLocation(node, endLoc);
|
|
@@ -4152,7 +4152,9 @@
|
|
|
4152
4152
|
beforeExpr,
|
|
4153
4153
|
startsExpr
|
|
4154
4154
|
}),
|
|
4155
|
-
braceR: createToken("}"
|
|
4155
|
+
braceR: createToken("}", {
|
|
4156
|
+
beforeExpr
|
|
4157
|
+
}),
|
|
4156
4158
|
braceBarR: createToken("|}"),
|
|
4157
4159
|
parenL: createToken("(", {
|
|
4158
4160
|
beforeExpr,
|
|
@@ -4577,10 +4579,6 @@
|
|
|
4577
4579
|
return tokenBinops[token];
|
|
4578
4580
|
}
|
|
4579
4581
|
|
|
4580
|
-
function tokenIsBinaryOperator(token) {
|
|
4581
|
-
return tokenBinops[token] !== -1;
|
|
4582
|
-
}
|
|
4583
|
-
|
|
4584
4582
|
function tokenIsRightAssociative(token) {
|
|
4585
4583
|
return token === 57;
|
|
4586
4584
|
}
|
|
@@ -5046,7 +5044,6 @@
|
|
|
5046
5044
|
this.hasFlowComment = false;
|
|
5047
5045
|
this.isAmbientContext = false;
|
|
5048
5046
|
this.inAbstractClass = false;
|
|
5049
|
-
this.inDisallowConditionalTypesContext = false;
|
|
5050
5047
|
this.topicContext = {
|
|
5051
5048
|
maxNumOfResolvableTopics: 0,
|
|
5052
5049
|
maxTopicIndex: null
|
|
@@ -7059,7 +7056,7 @@
|
|
|
7059
7056
|
this.parser.raise(toParseError, origin);
|
|
7060
7057
|
}
|
|
7061
7058
|
|
|
7062
|
-
|
|
7059
|
+
recordParenthesizedIdentifierError(_ref45) {
|
|
7063
7060
|
var {
|
|
7064
7061
|
at: node
|
|
7065
7062
|
} = _ref45;
|
|
@@ -7072,9 +7069,9 @@
|
|
|
7072
7069
|
};
|
|
7073
7070
|
|
|
7074
7071
|
if (scope.isCertainlyParameterDeclaration()) {
|
|
7075
|
-
this.parser.raise(
|
|
7072
|
+
this.parser.raise(Errors.InvalidParenthesizedAssignment, origin);
|
|
7076
7073
|
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
7077
|
-
scope.recordDeclarationError(
|
|
7074
|
+
scope.recordDeclarationError(Errors.InvalidParenthesizedAssignment, origin);
|
|
7078
7075
|
} else {
|
|
7079
7076
|
return;
|
|
7080
7077
|
}
|
|
@@ -9525,11 +9522,11 @@
|
|
|
9525
9522
|
toAssignable(node) {
|
|
9526
9523
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
9527
9524
|
|
|
9528
|
-
if (
|
|
9529
|
-
|
|
9525
|
+
if (node.type === "TypeCastExpression") {
|
|
9526
|
+
return super.toAssignable(this.typeCastToParameter(node), isLHS);
|
|
9527
|
+
} else {
|
|
9528
|
+
return super.toAssignable(node, isLHS);
|
|
9530
9529
|
}
|
|
9531
|
-
|
|
9532
|
-
super.toAssignable(...arguments);
|
|
9533
9530
|
}
|
|
9534
9531
|
|
|
9535
9532
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
@@ -9541,7 +9538,7 @@
|
|
|
9541
9538
|
}
|
|
9542
9539
|
}
|
|
9543
9540
|
|
|
9544
|
-
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
9541
|
+
return super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
9545
9542
|
}
|
|
9546
9543
|
|
|
9547
9544
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
@@ -9571,8 +9568,8 @@
|
|
|
9571
9568
|
}
|
|
9572
9569
|
|
|
9573
9570
|
isValidLVal(type) {
|
|
9574
|
-
for (var
|
|
9575
|
-
rest[
|
|
9571
|
+
for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
9572
|
+
rest[_key4 - 1] = arguments[_key4];
|
|
9576
9573
|
}
|
|
9577
9574
|
|
|
9578
9575
|
return type === "TypeCastExpression" || super.isValidLVal(type, ...rest);
|
|
@@ -10121,8 +10118,7 @@
|
|
|
10121
10118
|
return super.parseSubscript(base, startPos, startLoc, noCalls, subscriptState);
|
|
10122
10119
|
}
|
|
10123
10120
|
|
|
10124
|
-
|
|
10125
|
-
super.parseNewCallee(node);
|
|
10121
|
+
parseNewArguments(node) {
|
|
10126
10122
|
var targs = null;
|
|
10127
10123
|
|
|
10128
10124
|
if (this.shouldParseTypes() && this.match(47)) {
|
|
@@ -10130,6 +10126,7 @@
|
|
|
10130
10126
|
}
|
|
10131
10127
|
|
|
10132
10128
|
node.typeArguments = targs;
|
|
10129
|
+
super.parseNewArguments(node);
|
|
10133
10130
|
}
|
|
10134
10131
|
|
|
10135
10132
|
parseAsyncArrowWithTypeParameters(startPos, startLoc) {
|
|
@@ -11202,7 +11199,6 @@
|
|
|
11202
11199
|
this.next();
|
|
11203
11200
|
node.expression = this.parseExpression();
|
|
11204
11201
|
this.setContext(types.j_oTag);
|
|
11205
|
-
this.state.canStartJSXElement = true;
|
|
11206
11202
|
this.expect(8);
|
|
11207
11203
|
return this.finishNode(node, "JSXSpreadChild");
|
|
11208
11204
|
}
|
|
@@ -11216,7 +11212,6 @@
|
|
|
11216
11212
|
}
|
|
11217
11213
|
|
|
11218
11214
|
this.setContext(previousContext);
|
|
11219
|
-
this.state.canStartJSXElement = true;
|
|
11220
11215
|
this.expect(8);
|
|
11221
11216
|
return this.finishNode(node, "JSXExpressionContainer");
|
|
11222
11217
|
}
|
|
@@ -11230,7 +11225,6 @@
|
|
|
11230
11225
|
this.expect(21);
|
|
11231
11226
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
11232
11227
|
this.setContext(types.j_oTag);
|
|
11233
|
-
this.state.canStartJSXElement = true;
|
|
11234
11228
|
this.expect(8);
|
|
11235
11229
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
11236
11230
|
}
|
|
@@ -11243,7 +11237,8 @@
|
|
|
11243
11237
|
jsxParseOpeningElementAt(startPos, startLoc) {
|
|
11244
11238
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11245
11239
|
|
|
11246
|
-
if (this.
|
|
11240
|
+
if (this.match(139)) {
|
|
11241
|
+
this.expect(139);
|
|
11247
11242
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
11248
11243
|
}
|
|
11249
11244
|
|
|
@@ -11267,7 +11262,8 @@
|
|
|
11267
11262
|
jsxParseClosingElementAt(startPos, startLoc) {
|
|
11268
11263
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11269
11264
|
|
|
11270
|
-
if (this.
|
|
11265
|
+
if (this.match(139)) {
|
|
11266
|
+
this.expect(139);
|
|
11271
11267
|
return this.finishNode(node, "JSXClosingFragment");
|
|
11272
11268
|
}
|
|
11273
11269
|
|
|
@@ -11548,10 +11544,6 @@
|
|
|
11548
11544
|
}
|
|
11549
11545
|
}
|
|
11550
11546
|
|
|
11551
|
-
function tsTokenCanStartExpression(token) {
|
|
11552
|
-
return tokenCanStartExpression(token) || tokenIsBinaryOperator(token);
|
|
11553
|
-
}
|
|
11554
|
-
|
|
11555
11547
|
var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["typescript"])))(_ => ({
|
|
11556
11548
|
AbstractMethodHasImplementation: _(_ref71 => {
|
|
11557
11549
|
var {
|
|
@@ -11627,22 +11619,10 @@
|
|
|
11627
11619
|
} = _ref80;
|
|
11628
11620
|
return "'".concat(modifier, "' modifier cannot appear on a type member.");
|
|
11629
11621
|
}),
|
|
11630
|
-
|
|
11631
|
-
var {
|
|
11632
|
-
modifier
|
|
11633
|
-
} = _ref81;
|
|
11634
|
-
return "'".concat(modifier, "' modifier cannot appear on a type parameter.");
|
|
11635
|
-
}),
|
|
11636
|
-
InvalidModifierOnTypeParameterPositions: _(_ref82 => {
|
|
11637
|
-
var {
|
|
11638
|
-
modifier
|
|
11639
|
-
} = _ref82;
|
|
11640
|
-
return "'".concat(modifier, "' modifier can only appear on a type parameter of a class, interface or type alias.");
|
|
11641
|
-
}),
|
|
11642
|
-
InvalidModifiersOrder: _(_ref83 => {
|
|
11622
|
+
InvalidModifiersOrder: _(_ref81 => {
|
|
11643
11623
|
var {
|
|
11644
11624
|
orderedModifiers
|
|
11645
|
-
} =
|
|
11625
|
+
} = _ref81;
|
|
11646
11626
|
return "'".concat(orderedModifiers[0], "' modifier must precede '").concat(orderedModifiers[1], "' modifier.");
|
|
11647
11627
|
}),
|
|
11648
11628
|
InvalidTupleMemberLabel: _("Tuple members must be labeled with a simple identifier."),
|
|
@@ -11654,10 +11634,10 @@
|
|
|
11654
11634
|
OverrideNotInSubClass: _("This member cannot have an 'override' modifier because its containing class does not extend another class."),
|
|
11655
11635
|
PatternIsOptional: _("A binding pattern parameter cannot be optional in an implementation signature."),
|
|
11656
11636
|
PrivateElementHasAbstract: _("Private elements cannot have the 'abstract' modifier."),
|
|
11657
|
-
PrivateElementHasAccessibility: _(
|
|
11637
|
+
PrivateElementHasAccessibility: _(_ref82 => {
|
|
11658
11638
|
var {
|
|
11659
11639
|
modifier
|
|
11660
|
-
} =
|
|
11640
|
+
} = _ref82;
|
|
11661
11641
|
return "Private elements cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11662
11642
|
}),
|
|
11663
11643
|
ReadonlyForMethodSignature: _("'readonly' modifier can only appear on a property declaration or index signature."),
|
|
@@ -11666,10 +11646,10 @@
|
|
|
11666
11646
|
SetAccesorCannotHaveOptionalParameter: _("A 'set' accessor cannot have an optional parameter."),
|
|
11667
11647
|
SetAccesorCannotHaveRestParameter: _("A 'set' accessor cannot have rest parameter."),
|
|
11668
11648
|
SetAccesorCannotHaveReturnType: _("A 'set' accessor cannot have a return type annotation."),
|
|
11669
|
-
SingleTypeParameterWithoutTrailingComma: _(
|
|
11649
|
+
SingleTypeParameterWithoutTrailingComma: _(_ref83 => {
|
|
11670
11650
|
var {
|
|
11671
11651
|
typeParameterName
|
|
11672
|
-
} =
|
|
11652
|
+
} = _ref83;
|
|
11673
11653
|
return "Single type parameter ".concat(typeParameterName, " should have a trailing comma. Example usage: <").concat(typeParameterName, ",>.");
|
|
11674
11654
|
}),
|
|
11675
11655
|
StaticBlockCannotHaveModifier: _("Static class blocks cannot have any modifier."),
|
|
@@ -11683,10 +11663,10 @@
|
|
|
11683
11663
|
UnexpectedTypeCastInParameter: _("Unexpected type cast in parameter position."),
|
|
11684
11664
|
UnsupportedImportTypeArgument: _("Argument in a type import must be a string literal."),
|
|
11685
11665
|
UnsupportedParameterPropertyKind: _("A parameter property may not be declared using a binding pattern."),
|
|
11686
|
-
UnsupportedSignatureParameterKind: _(
|
|
11666
|
+
UnsupportedSignatureParameterKind: _(_ref84 => {
|
|
11687
11667
|
var {
|
|
11688
11668
|
type
|
|
11689
|
-
} =
|
|
11669
|
+
} = _ref84;
|
|
11690
11670
|
return "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ".concat(type, ".");
|
|
11691
11671
|
})
|
|
11692
11672
|
}));
|
|
@@ -11732,10 +11712,6 @@
|
|
|
11732
11712
|
return modifier === "private" || modifier === "public" || modifier === "protected";
|
|
11733
11713
|
}
|
|
11734
11714
|
|
|
11735
|
-
function tsIsVarianceAnnotations(modifier) {
|
|
11736
|
-
return modifier === "in" || modifier === "out";
|
|
11737
|
-
}
|
|
11738
|
-
|
|
11739
11715
|
var typescript = superClass => class extends superClass {
|
|
11740
11716
|
getScopeHandler() {
|
|
11741
11717
|
return TypeScriptScopeHandler;
|
|
@@ -11755,7 +11731,7 @@
|
|
|
11755
11731
|
}
|
|
11756
11732
|
|
|
11757
11733
|
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
11758
|
-
if (!tokenIsIdentifier(this.state.type)
|
|
11734
|
+
if (!tokenIsIdentifier(this.state.type)) {
|
|
11759
11735
|
return undefined;
|
|
11760
11736
|
}
|
|
11761
11737
|
|
|
@@ -11774,14 +11750,13 @@
|
|
|
11774
11750
|
return undefined;
|
|
11775
11751
|
}
|
|
11776
11752
|
|
|
11777
|
-
tsParseModifiers(
|
|
11753
|
+
tsParseModifiers(_ref85) {
|
|
11778
11754
|
var {
|
|
11779
11755
|
modified,
|
|
11780
11756
|
allowedModifiers,
|
|
11781
11757
|
disallowedModifiers,
|
|
11782
|
-
stopOnStartOfClassStaticBlock
|
|
11783
|
-
|
|
11784
|
-
} = _ref87;
|
|
11758
|
+
stopOnStartOfClassStaticBlock
|
|
11759
|
+
} = _ref85;
|
|
11785
11760
|
|
|
11786
11761
|
var enforceOrder = (loc, modifier, before, after) => {
|
|
11787
11762
|
if (modifier === before && modified[after]) {
|
|
@@ -11820,16 +11795,6 @@
|
|
|
11820
11795
|
enforceOrder(startLoc, modifier, modifier, "readonly");
|
|
11821
11796
|
modified.accessibility = modifier;
|
|
11822
11797
|
}
|
|
11823
|
-
} else if (tsIsVarianceAnnotations(modifier)) {
|
|
11824
|
-
if (modified[modifier]) {
|
|
11825
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
11826
|
-
at: startLoc,
|
|
11827
|
-
modifier
|
|
11828
|
-
});
|
|
11829
|
-
}
|
|
11830
|
-
|
|
11831
|
-
modified[modifier] = true;
|
|
11832
|
-
enforceOrder(startLoc, modifier, "in", "out");
|
|
11833
11798
|
} else {
|
|
11834
11799
|
if (Object.hasOwnProperty.call(modified, modifier)) {
|
|
11835
11800
|
this.raise(TSErrors.DuplicateModifier, {
|
|
@@ -11849,7 +11814,7 @@
|
|
|
11849
11814
|
}
|
|
11850
11815
|
|
|
11851
11816
|
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
|
|
11852
|
-
this.raise(
|
|
11817
|
+
this.raise(TSErrors.InvalidModifierOnTypeMember, {
|
|
11853
11818
|
at: startLoc,
|
|
11854
11819
|
modifier
|
|
11855
11820
|
});
|
|
@@ -12026,48 +11991,24 @@
|
|
|
12026
11991
|
node.exprName = this.tsParseEntityName();
|
|
12027
11992
|
}
|
|
12028
11993
|
|
|
12029
|
-
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
|
12030
|
-
node.typeParameters = this.tsParseTypeArguments();
|
|
12031
|
-
}
|
|
12032
|
-
|
|
12033
11994
|
return this.finishNode(node, "TSTypeQuery");
|
|
12034
11995
|
}
|
|
12035
11996
|
|
|
12036
|
-
tsParseInOutModifiers(node) {
|
|
12037
|
-
this.tsParseModifiers({
|
|
12038
|
-
modified: node,
|
|
12039
|
-
allowedModifiers: ["in", "out"],
|
|
12040
|
-
disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
|
|
12041
|
-
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
12042
|
-
});
|
|
12043
|
-
}
|
|
12044
|
-
|
|
12045
|
-
tsParseNoneModifiers(node) {
|
|
12046
|
-
this.tsParseModifiers({
|
|
12047
|
-
modified: node,
|
|
12048
|
-
allowedModifiers: [],
|
|
12049
|
-
disallowedModifiers: ["in", "out"],
|
|
12050
|
-
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
12051
|
-
});
|
|
12052
|
-
}
|
|
12053
|
-
|
|
12054
11997
|
tsParseTypeParameter() {
|
|
12055
|
-
var parseModifiers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.tsParseNoneModifiers.bind(this);
|
|
12056
11998
|
var node = this.startNode();
|
|
12057
|
-
parseModifiers(node);
|
|
12058
11999
|
node.name = this.tsParseTypeParameterName();
|
|
12059
12000
|
node.constraint = this.tsEatThenParseType(81);
|
|
12060
12001
|
node.default = this.tsEatThenParseType(29);
|
|
12061
12002
|
return this.finishNode(node, "TSTypeParameter");
|
|
12062
12003
|
}
|
|
12063
12004
|
|
|
12064
|
-
tsTryParseTypeParameters(
|
|
12005
|
+
tsTryParseTypeParameters() {
|
|
12065
12006
|
if (this.match(47)) {
|
|
12066
|
-
return this.tsParseTypeParameters(
|
|
12007
|
+
return this.tsParseTypeParameters();
|
|
12067
12008
|
}
|
|
12068
12009
|
}
|
|
12069
12010
|
|
|
12070
|
-
tsParseTypeParameters(
|
|
12011
|
+
tsParseTypeParameters() {
|
|
12071
12012
|
var node = this.startNode();
|
|
12072
12013
|
|
|
12073
12014
|
if (this.match(47) || this.match(138)) {
|
|
@@ -12079,7 +12020,7 @@
|
|
|
12079
12020
|
var refTrailingCommaPos = {
|
|
12080
12021
|
value: -1
|
|
12081
12022
|
};
|
|
12082
|
-
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this
|
|
12023
|
+
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true, refTrailingCommaPos);
|
|
12083
12024
|
|
|
12084
12025
|
if (node.params.length === 0) {
|
|
12085
12026
|
this.raise(TSErrors.EmptyTypeParameters, {
|
|
@@ -12470,7 +12411,7 @@
|
|
|
12470
12411
|
this.next();
|
|
12471
12412
|
}
|
|
12472
12413
|
|
|
12473
|
-
this.
|
|
12414
|
+
this.tsFillSignature(19, node);
|
|
12474
12415
|
return this.finishNode(node, type);
|
|
12475
12416
|
}
|
|
12476
12417
|
|
|
@@ -12639,24 +12580,13 @@
|
|
|
12639
12580
|
this.expectContextual(112);
|
|
12640
12581
|
var typeParameter = this.startNode();
|
|
12641
12582
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
12642
|
-
typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
|
|
12643
12583
|
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
|
12644
12584
|
return this.finishNode(node, "TSInferType");
|
|
12645
12585
|
}
|
|
12646
12586
|
|
|
12647
|
-
tsParseConstraintForInferType() {
|
|
12648
|
-
if (this.eat(81)) {
|
|
12649
|
-
var constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());
|
|
12650
|
-
|
|
12651
|
-
if (this.state.inDisallowConditionalTypesContext || !this.match(17)) {
|
|
12652
|
-
return constraint;
|
|
12653
|
-
}
|
|
12654
|
-
}
|
|
12655
|
-
}
|
|
12656
|
-
|
|
12657
12587
|
tsParseTypeOperatorOrHigher() {
|
|
12658
12588
|
var isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
|
|
12659
|
-
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.
|
|
12589
|
+
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
|
|
12660
12590
|
}
|
|
12661
12591
|
|
|
12662
12592
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
@@ -12858,17 +12788,17 @@
|
|
|
12858
12788
|
assert(this.state.inType);
|
|
12859
12789
|
var type = this.tsParseNonConditionalType();
|
|
12860
12790
|
|
|
12861
|
-
if (this.
|
|
12791
|
+
if (this.hasPrecedingLineBreak() || !this.eat(81)) {
|
|
12862
12792
|
return type;
|
|
12863
12793
|
}
|
|
12864
12794
|
|
|
12865
12795
|
var node = this.startNodeAtNode(type);
|
|
12866
12796
|
node.checkType = type;
|
|
12867
|
-
node.extendsType = this.
|
|
12797
|
+
node.extendsType = this.tsParseNonConditionalType();
|
|
12868
12798
|
this.expect(17);
|
|
12869
|
-
node.trueType = this.
|
|
12799
|
+
node.trueType = this.tsParseType();
|
|
12870
12800
|
this.expect(14);
|
|
12871
|
-
node.falseType = this.
|
|
12801
|
+
node.falseType = this.tsParseType();
|
|
12872
12802
|
return this.finishNode(node, "TSConditionalType");
|
|
12873
12803
|
}
|
|
12874
12804
|
|
|
@@ -12909,16 +12839,7 @@
|
|
|
12909
12839
|
|
|
12910
12840
|
tsParseHeritageClause(token) {
|
|
12911
12841
|
var originalStartLoc = this.state.startLoc;
|
|
12912
|
-
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", ()
|
|
12913
|
-
var node = this.startNode();
|
|
12914
|
-
node.expression = this.tsParseEntityName();
|
|
12915
|
-
|
|
12916
|
-
if (this.match(47)) {
|
|
12917
|
-
node.typeParameters = this.tsParseTypeArguments();
|
|
12918
|
-
}
|
|
12919
|
-
|
|
12920
|
-
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
12921
|
-
});
|
|
12842
|
+
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this));
|
|
12922
12843
|
|
|
12923
12844
|
if (!delimitedList.length) {
|
|
12924
12845
|
this.raise(TSErrors.EmptyHeritageClauseType, {
|
|
@@ -12930,6 +12851,17 @@
|
|
|
12930
12851
|
return delimitedList;
|
|
12931
12852
|
}
|
|
12932
12853
|
|
|
12854
|
+
tsParseExpressionWithTypeArguments() {
|
|
12855
|
+
var node = this.startNode();
|
|
12856
|
+
node.expression = this.tsParseEntityName();
|
|
12857
|
+
|
|
12858
|
+
if (this.match(47)) {
|
|
12859
|
+
node.typeParameters = this.tsParseTypeArguments();
|
|
12860
|
+
}
|
|
12861
|
+
|
|
12862
|
+
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
12863
|
+
}
|
|
12864
|
+
|
|
12933
12865
|
tsParseInterfaceDeclaration(node) {
|
|
12934
12866
|
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12935
12867
|
if (this.hasFollowingLineBreak()) return null;
|
|
@@ -12946,7 +12878,7 @@
|
|
|
12946
12878
|
});
|
|
12947
12879
|
}
|
|
12948
12880
|
|
|
12949
|
-
node.typeParameters = this.tsTryParseTypeParameters(
|
|
12881
|
+
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12950
12882
|
|
|
12951
12883
|
if (this.eat(81)) {
|
|
12952
12884
|
node.extends = this.tsParseHeritageClause("extends");
|
|
@@ -12962,7 +12894,7 @@
|
|
|
12962
12894
|
node.id = this.parseIdentifier();
|
|
12963
12895
|
this.checkIdentifier(node.id, BIND_TS_TYPE);
|
|
12964
12896
|
node.typeAnnotation = this.tsInType(() => {
|
|
12965
|
-
node.typeParameters = this.tsTryParseTypeParameters(
|
|
12897
|
+
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12966
12898
|
this.expect(29);
|
|
12967
12899
|
|
|
12968
12900
|
if (this.isContextual(111) && this.lookahead().type !== 16) {
|
|
@@ -13000,28 +12932,6 @@
|
|
|
13000
12932
|
}
|
|
13001
12933
|
}
|
|
13002
12934
|
|
|
13003
|
-
tsInDisallowConditionalTypesContext(cb) {
|
|
13004
|
-
var oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
|
|
13005
|
-
this.state.inDisallowConditionalTypesContext = true;
|
|
13006
|
-
|
|
13007
|
-
try {
|
|
13008
|
-
return cb();
|
|
13009
|
-
} finally {
|
|
13010
|
-
this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
|
|
13011
|
-
}
|
|
13012
|
-
}
|
|
13013
|
-
|
|
13014
|
-
tsInAllowConditionalTypesContext(cb) {
|
|
13015
|
-
var oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
|
|
13016
|
-
this.state.inDisallowConditionalTypesContext = false;
|
|
13017
|
-
|
|
13018
|
-
try {
|
|
13019
|
-
return cb();
|
|
13020
|
-
} finally {
|
|
13021
|
-
this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
|
|
13022
|
-
}
|
|
13023
|
-
}
|
|
13024
|
-
|
|
13025
12935
|
tsEatThenParseType(token) {
|
|
13026
12936
|
return !this.match(token) ? undefined : this.tsNextThenParseType();
|
|
13027
12937
|
}
|
|
@@ -13541,44 +13451,35 @@
|
|
|
13541
13451
|
}
|
|
13542
13452
|
}
|
|
13543
13453
|
|
|
13454
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
13455
|
+
node.callee = base;
|
|
13544
13456
|
var typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
13545
|
-
if (!typeArguments) throw this.unexpected();
|
|
13546
13457
|
|
|
13547
|
-
if (
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
if (tokenIsTemplate(this.state.type)) {
|
|
13553
|
-
var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13458
|
+
if (typeArguments) {
|
|
13459
|
+
if (isOptionalCall && !this.match(10)) {
|
|
13460
|
+
missingParenErrorLoc = this.state.curPosition();
|
|
13461
|
+
this.unexpected();
|
|
13462
|
+
}
|
|
13554
13463
|
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13464
|
+
if (!noCalls && this.eat(10)) {
|
|
13465
|
+
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
13466
|
+
this.tsCheckForInvalidTypeCasts(node.arguments);
|
|
13467
|
+
node.typeParameters = typeArguments;
|
|
13558
13468
|
|
|
13559
|
-
|
|
13560
|
-
|
|
13469
|
+
if (state.optionalChainMember) {
|
|
13470
|
+
node.optional = isOptionalCall;
|
|
13471
|
+
}
|
|
13561
13472
|
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
_node9.typeParameters = typeArguments;
|
|
13473
|
+
return this.finishCallExpression(node, state.optionalChainMember);
|
|
13474
|
+
} else if (tokenIsTemplate(this.state.type)) {
|
|
13475
|
+
var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13566
13476
|
|
|
13567
|
-
|
|
13568
|
-
|
|
13477
|
+
_result.typeParameters = typeArguments;
|
|
13478
|
+
return _result;
|
|
13569
13479
|
}
|
|
13570
|
-
|
|
13571
|
-
return this.finishCallExpression(_node9, state.optionalChainMember);
|
|
13572
13480
|
}
|
|
13573
13481
|
|
|
13574
|
-
|
|
13575
|
-
throw this.unexpected();
|
|
13576
|
-
}
|
|
13577
|
-
|
|
13578
|
-
var node = this.startNodeAt(startPos, startLoc);
|
|
13579
|
-
node.expression = base;
|
|
13580
|
-
node.typeParameters = typeArguments;
|
|
13581
|
-
return this.finishNode(node, "TSInstantiationExpression");
|
|
13482
|
+
this.unexpected();
|
|
13582
13483
|
});
|
|
13583
13484
|
|
|
13584
13485
|
if (missingParenErrorLoc) {
|
|
@@ -13591,18 +13492,20 @@
|
|
|
13591
13492
|
return super.parseSubscript(base, startPos, startLoc, noCalls, state);
|
|
13592
13493
|
}
|
|
13593
13494
|
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13495
|
+
parseNewArguments(node) {
|
|
13496
|
+
if (this.match(47) || this.match(51)) {
|
|
13497
|
+
var typeParameters = this.tsTryParseAndCatch(() => {
|
|
13498
|
+
var args = this.tsParseTypeArgumentsInExpression();
|
|
13499
|
+
if (!this.match(10)) this.unexpected();
|
|
13500
|
+
return args;
|
|
13501
|
+
});
|
|
13601
13502
|
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13503
|
+
if (typeParameters) {
|
|
13504
|
+
node.typeParameters = typeParameters;
|
|
13505
|
+
}
|
|
13605
13506
|
}
|
|
13507
|
+
|
|
13508
|
+
super.parseNewArguments(node);
|
|
13606
13509
|
}
|
|
13607
13510
|
|
|
13608
13511
|
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
|
|
@@ -13790,9 +13693,7 @@
|
|
|
13790
13693
|
this.tsParseModifiers({
|
|
13791
13694
|
modified: member,
|
|
13792
13695
|
allowedModifiers: modifiers,
|
|
13793
|
-
|
|
13794
|
-
stopOnStartOfClassStaticBlock: true,
|
|
13795
|
-
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
13696
|
+
stopOnStartOfClassStaticBlock: true
|
|
13796
13697
|
});
|
|
13797
13698
|
|
|
13798
13699
|
var callParseClassMemberWithIsStatic = () => {
|
|
@@ -13971,7 +13872,7 @@
|
|
|
13971
13872
|
}
|
|
13972
13873
|
|
|
13973
13874
|
super.parseClassId(node, isStatement, optionalId, node.declare ? BIND_TS_AMBIENT : BIND_CLASS);
|
|
13974
|
-
var typeParameters = this.tsTryParseTypeParameters(
|
|
13875
|
+
var typeParameters = this.tsTryParseTypeParameters();
|
|
13975
13876
|
if (typeParameters) node.typeParameters = typeParameters;
|
|
13976
13877
|
}
|
|
13977
13878
|
|
|
@@ -14077,8 +13978,8 @@
|
|
|
14077
13978
|
var typeParameters = this.tsTryParseTypeParameters();
|
|
14078
13979
|
if (typeParameters) prop.typeParameters = typeParameters;
|
|
14079
13980
|
|
|
14080
|
-
for (var
|
|
14081
|
-
args[
|
|
13981
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
13982
|
+
args[_key5 - 1] = arguments[_key5];
|
|
14082
13983
|
}
|
|
14083
13984
|
|
|
14084
13985
|
super.parseObjPropValue(prop, ...args);
|
|
@@ -14114,8 +14015,8 @@
|
|
|
14114
14015
|
}
|
|
14115
14016
|
|
|
14116
14017
|
parseMaybeAssign() {
|
|
14117
|
-
for (var
|
|
14118
|
-
args[
|
|
14018
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
14019
|
+
args[_key6] = arguments[_key6];
|
|
14119
14020
|
}
|
|
14120
14021
|
|
|
14121
14022
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
@@ -14142,10 +14043,10 @@
|
|
|
14142
14043
|
return super.parseMaybeAssign(...args);
|
|
14143
14044
|
}
|
|
14144
14045
|
|
|
14145
|
-
if (!state || state === this.state) state = this.state.clone();
|
|
14146
14046
|
var typeParameters;
|
|
14047
|
+
state = state || this.state.clone();
|
|
14147
14048
|
var arrow = this.tryParse(abort => {
|
|
14148
|
-
var _expr$extra, _typeParameters
|
|
14049
|
+
var _expr$extra, _typeParameters, _expr$typeParameters$;
|
|
14149
14050
|
|
|
14150
14051
|
typeParameters = this.tsParseTypeParameters();
|
|
14151
14052
|
var expr = super.parseMaybeAssign(...args);
|
|
@@ -14159,6 +14060,12 @@
|
|
|
14159
14060
|
}
|
|
14160
14061
|
|
|
14161
14062
|
expr.typeParameters = typeParameters;
|
|
14063
|
+
|
|
14064
|
+
if (this.hasPlugin("jsx") && expr.typeParameters.params.length === 1 && !((_expr$typeParameters$ = expr.typeParameters.extra) != null && _expr$typeParameters$.trailingComma)) {
|
|
14065
|
+
var parameter = expr.typeParameters.params[0];
|
|
14066
|
+
if (!parameter.constraint) ;
|
|
14067
|
+
}
|
|
14068
|
+
|
|
14162
14069
|
return expr;
|
|
14163
14070
|
}, state);
|
|
14164
14071
|
|
|
@@ -14265,33 +14172,23 @@
|
|
|
14265
14172
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14266
14173
|
|
|
14267
14174
|
switch (node.type) {
|
|
14175
|
+
case "TSTypeCastExpression":
|
|
14176
|
+
return super.toAssignable(this.typeCastToParameter(node), isLHS);
|
|
14177
|
+
|
|
14178
|
+
case "TSParameterProperty":
|
|
14179
|
+
return super.toAssignable(node, isLHS);
|
|
14180
|
+
|
|
14268
14181
|
case "ParenthesizedExpression":
|
|
14269
|
-
this.toAssignableParenthesizedExpression(node, isLHS);
|
|
14270
|
-
break;
|
|
14182
|
+
return this.toAssignableParenthesizedExpression(node, isLHS);
|
|
14271
14183
|
|
|
14272
14184
|
case "TSAsExpression":
|
|
14273
14185
|
case "TSNonNullExpression":
|
|
14274
14186
|
case "TSTypeAssertion":
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
at: node
|
|
14278
|
-
});
|
|
14279
|
-
} else {
|
|
14280
|
-
this.raise(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14281
|
-
at: node
|
|
14282
|
-
});
|
|
14283
|
-
}
|
|
14284
|
-
|
|
14285
|
-
this.toAssignable(node.expression, isLHS);
|
|
14286
|
-
break;
|
|
14287
|
-
|
|
14288
|
-
case "AssignmentExpression":
|
|
14289
|
-
if (!isLHS && node.left.type === "TSTypeCastExpression") {
|
|
14290
|
-
node.left = this.typeCastToParameter(node.left);
|
|
14291
|
-
}
|
|
14187
|
+
node.expression = this.toAssignable(node.expression, isLHS);
|
|
14188
|
+
return node;
|
|
14292
14189
|
|
|
14293
14190
|
default:
|
|
14294
|
-
super.toAssignable(node, isLHS);
|
|
14191
|
+
return super.toAssignable(node, isLHS);
|
|
14295
14192
|
}
|
|
14296
14193
|
}
|
|
14297
14194
|
|
|
@@ -14301,35 +14198,22 @@
|
|
|
14301
14198
|
case "TSNonNullExpression":
|
|
14302
14199
|
case "TSTypeAssertion":
|
|
14303
14200
|
case "ParenthesizedExpression":
|
|
14304
|
-
this.toAssignable(node.expression, isLHS);
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
default:
|
|
14308
|
-
super.toAssignable(node, isLHS);
|
|
14309
|
-
}
|
|
14310
|
-
}
|
|
14311
|
-
|
|
14312
|
-
checkToRestConversion(node, allowPattern) {
|
|
14313
|
-
switch (node.type) {
|
|
14314
|
-
case "TSAsExpression":
|
|
14315
|
-
case "TSTypeAssertion":
|
|
14316
|
-
case "TSNonNullExpression":
|
|
14317
|
-
this.checkToRestConversion(node.expression, false);
|
|
14318
|
-
break;
|
|
14201
|
+
node.expression = this.toAssignable(node.expression, isLHS);
|
|
14202
|
+
return node;
|
|
14319
14203
|
|
|
14320
14204
|
default:
|
|
14321
|
-
super.
|
|
14205
|
+
return super.toAssignable(node, isLHS);
|
|
14322
14206
|
}
|
|
14323
14207
|
}
|
|
14324
14208
|
|
|
14325
|
-
isValidLVal(type,
|
|
14209
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
14326
14210
|
return getOwn$1({
|
|
14327
14211
|
TSTypeCastExpression: true,
|
|
14328
14212
|
TSParameterProperty: "parameter",
|
|
14329
14213
|
TSNonNullExpression: "expression",
|
|
14330
|
-
TSAsExpression: (binding !== BIND_NONE ||
|
|
14331
|
-
TSTypeAssertion: (binding !== BIND_NONE ||
|
|
14332
|
-
}, type) || super.isValidLVal(type,
|
|
14214
|
+
TSAsExpression: (binding !== BIND_NONE || isParenthesized) && ["expression", true],
|
|
14215
|
+
TSTypeAssertion: (binding !== BIND_NONE || isParenthesized) && ["expression", true]
|
|
14216
|
+
}, type) || super.isValidLVal(type, isParenthesized, binding);
|
|
14333
14217
|
}
|
|
14334
14218
|
|
|
14335
14219
|
parseBindingAtom() {
|
|
@@ -14432,13 +14316,28 @@
|
|
|
14432
14316
|
toAssignableList(exprList) {
|
|
14433
14317
|
for (var i = 0; i < exprList.length; i++) {
|
|
14434
14318
|
var expr = exprList[i];
|
|
14319
|
+
if (!expr) continue;
|
|
14435
14320
|
|
|
14436
|
-
|
|
14437
|
-
|
|
14321
|
+
switch (expr.type) {
|
|
14322
|
+
case "TSTypeCastExpression":
|
|
14323
|
+
exprList[i] = this.typeCastToParameter(expr);
|
|
14324
|
+
break;
|
|
14325
|
+
|
|
14326
|
+
case "TSAsExpression":
|
|
14327
|
+
case "TSTypeAssertion":
|
|
14328
|
+
if (!this.state.maybeInArrowParameters) {
|
|
14329
|
+
exprList[i] = this.typeCastToParameter(expr);
|
|
14330
|
+
} else {
|
|
14331
|
+
this.raise(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14332
|
+
at: expr
|
|
14333
|
+
});
|
|
14334
|
+
}
|
|
14335
|
+
|
|
14336
|
+
break;
|
|
14438
14337
|
}
|
|
14439
14338
|
}
|
|
14440
14339
|
|
|
14441
|
-
super.toAssignableList(...arguments);
|
|
14340
|
+
return super.toAssignableList(...arguments);
|
|
14442
14341
|
}
|
|
14443
14342
|
|
|
14444
14343
|
typeCastToParameter(node) {
|
|
@@ -14508,8 +14407,8 @@
|
|
|
14508
14407
|
this.state.inAbstractClass = !!node.abstract;
|
|
14509
14408
|
|
|
14510
14409
|
try {
|
|
14511
|
-
for (var
|
|
14512
|
-
args[
|
|
14410
|
+
for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
14411
|
+
args[_key7 - 1] = arguments[_key7];
|
|
14513
14412
|
}
|
|
14514
14413
|
|
|
14515
14414
|
return super.parseClass(node, ...args);
|
|
@@ -14633,16 +14532,7 @@
|
|
|
14633
14532
|
}
|
|
14634
14533
|
} else if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
14635
14534
|
hasTypeSpecifier = true;
|
|
14636
|
-
|
|
14637
|
-
if (isImport) {
|
|
14638
|
-
leftOfAs = this.parseIdentifier(true);
|
|
14639
|
-
|
|
14640
|
-
if (!this.isContextual(93)) {
|
|
14641
|
-
this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
|
|
14642
|
-
}
|
|
14643
|
-
} else {
|
|
14644
|
-
leftOfAs = this.parseModuleExportName();
|
|
14645
|
-
}
|
|
14535
|
+
leftOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
|
|
14646
14536
|
}
|
|
14647
14537
|
|
|
14648
14538
|
if (hasTypeSpecifier && isInTypeOnlyImportExport) {
|
|
@@ -14741,8 +14631,8 @@
|
|
|
14741
14631
|
}
|
|
14742
14632
|
|
|
14743
14633
|
isValidLVal(type) {
|
|
14744
|
-
for (var
|
|
14745
|
-
rest[
|
|
14634
|
+
for (var _len8 = arguments.length, rest = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
14635
|
+
rest[_key8 - 1] = arguments[_key8];
|
|
14746
14636
|
}
|
|
14747
14637
|
|
|
14748
14638
|
return type === "Placeholder" || super.isValidLVal(type, ...rest);
|
|
@@ -14751,9 +14641,10 @@
|
|
|
14751
14641
|
toAssignable(node) {
|
|
14752
14642
|
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
|
14753
14643
|
node.expectedNode = "Pattern";
|
|
14754
|
-
|
|
14755
|
-
super.toAssignable(...arguments);
|
|
14644
|
+
return node;
|
|
14756
14645
|
}
|
|
14646
|
+
|
|
14647
|
+
return super.toAssignable(...arguments);
|
|
14757
14648
|
}
|
|
14758
14649
|
|
|
14759
14650
|
isLet(context) {
|
|
@@ -15065,9 +14956,9 @@
|
|
|
15065
14956
|
throw new Error("Cannot combine importAssertions and moduleAttributes plugins.");
|
|
15066
14957
|
}
|
|
15067
14958
|
|
|
15068
|
-
var
|
|
14959
|
+
var moduleAttributesVerionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
|
|
15069
14960
|
|
|
15070
|
-
if (
|
|
14961
|
+
if (moduleAttributesVerionPluginOption !== "may-2020") {
|
|
15071
14962
|
throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
|
|
15072
14963
|
}
|
|
15073
14964
|
}
|
|
@@ -15141,7 +15032,7 @@
|
|
|
15141
15032
|
|
|
15142
15033
|
if (isLHS) {
|
|
15143
15034
|
if (parenthesized.type === "Identifier") {
|
|
15144
|
-
this.expressionScope.
|
|
15035
|
+
this.expressionScope.recordParenthesizedIdentifierError({
|
|
15145
15036
|
at: node
|
|
15146
15037
|
});
|
|
15147
15038
|
} else if (parenthesized.type !== "MemberExpression") {
|
|
@@ -15200,7 +15091,11 @@
|
|
|
15200
15091
|
|
|
15201
15092
|
case "SpreadElement":
|
|
15202
15093
|
{
|
|
15203
|
-
|
|
15094
|
+
this.checkToRestConversion(node);
|
|
15095
|
+
node.type = "RestElement";
|
|
15096
|
+
var arg = node.argument;
|
|
15097
|
+
this.toAssignable(arg, isLHS);
|
|
15098
|
+
break;
|
|
15204
15099
|
}
|
|
15205
15100
|
|
|
15206
15101
|
case "ArrayExpression":
|
|
@@ -15224,6 +15119,8 @@
|
|
|
15224
15119
|
this.toAssignable(parenthesized, isLHS);
|
|
15225
15120
|
break;
|
|
15226
15121
|
}
|
|
15122
|
+
|
|
15123
|
+
return node;
|
|
15227
15124
|
}
|
|
15228
15125
|
|
|
15229
15126
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
@@ -15231,50 +15128,58 @@
|
|
|
15231
15128
|
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
|
|
15232
15129
|
at: prop.key
|
|
15233
15130
|
});
|
|
15234
|
-
} else if (prop.type === "SpreadElement") {
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
this.toAssignable(arg, isLHS);
|
|
15239
|
-
|
|
15240
|
-
if (!isLast) {
|
|
15241
|
-
this.raise(Errors.RestTrailingComma, {
|
|
15242
|
-
at: prop
|
|
15243
|
-
});
|
|
15244
|
-
}
|
|
15131
|
+
} else if (prop.type === "SpreadElement" && !isLast) {
|
|
15132
|
+
this.raise(Errors.RestTrailingComma, {
|
|
15133
|
+
at: prop
|
|
15134
|
+
});
|
|
15245
15135
|
} else {
|
|
15246
15136
|
this.toAssignable(prop, isLHS);
|
|
15247
15137
|
}
|
|
15248
15138
|
}
|
|
15249
15139
|
|
|
15250
15140
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
15251
|
-
var end = exprList.length
|
|
15141
|
+
var end = exprList.length;
|
|
15252
15142
|
|
|
15253
|
-
|
|
15254
|
-
var
|
|
15255
|
-
if (!elt) continue;
|
|
15143
|
+
if (end) {
|
|
15144
|
+
var last = exprList[end - 1];
|
|
15256
15145
|
|
|
15257
|
-
if (
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15146
|
+
if ((last == null ? void 0 : last.type) === "RestElement") {
|
|
15147
|
+
--end;
|
|
15148
|
+
} else if ((last == null ? void 0 : last.type) === "SpreadElement") {
|
|
15149
|
+
last.type = "RestElement";
|
|
15150
|
+
var arg = last.argument;
|
|
15261
15151
|
this.toAssignable(arg, isLHS);
|
|
15262
|
-
|
|
15263
|
-
this.toAssignable(elt, isLHS);
|
|
15264
|
-
}
|
|
15152
|
+
arg = unwrapParenthesizedExpression(arg);
|
|
15265
15153
|
|
|
15266
|
-
|
|
15267
|
-
|
|
15154
|
+
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern") {
|
|
15155
|
+
this.unexpected(arg.start);
|
|
15156
|
+
}
|
|
15157
|
+
|
|
15158
|
+
if (trailingCommaLoc) {
|
|
15268
15159
|
this.raise(Errors.RestTrailingComma, {
|
|
15269
|
-
at:
|
|
15160
|
+
at: trailingCommaLoc
|
|
15270
15161
|
});
|
|
15271
|
-
}
|
|
15162
|
+
}
|
|
15163
|
+
|
|
15164
|
+
--end;
|
|
15165
|
+
}
|
|
15166
|
+
}
|
|
15167
|
+
|
|
15168
|
+
for (var i = 0; i < end; i++) {
|
|
15169
|
+
var elt = exprList[i];
|
|
15170
|
+
|
|
15171
|
+
if (elt) {
|
|
15172
|
+
this.toAssignable(elt, isLHS);
|
|
15173
|
+
|
|
15174
|
+
if (elt.type === "RestElement") {
|
|
15272
15175
|
this.raise(Errors.RestTrailingComma, {
|
|
15273
|
-
at:
|
|
15176
|
+
at: elt
|
|
15274
15177
|
});
|
|
15275
15178
|
}
|
|
15276
15179
|
}
|
|
15277
15180
|
}
|
|
15181
|
+
|
|
15182
|
+
return exprList;
|
|
15278
15183
|
}
|
|
15279
15184
|
|
|
15280
15185
|
isAssignable(node, isBinding) {
|
|
@@ -15464,7 +15369,7 @@
|
|
|
15464
15369
|
return this.finishNode(node, "AssignmentPattern");
|
|
15465
15370
|
}
|
|
15466
15371
|
|
|
15467
|
-
isValidLVal(type,
|
|
15372
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
15468
15373
|
return getOwn({
|
|
15469
15374
|
AssignmentPattern: "left",
|
|
15470
15375
|
RestElement: "argument",
|
|
@@ -15475,7 +15380,7 @@
|
|
|
15475
15380
|
}, type);
|
|
15476
15381
|
}
|
|
15477
15382
|
|
|
15478
|
-
checkLVal(expression,
|
|
15383
|
+
checkLVal(expression, _ref86) {
|
|
15479
15384
|
var {
|
|
15480
15385
|
in: ancestor,
|
|
15481
15386
|
binding = BIND_NONE,
|
|
@@ -15483,7 +15388,7 @@
|
|
|
15483
15388
|
strictModeChanged = false,
|
|
15484
15389
|
allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
|
|
15485
15390
|
hasParenthesizedAncestor = false
|
|
15486
|
-
} =
|
|
15391
|
+
} = _ref86;
|
|
15487
15392
|
|
|
15488
15393
|
var _expression$extra;
|
|
15489
15394
|
|
|
@@ -15519,7 +15424,7 @@
|
|
|
15519
15424
|
return;
|
|
15520
15425
|
}
|
|
15521
15426
|
|
|
15522
|
-
var validity = this.isValidLVal(expression.type,
|
|
15427
|
+
var validity = this.isValidLVal(expression.type, hasParenthesizedAncestor || ((_expression$extra = expression.extra) == null ? void 0 : _expression$extra.parenthesized), binding);
|
|
15523
15428
|
if (validity === true) return;
|
|
15524
15429
|
|
|
15525
15430
|
if (validity === false) {
|
|
@@ -15586,24 +15491,11 @@
|
|
|
15586
15491
|
this.scope.declareName(identifier.name, binding, identifier.loc.start);
|
|
15587
15492
|
}
|
|
15588
15493
|
|
|
15589
|
-
checkToRestConversion(node
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
case "Identifier":
|
|
15596
|
-
case "MemberExpression":
|
|
15597
|
-
break;
|
|
15598
|
-
|
|
15599
|
-
case "ArrayExpression":
|
|
15600
|
-
case "ObjectExpression":
|
|
15601
|
-
if (allowPattern) break;
|
|
15602
|
-
|
|
15603
|
-
default:
|
|
15604
|
-
this.raise(Errors.InvalidRestAssignmentPattern, {
|
|
15605
|
-
at: node
|
|
15606
|
-
});
|
|
15494
|
+
checkToRestConversion(node) {
|
|
15495
|
+
if (node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression") {
|
|
15496
|
+
this.raise(Errors.InvalidRestAssignmentPattern, {
|
|
15497
|
+
at: node.argument
|
|
15498
|
+
});
|
|
15607
15499
|
}
|
|
15608
15500
|
}
|
|
15609
15501
|
|
|
@@ -15764,8 +15656,7 @@
|
|
|
15764
15656
|
node.operator = operator;
|
|
15765
15657
|
|
|
15766
15658
|
if (this.match(29)) {
|
|
15767
|
-
this.toAssignable(left, true);
|
|
15768
|
-
node.left = left;
|
|
15659
|
+
node.left = this.toAssignable(left, true);
|
|
15769
15660
|
|
|
15770
15661
|
if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startPos) {
|
|
15771
15662
|
refExpressionErrors.doubleProtoLoc = null;
|
|
@@ -16065,14 +15956,14 @@
|
|
|
16065
15956
|
if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
|
|
16066
15957
|
|
|
16067
15958
|
while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
|
|
16068
|
-
var
|
|
15959
|
+
var _node9 = this.startNodeAt(startPos, startLoc);
|
|
16069
15960
|
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
15961
|
+
_node9.operator = this.state.value;
|
|
15962
|
+
_node9.prefix = false;
|
|
15963
|
+
_node9.argument = expr;
|
|
16073
15964
|
this.next();
|
|
16074
15965
|
this.checkLVal(expr, {
|
|
16075
|
-
in: expr = this.finishNode(
|
|
15966
|
+
in: expr = this.finishNode(_node9, "UpdateExpression")
|
|
16076
15967
|
});
|
|
16077
15968
|
}
|
|
16078
15969
|
|
|
@@ -16932,20 +16823,6 @@
|
|
|
16932
16823
|
}
|
|
16933
16824
|
|
|
16934
16825
|
parseNew(node) {
|
|
16935
|
-
this.parseNewCallee(node);
|
|
16936
|
-
|
|
16937
|
-
if (this.eat(10)) {
|
|
16938
|
-
var args = this.parseExprList(11);
|
|
16939
|
-
this.toReferencedList(args);
|
|
16940
|
-
node.arguments = args;
|
|
16941
|
-
} else {
|
|
16942
|
-
node.arguments = [];
|
|
16943
|
-
}
|
|
16944
|
-
|
|
16945
|
-
return this.finishNode(node, "NewExpression");
|
|
16946
|
-
}
|
|
16947
|
-
|
|
16948
|
-
parseNewCallee(node) {
|
|
16949
16826
|
node.callee = this.parseNoCallExpr();
|
|
16950
16827
|
|
|
16951
16828
|
if (node.callee.type === "Import") {
|
|
@@ -16961,6 +16838,19 @@
|
|
|
16961
16838
|
at: this.state.startLoc
|
|
16962
16839
|
});
|
|
16963
16840
|
}
|
|
16841
|
+
|
|
16842
|
+
this.parseNewArguments(node);
|
|
16843
|
+
return this.finishNode(node, "NewExpression");
|
|
16844
|
+
}
|
|
16845
|
+
|
|
16846
|
+
parseNewArguments(node) {
|
|
16847
|
+
if (this.eat(10)) {
|
|
16848
|
+
var args = this.parseExprList(11);
|
|
16849
|
+
this.toReferencedList(args);
|
|
16850
|
+
node.arguments = args;
|
|
16851
|
+
} else {
|
|
16852
|
+
node.arguments = [];
|
|
16853
|
+
}
|
|
16964
16854
|
}
|
|
16965
16855
|
|
|
16966
16856
|
parseTemplateElement(isTagged) {
|
|
@@ -17367,8 +17257,7 @@
|
|
|
17367
17257
|
}
|
|
17368
17258
|
|
|
17369
17259
|
setArrowFunctionParameters(node, params, trailingCommaLoc) {
|
|
17370
|
-
this.toAssignableList(params, trailingCommaLoc, false);
|
|
17371
|
-
node.params = params;
|
|
17260
|
+
node.params = this.toAssignableList(params, trailingCommaLoc, false);
|
|
17372
17261
|
}
|
|
17373
17262
|
|
|
17374
17263
|
parseFunctionBodyAndFinish(node, type) {
|
|
@@ -18309,12 +18198,12 @@
|
|
|
18309
18198
|
expr = this.parseIdentifier(false);
|
|
18310
18199
|
|
|
18311
18200
|
while (this.eat(16)) {
|
|
18312
|
-
var
|
|
18201
|
+
var _node10 = this.startNodeAt(startPos, startLoc);
|
|
18313
18202
|
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
expr = this.finishNode(
|
|
18203
|
+
_node10.object = expr;
|
|
18204
|
+
_node10.property = this.parseIdentifier(true);
|
|
18205
|
+
_node10.computed = false;
|
|
18206
|
+
expr = this.finishNode(_node10, "MemberExpression");
|
|
18318
18207
|
}
|
|
18319
18208
|
}
|
|
18320
18209
|
|