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