@next-core/brick-utils 2.37.18 → 2.37.19
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 +6 -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.esm.js
CHANGED
|
@@ -3608,8 +3608,8 @@ var toUnenumerable = (object, key) => defineProperty(object, key, {
|
|
|
3608
3608
|
});
|
|
3609
3609
|
|
|
3610
3610
|
function toESTreeLocation(node) {
|
|
3611
|
-
|
|
3612
|
-
|
|
3611
|
+
toUnenumerable(node.loc.start, "index");
|
|
3612
|
+
toUnenumerable(node.loc.end, "index");
|
|
3613
3613
|
return node;
|
|
3614
3614
|
}
|
|
3615
3615
|
|
|
@@ -3883,9 +3883,10 @@ var estree = superClass => class extends superClass {
|
|
|
3883
3883
|
}
|
|
3884
3884
|
|
|
3885
3885
|
this.toAssignable(value, isLHS);
|
|
3886
|
-
|
|
3887
|
-
super.toAssignable(node, isLHS);
|
|
3886
|
+
return node;
|
|
3888
3887
|
}
|
|
3888
|
+
|
|
3889
|
+
return super.toAssignable(node, isLHS);
|
|
3889
3890
|
}
|
|
3890
3891
|
|
|
3891
3892
|
toAssignableObjectExpressionProp(prop) {
|
|
@@ -3898,7 +3899,11 @@ var estree = superClass => class extends superClass {
|
|
|
3898
3899
|
at: prop.key
|
|
3899
3900
|
});
|
|
3900
3901
|
} else {
|
|
3901
|
-
|
|
3902
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
3903
|
+
args[_key3 - 1] = arguments[_key3];
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
super.toAssignableObjectExpressionProp(prop, ...args);
|
|
3902
3907
|
}
|
|
3903
3908
|
}
|
|
3904
3909
|
|
|
@@ -3995,11 +4000,6 @@ var estree = superClass => class extends superClass {
|
|
|
3995
4000
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
3996
4001
|
}
|
|
3997
4002
|
|
|
3998
|
-
resetStartLocation(node, start, startLoc) {
|
|
3999
|
-
super.resetStartLocation(node, start, startLoc);
|
|
4000
|
-
toESTreeLocation(node);
|
|
4001
|
-
}
|
|
4002
|
-
|
|
4003
4003
|
resetEndLocation(node) {
|
|
4004
4004
|
var endLoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.lastTokEndLoc;
|
|
4005
4005
|
super.resetEndLocation(node, endLoc);
|
|
@@ -4147,7 +4147,9 @@ var tt = {
|
|
|
4147
4147
|
beforeExpr,
|
|
4148
4148
|
startsExpr
|
|
4149
4149
|
}),
|
|
4150
|
-
braceR: createToken("}"
|
|
4150
|
+
braceR: createToken("}", {
|
|
4151
|
+
beforeExpr
|
|
4152
|
+
}),
|
|
4151
4153
|
braceBarR: createToken("|}"),
|
|
4152
4154
|
parenL: createToken("(", {
|
|
4153
4155
|
beforeExpr,
|
|
@@ -4572,10 +4574,6 @@ function tokenOperatorPrecedence(token) {
|
|
|
4572
4574
|
return tokenBinops[token];
|
|
4573
4575
|
}
|
|
4574
4576
|
|
|
4575
|
-
function tokenIsBinaryOperator(token) {
|
|
4576
|
-
return tokenBinops[token] !== -1;
|
|
4577
|
-
}
|
|
4578
|
-
|
|
4579
4577
|
function tokenIsRightAssociative(token) {
|
|
4580
4578
|
return token === 57;
|
|
4581
4579
|
}
|
|
@@ -5041,7 +5039,6 @@ class State {
|
|
|
5041
5039
|
this.hasFlowComment = false;
|
|
5042
5040
|
this.isAmbientContext = false;
|
|
5043
5041
|
this.inAbstractClass = false;
|
|
5044
|
-
this.inDisallowConditionalTypesContext = false;
|
|
5045
5042
|
this.topicContext = {
|
|
5046
5043
|
maxNumOfResolvableTopics: 0,
|
|
5047
5044
|
maxTopicIndex: null
|
|
@@ -7054,7 +7051,7 @@ class ExpressionScopeHandler {
|
|
|
7054
7051
|
this.parser.raise(toParseError, origin);
|
|
7055
7052
|
}
|
|
7056
7053
|
|
|
7057
|
-
|
|
7054
|
+
recordParenthesizedIdentifierError(_ref45) {
|
|
7058
7055
|
var {
|
|
7059
7056
|
at: node
|
|
7060
7057
|
} = _ref45;
|
|
@@ -7067,9 +7064,9 @@ class ExpressionScopeHandler {
|
|
|
7067
7064
|
};
|
|
7068
7065
|
|
|
7069
7066
|
if (scope.isCertainlyParameterDeclaration()) {
|
|
7070
|
-
this.parser.raise(
|
|
7067
|
+
this.parser.raise(Errors.InvalidParenthesizedAssignment, origin);
|
|
7071
7068
|
} else if (scope.canBeArrowParameterDeclaration()) {
|
|
7072
|
-
scope.recordDeclarationError(
|
|
7069
|
+
scope.recordDeclarationError(Errors.InvalidParenthesizedAssignment, origin);
|
|
7073
7070
|
} else {
|
|
7074
7071
|
return;
|
|
7075
7072
|
}
|
|
@@ -9520,11 +9517,11 @@ var flow = superClass => class extends superClass {
|
|
|
9520
9517
|
toAssignable(node) {
|
|
9521
9518
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
9522
9519
|
|
|
9523
|
-
if (
|
|
9524
|
-
|
|
9520
|
+
if (node.type === "TypeCastExpression") {
|
|
9521
|
+
return super.toAssignable(this.typeCastToParameter(node), isLHS);
|
|
9522
|
+
} else {
|
|
9523
|
+
return super.toAssignable(node, isLHS);
|
|
9525
9524
|
}
|
|
9526
|
-
|
|
9527
|
-
super.toAssignable(...arguments);
|
|
9528
9525
|
}
|
|
9529
9526
|
|
|
9530
9527
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
@@ -9536,7 +9533,7 @@ var flow = superClass => class extends superClass {
|
|
|
9536
9533
|
}
|
|
9537
9534
|
}
|
|
9538
9535
|
|
|
9539
|
-
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
9536
|
+
return super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
|
9540
9537
|
}
|
|
9541
9538
|
|
|
9542
9539
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
@@ -9566,8 +9563,8 @@ var flow = superClass => class extends superClass {
|
|
|
9566
9563
|
}
|
|
9567
9564
|
|
|
9568
9565
|
isValidLVal(type) {
|
|
9569
|
-
for (var
|
|
9570
|
-
rest[
|
|
9566
|
+
for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
9567
|
+
rest[_key4 - 1] = arguments[_key4];
|
|
9571
9568
|
}
|
|
9572
9569
|
|
|
9573
9570
|
return type === "TypeCastExpression" || super.isValidLVal(type, ...rest);
|
|
@@ -10116,8 +10113,7 @@ var flow = superClass => class extends superClass {
|
|
|
10116
10113
|
return super.parseSubscript(base, startPos, startLoc, noCalls, subscriptState);
|
|
10117
10114
|
}
|
|
10118
10115
|
|
|
10119
|
-
|
|
10120
|
-
super.parseNewCallee(node);
|
|
10116
|
+
parseNewArguments(node) {
|
|
10121
10117
|
var targs = null;
|
|
10122
10118
|
|
|
10123
10119
|
if (this.shouldParseTypes() && this.match(47)) {
|
|
@@ -10125,6 +10121,7 @@ var flow = superClass => class extends superClass {
|
|
|
10125
10121
|
}
|
|
10126
10122
|
|
|
10127
10123
|
node.typeArguments = targs;
|
|
10124
|
+
super.parseNewArguments(node);
|
|
10128
10125
|
}
|
|
10129
10126
|
|
|
10130
10127
|
parseAsyncArrowWithTypeParameters(startPos, startLoc) {
|
|
@@ -11197,7 +11194,6 @@ var jsx = superClass => class extends superClass {
|
|
|
11197
11194
|
this.next();
|
|
11198
11195
|
node.expression = this.parseExpression();
|
|
11199
11196
|
this.setContext(types.j_oTag);
|
|
11200
|
-
this.state.canStartJSXElement = true;
|
|
11201
11197
|
this.expect(8);
|
|
11202
11198
|
return this.finishNode(node, "JSXSpreadChild");
|
|
11203
11199
|
}
|
|
@@ -11211,7 +11207,6 @@ var jsx = superClass => class extends superClass {
|
|
|
11211
11207
|
}
|
|
11212
11208
|
|
|
11213
11209
|
this.setContext(previousContext);
|
|
11214
|
-
this.state.canStartJSXElement = true;
|
|
11215
11210
|
this.expect(8);
|
|
11216
11211
|
return this.finishNode(node, "JSXExpressionContainer");
|
|
11217
11212
|
}
|
|
@@ -11225,7 +11220,6 @@ var jsx = superClass => class extends superClass {
|
|
|
11225
11220
|
this.expect(21);
|
|
11226
11221
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
11227
11222
|
this.setContext(types.j_oTag);
|
|
11228
|
-
this.state.canStartJSXElement = true;
|
|
11229
11223
|
this.expect(8);
|
|
11230
11224
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
11231
11225
|
}
|
|
@@ -11238,7 +11232,8 @@ var jsx = superClass => class extends superClass {
|
|
|
11238
11232
|
jsxParseOpeningElementAt(startPos, startLoc) {
|
|
11239
11233
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11240
11234
|
|
|
11241
|
-
if (this.
|
|
11235
|
+
if (this.match(139)) {
|
|
11236
|
+
this.expect(139);
|
|
11242
11237
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
11243
11238
|
}
|
|
11244
11239
|
|
|
@@ -11262,7 +11257,8 @@ var jsx = superClass => class extends superClass {
|
|
|
11262
11257
|
jsxParseClosingElementAt(startPos, startLoc) {
|
|
11263
11258
|
var node = this.startNodeAt(startPos, startLoc);
|
|
11264
11259
|
|
|
11265
|
-
if (this.
|
|
11260
|
+
if (this.match(139)) {
|
|
11261
|
+
this.expect(139);
|
|
11266
11262
|
return this.finishNode(node, "JSXClosingFragment");
|
|
11267
11263
|
}
|
|
11268
11264
|
|
|
@@ -11543,10 +11539,6 @@ function assert(x) {
|
|
|
11543
11539
|
}
|
|
11544
11540
|
}
|
|
11545
11541
|
|
|
11546
|
-
function tsTokenCanStartExpression(token) {
|
|
11547
|
-
return tokenCanStartExpression(token) || tokenIsBinaryOperator(token);
|
|
11548
|
-
}
|
|
11549
|
-
|
|
11550
11542
|
var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["typescript"])))(_ => ({
|
|
11551
11543
|
AbstractMethodHasImplementation: _(_ref71 => {
|
|
11552
11544
|
var {
|
|
@@ -11622,22 +11614,10 @@ var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTem
|
|
|
11622
11614
|
} = _ref80;
|
|
11623
11615
|
return "'".concat(modifier, "' modifier cannot appear on a type member.");
|
|
11624
11616
|
}),
|
|
11625
|
-
|
|
11626
|
-
var {
|
|
11627
|
-
modifier
|
|
11628
|
-
} = _ref81;
|
|
11629
|
-
return "'".concat(modifier, "' modifier cannot appear on a type parameter.");
|
|
11630
|
-
}),
|
|
11631
|
-
InvalidModifierOnTypeParameterPositions: _(_ref82 => {
|
|
11632
|
-
var {
|
|
11633
|
-
modifier
|
|
11634
|
-
} = _ref82;
|
|
11635
|
-
return "'".concat(modifier, "' modifier can only appear on a type parameter of a class, interface or type alias.");
|
|
11636
|
-
}),
|
|
11637
|
-
InvalidModifiersOrder: _(_ref83 => {
|
|
11617
|
+
InvalidModifiersOrder: _(_ref81 => {
|
|
11638
11618
|
var {
|
|
11639
11619
|
orderedModifiers
|
|
11640
|
-
} =
|
|
11620
|
+
} = _ref81;
|
|
11641
11621
|
return "'".concat(orderedModifiers[0], "' modifier must precede '").concat(orderedModifiers[1], "' modifier.");
|
|
11642
11622
|
}),
|
|
11643
11623
|
InvalidTupleMemberLabel: _("Tuple members must be labeled with a simple identifier."),
|
|
@@ -11649,10 +11629,10 @@ var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTem
|
|
|
11649
11629
|
OverrideNotInSubClass: _("This member cannot have an 'override' modifier because its containing class does not extend another class."),
|
|
11650
11630
|
PatternIsOptional: _("A binding pattern parameter cannot be optional in an implementation signature."),
|
|
11651
11631
|
PrivateElementHasAbstract: _("Private elements cannot have the 'abstract' modifier."),
|
|
11652
|
-
PrivateElementHasAccessibility: _(
|
|
11632
|
+
PrivateElementHasAccessibility: _(_ref82 => {
|
|
11653
11633
|
var {
|
|
11654
11634
|
modifier
|
|
11655
|
-
} =
|
|
11635
|
+
} = _ref82;
|
|
11656
11636
|
return "Private elements cannot have an accessibility modifier ('".concat(modifier, "').");
|
|
11657
11637
|
}),
|
|
11658
11638
|
ReadonlyForMethodSignature: _("'readonly' modifier can only appear on a property declaration or index signature."),
|
|
@@ -11661,10 +11641,10 @@ var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTem
|
|
|
11661
11641
|
SetAccesorCannotHaveOptionalParameter: _("A 'set' accessor cannot have an optional parameter."),
|
|
11662
11642
|
SetAccesorCannotHaveRestParameter: _("A 'set' accessor cannot have rest parameter."),
|
|
11663
11643
|
SetAccesorCannotHaveReturnType: _("A 'set' accessor cannot have a return type annotation."),
|
|
11664
|
-
SingleTypeParameterWithoutTrailingComma: _(
|
|
11644
|
+
SingleTypeParameterWithoutTrailingComma: _(_ref83 => {
|
|
11665
11645
|
var {
|
|
11666
11646
|
typeParameterName
|
|
11667
|
-
} =
|
|
11647
|
+
} = _ref83;
|
|
11668
11648
|
return "Single type parameter ".concat(typeParameterName, " should have a trailing comma. Example usage: <").concat(typeParameterName, ",>.");
|
|
11669
11649
|
}),
|
|
11670
11650
|
StaticBlockCannotHaveModifier: _("Static class blocks cannot have any modifier."),
|
|
@@ -11678,10 +11658,10 @@ var TSErrors = ParseErrorEnum(_templateObject4 || (_templateObject4 = _taggedTem
|
|
|
11678
11658
|
UnexpectedTypeCastInParameter: _("Unexpected type cast in parameter position."),
|
|
11679
11659
|
UnsupportedImportTypeArgument: _("Argument in a type import must be a string literal."),
|
|
11680
11660
|
UnsupportedParameterPropertyKind: _("A parameter property may not be declared using a binding pattern."),
|
|
11681
|
-
UnsupportedSignatureParameterKind: _(
|
|
11661
|
+
UnsupportedSignatureParameterKind: _(_ref84 => {
|
|
11682
11662
|
var {
|
|
11683
11663
|
type
|
|
11684
|
-
} =
|
|
11664
|
+
} = _ref84;
|
|
11685
11665
|
return "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ".concat(type, ".");
|
|
11686
11666
|
})
|
|
11687
11667
|
}));
|
|
@@ -11727,10 +11707,6 @@ function tsIsAccessModifier(modifier) {
|
|
|
11727
11707
|
return modifier === "private" || modifier === "public" || modifier === "protected";
|
|
11728
11708
|
}
|
|
11729
11709
|
|
|
11730
|
-
function tsIsVarianceAnnotations(modifier) {
|
|
11731
|
-
return modifier === "in" || modifier === "out";
|
|
11732
|
-
}
|
|
11733
|
-
|
|
11734
11710
|
var typescript = superClass => class extends superClass {
|
|
11735
11711
|
getScopeHandler() {
|
|
11736
11712
|
return TypeScriptScopeHandler;
|
|
@@ -11750,7 +11726,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11750
11726
|
}
|
|
11751
11727
|
|
|
11752
11728
|
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
11753
|
-
if (!tokenIsIdentifier(this.state.type)
|
|
11729
|
+
if (!tokenIsIdentifier(this.state.type)) {
|
|
11754
11730
|
return undefined;
|
|
11755
11731
|
}
|
|
11756
11732
|
|
|
@@ -11769,14 +11745,13 @@ var typescript = superClass => class extends superClass {
|
|
|
11769
11745
|
return undefined;
|
|
11770
11746
|
}
|
|
11771
11747
|
|
|
11772
|
-
tsParseModifiers(
|
|
11748
|
+
tsParseModifiers(_ref85) {
|
|
11773
11749
|
var {
|
|
11774
11750
|
modified,
|
|
11775
11751
|
allowedModifiers,
|
|
11776
11752
|
disallowedModifiers,
|
|
11777
|
-
stopOnStartOfClassStaticBlock
|
|
11778
|
-
|
|
11779
|
-
} = _ref87;
|
|
11753
|
+
stopOnStartOfClassStaticBlock
|
|
11754
|
+
} = _ref85;
|
|
11780
11755
|
|
|
11781
11756
|
var enforceOrder = (loc, modifier, before, after) => {
|
|
11782
11757
|
if (modifier === before && modified[after]) {
|
|
@@ -11815,16 +11790,6 @@ var typescript = superClass => class extends superClass {
|
|
|
11815
11790
|
enforceOrder(startLoc, modifier, modifier, "readonly");
|
|
11816
11791
|
modified.accessibility = modifier;
|
|
11817
11792
|
}
|
|
11818
|
-
} else if (tsIsVarianceAnnotations(modifier)) {
|
|
11819
|
-
if (modified[modifier]) {
|
|
11820
|
-
this.raise(TSErrors.DuplicateModifier, {
|
|
11821
|
-
at: startLoc,
|
|
11822
|
-
modifier
|
|
11823
|
-
});
|
|
11824
|
-
}
|
|
11825
|
-
|
|
11826
|
-
modified[modifier] = true;
|
|
11827
|
-
enforceOrder(startLoc, modifier, "in", "out");
|
|
11828
11793
|
} else {
|
|
11829
11794
|
if (Object.hasOwnProperty.call(modified, modifier)) {
|
|
11830
11795
|
this.raise(TSErrors.DuplicateModifier, {
|
|
@@ -11844,7 +11809,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11844
11809
|
}
|
|
11845
11810
|
|
|
11846
11811
|
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
|
|
11847
|
-
this.raise(
|
|
11812
|
+
this.raise(TSErrors.InvalidModifierOnTypeMember, {
|
|
11848
11813
|
at: startLoc,
|
|
11849
11814
|
modifier
|
|
11850
11815
|
});
|
|
@@ -12021,48 +11986,24 @@ var typescript = superClass => class extends superClass {
|
|
|
12021
11986
|
node.exprName = this.tsParseEntityName();
|
|
12022
11987
|
}
|
|
12023
11988
|
|
|
12024
|
-
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
|
12025
|
-
node.typeParameters = this.tsParseTypeArguments();
|
|
12026
|
-
}
|
|
12027
|
-
|
|
12028
11989
|
return this.finishNode(node, "TSTypeQuery");
|
|
12029
11990
|
}
|
|
12030
11991
|
|
|
12031
|
-
tsParseInOutModifiers(node) {
|
|
12032
|
-
this.tsParseModifiers({
|
|
12033
|
-
modified: node,
|
|
12034
|
-
allowedModifiers: ["in", "out"],
|
|
12035
|
-
disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
|
|
12036
|
-
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
12037
|
-
});
|
|
12038
|
-
}
|
|
12039
|
-
|
|
12040
|
-
tsParseNoneModifiers(node) {
|
|
12041
|
-
this.tsParseModifiers({
|
|
12042
|
-
modified: node,
|
|
12043
|
-
allowedModifiers: [],
|
|
12044
|
-
disallowedModifiers: ["in", "out"],
|
|
12045
|
-
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
12046
|
-
});
|
|
12047
|
-
}
|
|
12048
|
-
|
|
12049
11992
|
tsParseTypeParameter() {
|
|
12050
|
-
var parseModifiers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.tsParseNoneModifiers.bind(this);
|
|
12051
11993
|
var node = this.startNode();
|
|
12052
|
-
parseModifiers(node);
|
|
12053
11994
|
node.name = this.tsParseTypeParameterName();
|
|
12054
11995
|
node.constraint = this.tsEatThenParseType(81);
|
|
12055
11996
|
node.default = this.tsEatThenParseType(29);
|
|
12056
11997
|
return this.finishNode(node, "TSTypeParameter");
|
|
12057
11998
|
}
|
|
12058
11999
|
|
|
12059
|
-
tsTryParseTypeParameters(
|
|
12000
|
+
tsTryParseTypeParameters() {
|
|
12060
12001
|
if (this.match(47)) {
|
|
12061
|
-
return this.tsParseTypeParameters(
|
|
12002
|
+
return this.tsParseTypeParameters();
|
|
12062
12003
|
}
|
|
12063
12004
|
}
|
|
12064
12005
|
|
|
12065
|
-
tsParseTypeParameters(
|
|
12006
|
+
tsParseTypeParameters() {
|
|
12066
12007
|
var node = this.startNode();
|
|
12067
12008
|
|
|
12068
12009
|
if (this.match(47) || this.match(138)) {
|
|
@@ -12074,7 +12015,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12074
12015
|
var refTrailingCommaPos = {
|
|
12075
12016
|
value: -1
|
|
12076
12017
|
};
|
|
12077
|
-
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this
|
|
12018
|
+
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true, refTrailingCommaPos);
|
|
12078
12019
|
|
|
12079
12020
|
if (node.params.length === 0) {
|
|
12080
12021
|
this.raise(TSErrors.EmptyTypeParameters, {
|
|
@@ -12465,7 +12406,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12465
12406
|
this.next();
|
|
12466
12407
|
}
|
|
12467
12408
|
|
|
12468
|
-
this.
|
|
12409
|
+
this.tsFillSignature(19, node);
|
|
12469
12410
|
return this.finishNode(node, type);
|
|
12470
12411
|
}
|
|
12471
12412
|
|
|
@@ -12634,24 +12575,13 @@ var typescript = superClass => class extends superClass {
|
|
|
12634
12575
|
this.expectContextual(112);
|
|
12635
12576
|
var typeParameter = this.startNode();
|
|
12636
12577
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
12637
|
-
typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
|
|
12638
12578
|
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
|
12639
12579
|
return this.finishNode(node, "TSInferType");
|
|
12640
12580
|
}
|
|
12641
12581
|
|
|
12642
|
-
tsParseConstraintForInferType() {
|
|
12643
|
-
if (this.eat(81)) {
|
|
12644
|
-
var constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());
|
|
12645
|
-
|
|
12646
|
-
if (this.state.inDisallowConditionalTypesContext || !this.match(17)) {
|
|
12647
|
-
return constraint;
|
|
12648
|
-
}
|
|
12649
|
-
}
|
|
12650
|
-
}
|
|
12651
|
-
|
|
12652
12582
|
tsParseTypeOperatorOrHigher() {
|
|
12653
12583
|
var isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
|
|
12654
|
-
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.
|
|
12584
|
+
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
|
|
12655
12585
|
}
|
|
12656
12586
|
|
|
12657
12587
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
@@ -12853,17 +12783,17 @@ var typescript = superClass => class extends superClass {
|
|
|
12853
12783
|
assert(this.state.inType);
|
|
12854
12784
|
var type = this.tsParseNonConditionalType();
|
|
12855
12785
|
|
|
12856
|
-
if (this.
|
|
12786
|
+
if (this.hasPrecedingLineBreak() || !this.eat(81)) {
|
|
12857
12787
|
return type;
|
|
12858
12788
|
}
|
|
12859
12789
|
|
|
12860
12790
|
var node = this.startNodeAtNode(type);
|
|
12861
12791
|
node.checkType = type;
|
|
12862
|
-
node.extendsType = this.
|
|
12792
|
+
node.extendsType = this.tsParseNonConditionalType();
|
|
12863
12793
|
this.expect(17);
|
|
12864
|
-
node.trueType = this.
|
|
12794
|
+
node.trueType = this.tsParseType();
|
|
12865
12795
|
this.expect(14);
|
|
12866
|
-
node.falseType = this.
|
|
12796
|
+
node.falseType = this.tsParseType();
|
|
12867
12797
|
return this.finishNode(node, "TSConditionalType");
|
|
12868
12798
|
}
|
|
12869
12799
|
|
|
@@ -12904,16 +12834,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12904
12834
|
|
|
12905
12835
|
tsParseHeritageClause(token) {
|
|
12906
12836
|
var originalStartLoc = this.state.startLoc;
|
|
12907
|
-
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", ()
|
|
12908
|
-
var node = this.startNode();
|
|
12909
|
-
node.expression = this.tsParseEntityName();
|
|
12910
|
-
|
|
12911
|
-
if (this.match(47)) {
|
|
12912
|
-
node.typeParameters = this.tsParseTypeArguments();
|
|
12913
|
-
}
|
|
12914
|
-
|
|
12915
|
-
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
12916
|
-
});
|
|
12837
|
+
var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this));
|
|
12917
12838
|
|
|
12918
12839
|
if (!delimitedList.length) {
|
|
12919
12840
|
this.raise(TSErrors.EmptyHeritageClauseType, {
|
|
@@ -12925,6 +12846,17 @@ var typescript = superClass => class extends superClass {
|
|
|
12925
12846
|
return delimitedList;
|
|
12926
12847
|
}
|
|
12927
12848
|
|
|
12849
|
+
tsParseExpressionWithTypeArguments() {
|
|
12850
|
+
var node = this.startNode();
|
|
12851
|
+
node.expression = this.tsParseEntityName();
|
|
12852
|
+
|
|
12853
|
+
if (this.match(47)) {
|
|
12854
|
+
node.typeParameters = this.tsParseTypeArguments();
|
|
12855
|
+
}
|
|
12856
|
+
|
|
12857
|
+
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
|
12858
|
+
}
|
|
12859
|
+
|
|
12928
12860
|
tsParseInterfaceDeclaration(node) {
|
|
12929
12861
|
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12930
12862
|
if (this.hasFollowingLineBreak()) return null;
|
|
@@ -12941,7 +12873,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12941
12873
|
});
|
|
12942
12874
|
}
|
|
12943
12875
|
|
|
12944
|
-
node.typeParameters = this.tsTryParseTypeParameters(
|
|
12876
|
+
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12945
12877
|
|
|
12946
12878
|
if (this.eat(81)) {
|
|
12947
12879
|
node.extends = this.tsParseHeritageClause("extends");
|
|
@@ -12957,7 +12889,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12957
12889
|
node.id = this.parseIdentifier();
|
|
12958
12890
|
this.checkIdentifier(node.id, BIND_TS_TYPE);
|
|
12959
12891
|
node.typeAnnotation = this.tsInType(() => {
|
|
12960
|
-
node.typeParameters = this.tsTryParseTypeParameters(
|
|
12892
|
+
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12961
12893
|
this.expect(29);
|
|
12962
12894
|
|
|
12963
12895
|
if (this.isContextual(111) && this.lookahead().type !== 16) {
|
|
@@ -12995,28 +12927,6 @@ var typescript = superClass => class extends superClass {
|
|
|
12995
12927
|
}
|
|
12996
12928
|
}
|
|
12997
12929
|
|
|
12998
|
-
tsInDisallowConditionalTypesContext(cb) {
|
|
12999
|
-
var oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
|
|
13000
|
-
this.state.inDisallowConditionalTypesContext = true;
|
|
13001
|
-
|
|
13002
|
-
try {
|
|
13003
|
-
return cb();
|
|
13004
|
-
} finally {
|
|
13005
|
-
this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
|
|
13006
|
-
}
|
|
13007
|
-
}
|
|
13008
|
-
|
|
13009
|
-
tsInAllowConditionalTypesContext(cb) {
|
|
13010
|
-
var oldInDisallowConditionalTypesContext = this.state.inDisallowConditionalTypesContext;
|
|
13011
|
-
this.state.inDisallowConditionalTypesContext = false;
|
|
13012
|
-
|
|
13013
|
-
try {
|
|
13014
|
-
return cb();
|
|
13015
|
-
} finally {
|
|
13016
|
-
this.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext;
|
|
13017
|
-
}
|
|
13018
|
-
}
|
|
13019
|
-
|
|
13020
12930
|
tsEatThenParseType(token) {
|
|
13021
12931
|
return !this.match(token) ? undefined : this.tsNextThenParseType();
|
|
13022
12932
|
}
|
|
@@ -13536,44 +13446,35 @@ var typescript = superClass => class extends superClass {
|
|
|
13536
13446
|
}
|
|
13537
13447
|
}
|
|
13538
13448
|
|
|
13449
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
13450
|
+
node.callee = base;
|
|
13539
13451
|
var typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
13540
|
-
if (!typeArguments) throw this.unexpected();
|
|
13541
13452
|
|
|
13542
|
-
if (
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
if (tokenIsTemplate(this.state.type)) {
|
|
13548
|
-
var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13453
|
+
if (typeArguments) {
|
|
13454
|
+
if (isOptionalCall && !this.match(10)) {
|
|
13455
|
+
missingParenErrorLoc = this.state.curPosition();
|
|
13456
|
+
this.unexpected();
|
|
13457
|
+
}
|
|
13549
13458
|
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13459
|
+
if (!noCalls && this.eat(10)) {
|
|
13460
|
+
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
13461
|
+
this.tsCheckForInvalidTypeCasts(node.arguments);
|
|
13462
|
+
node.typeParameters = typeArguments;
|
|
13553
13463
|
|
|
13554
|
-
|
|
13555
|
-
|
|
13464
|
+
if (state.optionalChainMember) {
|
|
13465
|
+
node.optional = isOptionalCall;
|
|
13466
|
+
}
|
|
13556
13467
|
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
_node9.typeParameters = typeArguments;
|
|
13468
|
+
return this.finishCallExpression(node, state.optionalChainMember);
|
|
13469
|
+
} else if (tokenIsTemplate(this.state.type)) {
|
|
13470
|
+
var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
13561
13471
|
|
|
13562
|
-
|
|
13563
|
-
|
|
13472
|
+
_result.typeParameters = typeArguments;
|
|
13473
|
+
return _result;
|
|
13564
13474
|
}
|
|
13565
|
-
|
|
13566
|
-
return this.finishCallExpression(_node9, state.optionalChainMember);
|
|
13567
13475
|
}
|
|
13568
13476
|
|
|
13569
|
-
|
|
13570
|
-
throw this.unexpected();
|
|
13571
|
-
}
|
|
13572
|
-
|
|
13573
|
-
var node = this.startNodeAt(startPos, startLoc);
|
|
13574
|
-
node.expression = base;
|
|
13575
|
-
node.typeParameters = typeArguments;
|
|
13576
|
-
return this.finishNode(node, "TSInstantiationExpression");
|
|
13477
|
+
this.unexpected();
|
|
13577
13478
|
});
|
|
13578
13479
|
|
|
13579
13480
|
if (missingParenErrorLoc) {
|
|
@@ -13586,18 +13487,20 @@ var typescript = superClass => class extends superClass {
|
|
|
13586
13487
|
return super.parseSubscript(base, startPos, startLoc, noCalls, state);
|
|
13587
13488
|
}
|
|
13588
13489
|
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13490
|
+
parseNewArguments(node) {
|
|
13491
|
+
if (this.match(47) || this.match(51)) {
|
|
13492
|
+
var typeParameters = this.tsTryParseAndCatch(() => {
|
|
13493
|
+
var args = this.tsParseTypeArgumentsInExpression();
|
|
13494
|
+
if (!this.match(10)) this.unexpected();
|
|
13495
|
+
return args;
|
|
13496
|
+
});
|
|
13596
13497
|
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
|
|
13498
|
+
if (typeParameters) {
|
|
13499
|
+
node.typeParameters = typeParameters;
|
|
13500
|
+
}
|
|
13600
13501
|
}
|
|
13502
|
+
|
|
13503
|
+
super.parseNewArguments(node);
|
|
13601
13504
|
}
|
|
13602
13505
|
|
|
13603
13506
|
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
|
|
@@ -13785,9 +13688,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13785
13688
|
this.tsParseModifiers({
|
|
13786
13689
|
modified: member,
|
|
13787
13690
|
allowedModifiers: modifiers,
|
|
13788
|
-
|
|
13789
|
-
stopOnStartOfClassStaticBlock: true,
|
|
13790
|
-
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
13691
|
+
stopOnStartOfClassStaticBlock: true
|
|
13791
13692
|
});
|
|
13792
13693
|
|
|
13793
13694
|
var callParseClassMemberWithIsStatic = () => {
|
|
@@ -13966,7 +13867,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13966
13867
|
}
|
|
13967
13868
|
|
|
13968
13869
|
super.parseClassId(node, isStatement, optionalId, node.declare ? BIND_TS_AMBIENT : BIND_CLASS);
|
|
13969
|
-
var typeParameters = this.tsTryParseTypeParameters(
|
|
13870
|
+
var typeParameters = this.tsTryParseTypeParameters();
|
|
13970
13871
|
if (typeParameters) node.typeParameters = typeParameters;
|
|
13971
13872
|
}
|
|
13972
13873
|
|
|
@@ -14072,8 +13973,8 @@ var typescript = superClass => class extends superClass {
|
|
|
14072
13973
|
var typeParameters = this.tsTryParseTypeParameters();
|
|
14073
13974
|
if (typeParameters) prop.typeParameters = typeParameters;
|
|
14074
13975
|
|
|
14075
|
-
for (var
|
|
14076
|
-
args[
|
|
13976
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
13977
|
+
args[_key5 - 1] = arguments[_key5];
|
|
14077
13978
|
}
|
|
14078
13979
|
|
|
14079
13980
|
super.parseObjPropValue(prop, ...args);
|
|
@@ -14109,8 +14010,8 @@ var typescript = superClass => class extends superClass {
|
|
|
14109
14010
|
}
|
|
14110
14011
|
|
|
14111
14012
|
parseMaybeAssign() {
|
|
14112
|
-
for (var
|
|
14113
|
-
args[
|
|
14013
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
14014
|
+
args[_key6] = arguments[_key6];
|
|
14114
14015
|
}
|
|
14115
14016
|
|
|
14116
14017
|
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
|
|
@@ -14137,10 +14038,10 @@ var typescript = superClass => class extends superClass {
|
|
|
14137
14038
|
return super.parseMaybeAssign(...args);
|
|
14138
14039
|
}
|
|
14139
14040
|
|
|
14140
|
-
if (!state || state === this.state) state = this.state.clone();
|
|
14141
14041
|
var typeParameters;
|
|
14042
|
+
state = state || this.state.clone();
|
|
14142
14043
|
var arrow = this.tryParse(abort => {
|
|
14143
|
-
var _expr$extra, _typeParameters
|
|
14044
|
+
var _expr$extra, _typeParameters, _expr$typeParameters$;
|
|
14144
14045
|
|
|
14145
14046
|
typeParameters = this.tsParseTypeParameters();
|
|
14146
14047
|
var expr = super.parseMaybeAssign(...args);
|
|
@@ -14154,6 +14055,12 @@ var typescript = superClass => class extends superClass {
|
|
|
14154
14055
|
}
|
|
14155
14056
|
|
|
14156
14057
|
expr.typeParameters = typeParameters;
|
|
14058
|
+
|
|
14059
|
+
if (this.hasPlugin("jsx") && expr.typeParameters.params.length === 1 && !((_expr$typeParameters$ = expr.typeParameters.extra) != null && _expr$typeParameters$.trailingComma)) {
|
|
14060
|
+
var parameter = expr.typeParameters.params[0];
|
|
14061
|
+
if (!parameter.constraint) ;
|
|
14062
|
+
}
|
|
14063
|
+
|
|
14157
14064
|
return expr;
|
|
14158
14065
|
}, state);
|
|
14159
14066
|
|
|
@@ -14260,33 +14167,23 @@ var typescript = superClass => class extends superClass {
|
|
|
14260
14167
|
var isLHS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14261
14168
|
|
|
14262
14169
|
switch (node.type) {
|
|
14170
|
+
case "TSTypeCastExpression":
|
|
14171
|
+
return super.toAssignable(this.typeCastToParameter(node), isLHS);
|
|
14172
|
+
|
|
14173
|
+
case "TSParameterProperty":
|
|
14174
|
+
return super.toAssignable(node, isLHS);
|
|
14175
|
+
|
|
14263
14176
|
case "ParenthesizedExpression":
|
|
14264
|
-
this.toAssignableParenthesizedExpression(node, isLHS);
|
|
14265
|
-
break;
|
|
14177
|
+
return this.toAssignableParenthesizedExpression(node, isLHS);
|
|
14266
14178
|
|
|
14267
14179
|
case "TSAsExpression":
|
|
14268
14180
|
case "TSNonNullExpression":
|
|
14269
14181
|
case "TSTypeAssertion":
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
at: node
|
|
14273
|
-
});
|
|
14274
|
-
} else {
|
|
14275
|
-
this.raise(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14276
|
-
at: node
|
|
14277
|
-
});
|
|
14278
|
-
}
|
|
14279
|
-
|
|
14280
|
-
this.toAssignable(node.expression, isLHS);
|
|
14281
|
-
break;
|
|
14282
|
-
|
|
14283
|
-
case "AssignmentExpression":
|
|
14284
|
-
if (!isLHS && node.left.type === "TSTypeCastExpression") {
|
|
14285
|
-
node.left = this.typeCastToParameter(node.left);
|
|
14286
|
-
}
|
|
14182
|
+
node.expression = this.toAssignable(node.expression, isLHS);
|
|
14183
|
+
return node;
|
|
14287
14184
|
|
|
14288
14185
|
default:
|
|
14289
|
-
super.toAssignable(node, isLHS);
|
|
14186
|
+
return super.toAssignable(node, isLHS);
|
|
14290
14187
|
}
|
|
14291
14188
|
}
|
|
14292
14189
|
|
|
@@ -14296,35 +14193,22 @@ var typescript = superClass => class extends superClass {
|
|
|
14296
14193
|
case "TSNonNullExpression":
|
|
14297
14194
|
case "TSTypeAssertion":
|
|
14298
14195
|
case "ParenthesizedExpression":
|
|
14299
|
-
this.toAssignable(node.expression, isLHS);
|
|
14300
|
-
|
|
14301
|
-
|
|
14302
|
-
default:
|
|
14303
|
-
super.toAssignable(node, isLHS);
|
|
14304
|
-
}
|
|
14305
|
-
}
|
|
14306
|
-
|
|
14307
|
-
checkToRestConversion(node, allowPattern) {
|
|
14308
|
-
switch (node.type) {
|
|
14309
|
-
case "TSAsExpression":
|
|
14310
|
-
case "TSTypeAssertion":
|
|
14311
|
-
case "TSNonNullExpression":
|
|
14312
|
-
this.checkToRestConversion(node.expression, false);
|
|
14313
|
-
break;
|
|
14196
|
+
node.expression = this.toAssignable(node.expression, isLHS);
|
|
14197
|
+
return node;
|
|
14314
14198
|
|
|
14315
14199
|
default:
|
|
14316
|
-
super.
|
|
14200
|
+
return super.toAssignable(node, isLHS);
|
|
14317
14201
|
}
|
|
14318
14202
|
}
|
|
14319
14203
|
|
|
14320
|
-
isValidLVal(type,
|
|
14204
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
14321
14205
|
return getOwn$1({
|
|
14322
14206
|
TSTypeCastExpression: true,
|
|
14323
14207
|
TSParameterProperty: "parameter",
|
|
14324
14208
|
TSNonNullExpression: "expression",
|
|
14325
|
-
TSAsExpression: (binding !== BIND_NONE ||
|
|
14326
|
-
TSTypeAssertion: (binding !== BIND_NONE ||
|
|
14327
|
-
}, type) || super.isValidLVal(type,
|
|
14209
|
+
TSAsExpression: (binding !== BIND_NONE || isParenthesized) && ["expression", true],
|
|
14210
|
+
TSTypeAssertion: (binding !== BIND_NONE || isParenthesized) && ["expression", true]
|
|
14211
|
+
}, type) || super.isValidLVal(type, isParenthesized, binding);
|
|
14328
14212
|
}
|
|
14329
14213
|
|
|
14330
14214
|
parseBindingAtom() {
|
|
@@ -14427,13 +14311,28 @@ var typescript = superClass => class extends superClass {
|
|
|
14427
14311
|
toAssignableList(exprList) {
|
|
14428
14312
|
for (var i = 0; i < exprList.length; i++) {
|
|
14429
14313
|
var expr = exprList[i];
|
|
14314
|
+
if (!expr) continue;
|
|
14430
14315
|
|
|
14431
|
-
|
|
14432
|
-
|
|
14316
|
+
switch (expr.type) {
|
|
14317
|
+
case "TSTypeCastExpression":
|
|
14318
|
+
exprList[i] = this.typeCastToParameter(expr);
|
|
14319
|
+
break;
|
|
14320
|
+
|
|
14321
|
+
case "TSAsExpression":
|
|
14322
|
+
case "TSTypeAssertion":
|
|
14323
|
+
if (!this.state.maybeInArrowParameters) {
|
|
14324
|
+
exprList[i] = this.typeCastToParameter(expr);
|
|
14325
|
+
} else {
|
|
14326
|
+
this.raise(TSErrors.UnexpectedTypeCastInParameter, {
|
|
14327
|
+
at: expr
|
|
14328
|
+
});
|
|
14329
|
+
}
|
|
14330
|
+
|
|
14331
|
+
break;
|
|
14433
14332
|
}
|
|
14434
14333
|
}
|
|
14435
14334
|
|
|
14436
|
-
super.toAssignableList(...arguments);
|
|
14335
|
+
return super.toAssignableList(...arguments);
|
|
14437
14336
|
}
|
|
14438
14337
|
|
|
14439
14338
|
typeCastToParameter(node) {
|
|
@@ -14503,8 +14402,8 @@ var typescript = superClass => class extends superClass {
|
|
|
14503
14402
|
this.state.inAbstractClass = !!node.abstract;
|
|
14504
14403
|
|
|
14505
14404
|
try {
|
|
14506
|
-
for (var
|
|
14507
|
-
args[
|
|
14405
|
+
for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
14406
|
+
args[_key7 - 1] = arguments[_key7];
|
|
14508
14407
|
}
|
|
14509
14408
|
|
|
14510
14409
|
return super.parseClass(node, ...args);
|
|
@@ -14628,16 +14527,7 @@ var typescript = superClass => class extends superClass {
|
|
|
14628
14527
|
}
|
|
14629
14528
|
} else if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
14630
14529
|
hasTypeSpecifier = true;
|
|
14631
|
-
|
|
14632
|
-
if (isImport) {
|
|
14633
|
-
leftOfAs = this.parseIdentifier(true);
|
|
14634
|
-
|
|
14635
|
-
if (!this.isContextual(93)) {
|
|
14636
|
-
this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
|
|
14637
|
-
}
|
|
14638
|
-
} else {
|
|
14639
|
-
leftOfAs = this.parseModuleExportName();
|
|
14640
|
-
}
|
|
14530
|
+
leftOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
|
|
14641
14531
|
}
|
|
14642
14532
|
|
|
14643
14533
|
if (hasTypeSpecifier && isInTypeOnlyImportExport) {
|
|
@@ -14736,8 +14626,8 @@ var placeholders = superClass => class extends superClass {
|
|
|
14736
14626
|
}
|
|
14737
14627
|
|
|
14738
14628
|
isValidLVal(type) {
|
|
14739
|
-
for (var
|
|
14740
|
-
rest[
|
|
14629
|
+
for (var _len8 = arguments.length, rest = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
14630
|
+
rest[_key8 - 1] = arguments[_key8];
|
|
14741
14631
|
}
|
|
14742
14632
|
|
|
14743
14633
|
return type === "Placeholder" || super.isValidLVal(type, ...rest);
|
|
@@ -14746,9 +14636,10 @@ var placeholders = superClass => class extends superClass {
|
|
|
14746
14636
|
toAssignable(node) {
|
|
14747
14637
|
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
|
14748
14638
|
node.expectedNode = "Pattern";
|
|
14749
|
-
|
|
14750
|
-
super.toAssignable(...arguments);
|
|
14639
|
+
return node;
|
|
14751
14640
|
}
|
|
14641
|
+
|
|
14642
|
+
return super.toAssignable(...arguments);
|
|
14752
14643
|
}
|
|
14753
14644
|
|
|
14754
14645
|
isLet(context) {
|
|
@@ -15060,9 +14951,9 @@ function validatePlugins(plugins) {
|
|
|
15060
14951
|
throw new Error("Cannot combine importAssertions and moduleAttributes plugins.");
|
|
15061
14952
|
}
|
|
15062
14953
|
|
|
15063
|
-
var
|
|
14954
|
+
var moduleAttributesVerionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
|
|
15064
14955
|
|
|
15065
|
-
if (
|
|
14956
|
+
if (moduleAttributesVerionPluginOption !== "may-2020") {
|
|
15066
14957
|
throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
|
|
15067
14958
|
}
|
|
15068
14959
|
}
|
|
@@ -15136,7 +15027,7 @@ class LValParser extends NodeUtils {
|
|
|
15136
15027
|
|
|
15137
15028
|
if (isLHS) {
|
|
15138
15029
|
if (parenthesized.type === "Identifier") {
|
|
15139
|
-
this.expressionScope.
|
|
15030
|
+
this.expressionScope.recordParenthesizedIdentifierError({
|
|
15140
15031
|
at: node
|
|
15141
15032
|
});
|
|
15142
15033
|
} else if (parenthesized.type !== "MemberExpression") {
|
|
@@ -15195,7 +15086,11 @@ class LValParser extends NodeUtils {
|
|
|
15195
15086
|
|
|
15196
15087
|
case "SpreadElement":
|
|
15197
15088
|
{
|
|
15198
|
-
|
|
15089
|
+
this.checkToRestConversion(node);
|
|
15090
|
+
node.type = "RestElement";
|
|
15091
|
+
var arg = node.argument;
|
|
15092
|
+
this.toAssignable(arg, isLHS);
|
|
15093
|
+
break;
|
|
15199
15094
|
}
|
|
15200
15095
|
|
|
15201
15096
|
case "ArrayExpression":
|
|
@@ -15219,6 +15114,8 @@ class LValParser extends NodeUtils {
|
|
|
15219
15114
|
this.toAssignable(parenthesized, isLHS);
|
|
15220
15115
|
break;
|
|
15221
15116
|
}
|
|
15117
|
+
|
|
15118
|
+
return node;
|
|
15222
15119
|
}
|
|
15223
15120
|
|
|
15224
15121
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
@@ -15226,50 +15123,58 @@ class LValParser extends NodeUtils {
|
|
|
15226
15123
|
this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, {
|
|
15227
15124
|
at: prop.key
|
|
15228
15125
|
});
|
|
15229
|
-
} else if (prop.type === "SpreadElement") {
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
this.toAssignable(arg, isLHS);
|
|
15234
|
-
|
|
15235
|
-
if (!isLast) {
|
|
15236
|
-
this.raise(Errors.RestTrailingComma, {
|
|
15237
|
-
at: prop
|
|
15238
|
-
});
|
|
15239
|
-
}
|
|
15126
|
+
} else if (prop.type === "SpreadElement" && !isLast) {
|
|
15127
|
+
this.raise(Errors.RestTrailingComma, {
|
|
15128
|
+
at: prop
|
|
15129
|
+
});
|
|
15240
15130
|
} else {
|
|
15241
15131
|
this.toAssignable(prop, isLHS);
|
|
15242
15132
|
}
|
|
15243
15133
|
}
|
|
15244
15134
|
|
|
15245
15135
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
15246
|
-
var end = exprList.length
|
|
15136
|
+
var end = exprList.length;
|
|
15247
15137
|
|
|
15248
|
-
|
|
15249
|
-
var
|
|
15250
|
-
if (!elt) continue;
|
|
15138
|
+
if (end) {
|
|
15139
|
+
var last = exprList[end - 1];
|
|
15251
15140
|
|
|
15252
|
-
if (
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15141
|
+
if ((last == null ? void 0 : last.type) === "RestElement") {
|
|
15142
|
+
--end;
|
|
15143
|
+
} else if ((last == null ? void 0 : last.type) === "SpreadElement") {
|
|
15144
|
+
last.type = "RestElement";
|
|
15145
|
+
var arg = last.argument;
|
|
15256
15146
|
this.toAssignable(arg, isLHS);
|
|
15257
|
-
|
|
15258
|
-
this.toAssignable(elt, isLHS);
|
|
15259
|
-
}
|
|
15147
|
+
arg = unwrapParenthesizedExpression(arg);
|
|
15260
15148
|
|
|
15261
|
-
|
|
15262
|
-
|
|
15149
|
+
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern") {
|
|
15150
|
+
this.unexpected(arg.start);
|
|
15151
|
+
}
|
|
15152
|
+
|
|
15153
|
+
if (trailingCommaLoc) {
|
|
15263
15154
|
this.raise(Errors.RestTrailingComma, {
|
|
15264
|
-
at:
|
|
15155
|
+
at: trailingCommaLoc
|
|
15265
15156
|
});
|
|
15266
|
-
}
|
|
15157
|
+
}
|
|
15158
|
+
|
|
15159
|
+
--end;
|
|
15160
|
+
}
|
|
15161
|
+
}
|
|
15162
|
+
|
|
15163
|
+
for (var i = 0; i < end; i++) {
|
|
15164
|
+
var elt = exprList[i];
|
|
15165
|
+
|
|
15166
|
+
if (elt) {
|
|
15167
|
+
this.toAssignable(elt, isLHS);
|
|
15168
|
+
|
|
15169
|
+
if (elt.type === "RestElement") {
|
|
15267
15170
|
this.raise(Errors.RestTrailingComma, {
|
|
15268
|
-
at:
|
|
15171
|
+
at: elt
|
|
15269
15172
|
});
|
|
15270
15173
|
}
|
|
15271
15174
|
}
|
|
15272
15175
|
}
|
|
15176
|
+
|
|
15177
|
+
return exprList;
|
|
15273
15178
|
}
|
|
15274
15179
|
|
|
15275
15180
|
isAssignable(node, isBinding) {
|
|
@@ -15459,7 +15364,7 @@ class LValParser extends NodeUtils {
|
|
|
15459
15364
|
return this.finishNode(node, "AssignmentPattern");
|
|
15460
15365
|
}
|
|
15461
15366
|
|
|
15462
|
-
isValidLVal(type,
|
|
15367
|
+
isValidLVal(type, isParenthesized, binding) {
|
|
15463
15368
|
return getOwn({
|
|
15464
15369
|
AssignmentPattern: "left",
|
|
15465
15370
|
RestElement: "argument",
|
|
@@ -15470,7 +15375,7 @@ class LValParser extends NodeUtils {
|
|
|
15470
15375
|
}, type);
|
|
15471
15376
|
}
|
|
15472
15377
|
|
|
15473
|
-
checkLVal(expression,
|
|
15378
|
+
checkLVal(expression, _ref86) {
|
|
15474
15379
|
var {
|
|
15475
15380
|
in: ancestor,
|
|
15476
15381
|
binding = BIND_NONE,
|
|
@@ -15478,7 +15383,7 @@ class LValParser extends NodeUtils {
|
|
|
15478
15383
|
strictModeChanged = false,
|
|
15479
15384
|
allowingSloppyLetBinding = !(binding & BIND_SCOPE_LEXICAL),
|
|
15480
15385
|
hasParenthesizedAncestor = false
|
|
15481
|
-
} =
|
|
15386
|
+
} = _ref86;
|
|
15482
15387
|
|
|
15483
15388
|
var _expression$extra;
|
|
15484
15389
|
|
|
@@ -15514,7 +15419,7 @@ class LValParser extends NodeUtils {
|
|
|
15514
15419
|
return;
|
|
15515
15420
|
}
|
|
15516
15421
|
|
|
15517
|
-
var validity = this.isValidLVal(expression.type,
|
|
15422
|
+
var validity = this.isValidLVal(expression.type, hasParenthesizedAncestor || ((_expression$extra = expression.extra) == null ? void 0 : _expression$extra.parenthesized), binding);
|
|
15518
15423
|
if (validity === true) return;
|
|
15519
15424
|
|
|
15520
15425
|
if (validity === false) {
|
|
@@ -15581,24 +15486,11 @@ class LValParser extends NodeUtils {
|
|
|
15581
15486
|
this.scope.declareName(identifier.name, binding, identifier.loc.start);
|
|
15582
15487
|
}
|
|
15583
15488
|
|
|
15584
|
-
checkToRestConversion(node
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
case "Identifier":
|
|
15591
|
-
case "MemberExpression":
|
|
15592
|
-
break;
|
|
15593
|
-
|
|
15594
|
-
case "ArrayExpression":
|
|
15595
|
-
case "ObjectExpression":
|
|
15596
|
-
if (allowPattern) break;
|
|
15597
|
-
|
|
15598
|
-
default:
|
|
15599
|
-
this.raise(Errors.InvalidRestAssignmentPattern, {
|
|
15600
|
-
at: node
|
|
15601
|
-
});
|
|
15489
|
+
checkToRestConversion(node) {
|
|
15490
|
+
if (node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression") {
|
|
15491
|
+
this.raise(Errors.InvalidRestAssignmentPattern, {
|
|
15492
|
+
at: node.argument
|
|
15493
|
+
});
|
|
15602
15494
|
}
|
|
15603
15495
|
}
|
|
15604
15496
|
|
|
@@ -15759,8 +15651,7 @@ class ExpressionParser extends LValParser {
|
|
|
15759
15651
|
node.operator = operator;
|
|
15760
15652
|
|
|
15761
15653
|
if (this.match(29)) {
|
|
15762
|
-
this.toAssignable(left, true);
|
|
15763
|
-
node.left = left;
|
|
15654
|
+
node.left = this.toAssignable(left, true);
|
|
15764
15655
|
|
|
15765
15656
|
if (refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startPos) {
|
|
15766
15657
|
refExpressionErrors.doubleProtoLoc = null;
|
|
@@ -16060,14 +15951,14 @@ class ExpressionParser extends LValParser {
|
|
|
16060
15951
|
if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
|
|
16061
15952
|
|
|
16062
15953
|
while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
|
|
16063
|
-
var
|
|
15954
|
+
var _node9 = this.startNodeAt(startPos, startLoc);
|
|
16064
15955
|
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
15956
|
+
_node9.operator = this.state.value;
|
|
15957
|
+
_node9.prefix = false;
|
|
15958
|
+
_node9.argument = expr;
|
|
16068
15959
|
this.next();
|
|
16069
15960
|
this.checkLVal(expr, {
|
|
16070
|
-
in: expr = this.finishNode(
|
|
15961
|
+
in: expr = this.finishNode(_node9, "UpdateExpression")
|
|
16071
15962
|
});
|
|
16072
15963
|
}
|
|
16073
15964
|
|
|
@@ -16927,20 +16818,6 @@ class ExpressionParser extends LValParser {
|
|
|
16927
16818
|
}
|
|
16928
16819
|
|
|
16929
16820
|
parseNew(node) {
|
|
16930
|
-
this.parseNewCallee(node);
|
|
16931
|
-
|
|
16932
|
-
if (this.eat(10)) {
|
|
16933
|
-
var args = this.parseExprList(11);
|
|
16934
|
-
this.toReferencedList(args);
|
|
16935
|
-
node.arguments = args;
|
|
16936
|
-
} else {
|
|
16937
|
-
node.arguments = [];
|
|
16938
|
-
}
|
|
16939
|
-
|
|
16940
|
-
return this.finishNode(node, "NewExpression");
|
|
16941
|
-
}
|
|
16942
|
-
|
|
16943
|
-
parseNewCallee(node) {
|
|
16944
16821
|
node.callee = this.parseNoCallExpr();
|
|
16945
16822
|
|
|
16946
16823
|
if (node.callee.type === "Import") {
|
|
@@ -16956,6 +16833,19 @@ class ExpressionParser extends LValParser {
|
|
|
16956
16833
|
at: this.state.startLoc
|
|
16957
16834
|
});
|
|
16958
16835
|
}
|
|
16836
|
+
|
|
16837
|
+
this.parseNewArguments(node);
|
|
16838
|
+
return this.finishNode(node, "NewExpression");
|
|
16839
|
+
}
|
|
16840
|
+
|
|
16841
|
+
parseNewArguments(node) {
|
|
16842
|
+
if (this.eat(10)) {
|
|
16843
|
+
var args = this.parseExprList(11);
|
|
16844
|
+
this.toReferencedList(args);
|
|
16845
|
+
node.arguments = args;
|
|
16846
|
+
} else {
|
|
16847
|
+
node.arguments = [];
|
|
16848
|
+
}
|
|
16959
16849
|
}
|
|
16960
16850
|
|
|
16961
16851
|
parseTemplateElement(isTagged) {
|
|
@@ -17362,8 +17252,7 @@ class ExpressionParser extends LValParser {
|
|
|
17362
17252
|
}
|
|
17363
17253
|
|
|
17364
17254
|
setArrowFunctionParameters(node, params, trailingCommaLoc) {
|
|
17365
|
-
this.toAssignableList(params, trailingCommaLoc, false);
|
|
17366
|
-
node.params = params;
|
|
17255
|
+
node.params = this.toAssignableList(params, trailingCommaLoc, false);
|
|
17367
17256
|
}
|
|
17368
17257
|
|
|
17369
17258
|
parseFunctionBodyAndFinish(node, type) {
|
|
@@ -18304,12 +18193,12 @@ class StatementParser extends ExpressionParser {
|
|
|
18304
18193
|
expr = this.parseIdentifier(false);
|
|
18305
18194
|
|
|
18306
18195
|
while (this.eat(16)) {
|
|
18307
|
-
var
|
|
18196
|
+
var _node10 = this.startNodeAt(startPos, startLoc);
|
|
18308
18197
|
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
expr = this.finishNode(
|
|
18198
|
+
_node10.object = expr;
|
|
18199
|
+
_node10.property = this.parseIdentifier(true);
|
|
18200
|
+
_node10.computed = false;
|
|
18201
|
+
expr = this.finishNode(_node10, "MemberExpression");
|
|
18313
18202
|
}
|
|
18314
18203
|
}
|
|
18315
18204
|
|