@putout/babel 5.3.3 → 5.3.5
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/README.md +1 -0
- package/bundle/index.js +409 -219
- package/bundle/metafile-esm.json +1 -1
- package/package.json +1 -1
package/bundle/index.js
CHANGED
|
@@ -414,6 +414,7 @@ __export(lib_exports, {
|
|
|
414
414
|
BOOLEAN_UNARY_OPERATORS: () => BOOLEAN_UNARY_OPERATORS,
|
|
415
415
|
BUILDER_KEYS: () => BUILDER_KEYS,
|
|
416
416
|
BigIntLiteral: () => BigIntLiteral,
|
|
417
|
+
BigIntLiteralTypeAnnotation: () => BigIntLiteralTypeAnnotation,
|
|
417
418
|
BinaryExpression: () => BinaryExpression,
|
|
418
419
|
BindExpression: () => BindExpression,
|
|
419
420
|
BlockStatement: () => BlockStatement,
|
|
@@ -743,6 +744,7 @@ __export(lib_exports, {
|
|
|
743
744
|
assertAssignmentPattern: () => assertAssignmentPattern,
|
|
744
745
|
assertAwaitExpression: () => assertAwaitExpression,
|
|
745
746
|
assertBigIntLiteral: () => assertBigIntLiteral,
|
|
747
|
+
assertBigIntLiteralTypeAnnotation: () => assertBigIntLiteralTypeAnnotation,
|
|
746
748
|
assertBinary: () => assertBinary,
|
|
747
749
|
assertBinaryExpression: () => assertBinaryExpression,
|
|
748
750
|
assertBindExpression: () => assertBindExpression,
|
|
@@ -1039,6 +1041,7 @@ __export(lib_exports, {
|
|
|
1039
1041
|
assignmentPattern: () => assignmentPattern,
|
|
1040
1042
|
awaitExpression: () => awaitExpression,
|
|
1041
1043
|
bigIntLiteral: () => bigIntLiteral,
|
|
1044
|
+
bigIntLiteralTypeAnnotation: () => bigIntLiteralTypeAnnotation,
|
|
1042
1045
|
binaryExpression: () => binaryExpression,
|
|
1043
1046
|
bindExpression: () => bindExpression,
|
|
1044
1047
|
blockStatement: () => blockStatement,
|
|
@@ -1153,6 +1156,7 @@ __export(lib_exports, {
|
|
|
1153
1156
|
isAssignmentPattern: () => isAssignmentPattern,
|
|
1154
1157
|
isAwaitExpression: () => isAwaitExpression,
|
|
1155
1158
|
isBigIntLiteral: () => isBigIntLiteral,
|
|
1159
|
+
isBigIntLiteralTypeAnnotation: () => isBigIntLiteralTypeAnnotation,
|
|
1156
1160
|
isBinary: () => isBinary,
|
|
1157
1161
|
isBinaryExpression: () => isBinaryExpression,
|
|
1158
1162
|
isBindExpression: () => isBindExpression,
|
|
@@ -4352,6 +4356,16 @@ function isNumberLiteralTypeAnnotation(node, opts) {
|
|
|
4352
4356
|
return opts == null || shallowEqual(node, opts);
|
|
4353
4357
|
}
|
|
4354
4358
|
|
|
4359
|
+
function isBigIntLiteralTypeAnnotation(node, opts) {
|
|
4360
|
+
if (!node)
|
|
4361
|
+
return false;
|
|
4362
|
+
|
|
4363
|
+
if (node.type !== 'BigIntLiteralTypeAnnotation')
|
|
4364
|
+
return false;
|
|
4365
|
+
|
|
4366
|
+
return opts == null || shallowEqual(node, opts);
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4355
4369
|
function isNumberTypeAnnotation(node, opts) {
|
|
4356
4370
|
if (!node)
|
|
4357
4371
|
return false;
|
|
@@ -8010,7 +8024,7 @@ defineType$4('FunctionDeclaration', {
|
|
|
8010
8024
|
validate: assertNodeType('BlockStatement'),
|
|
8011
8025
|
},
|
|
8012
8026
|
predicate: {
|
|
8013
|
-
validate: assertNodeType('
|
|
8027
|
+
validate: assertNodeType('FlowPredicate'),
|
|
8014
8028
|
optional: true,
|
|
8015
8029
|
},
|
|
8016
8030
|
},
|
|
@@ -8054,7 +8068,7 @@ defineType$4('FunctionExpression', {
|
|
|
8054
8068
|
validate: assertNodeType('BlockStatement'),
|
|
8055
8069
|
},
|
|
8056
8070
|
predicate: {
|
|
8057
|
-
validate: assertNodeType('
|
|
8071
|
+
validate: assertNodeType('FlowPredicate'),
|
|
8058
8072
|
optional: true,
|
|
8059
8073
|
},
|
|
8060
8074
|
},
|
|
@@ -8876,7 +8890,7 @@ defineType$4('ArrowFunctionExpression', {
|
|
|
8876
8890
|
validate: assertNodeType('BlockStatement', 'Expression'),
|
|
8877
8891
|
},
|
|
8878
8892
|
predicate: {
|
|
8879
|
-
validate: assertNodeType('
|
|
8893
|
+
validate: assertNodeType('FlowPredicate'),
|
|
8880
8894
|
optional: true,
|
|
8881
8895
|
},
|
|
8882
8896
|
},
|
|
@@ -9034,7 +9048,7 @@ defineType$4('ExportDefaultDeclaration', {
|
|
|
9034
9048
|
'ExportDeclaration',
|
|
9035
9049
|
],
|
|
9036
9050
|
fields: {
|
|
9037
|
-
declaration: validateType('
|
|
9051
|
+
declaration: validateType('FunctionDeclaration', 'ClassDeclaration', 'Expression', 'TSDeclareFunction', 'TSInterfaceDeclaration', 'EnumDeclaration'),
|
|
9038
9052
|
exportKind: validateOptional(assertOneOf('value')),
|
|
9039
9053
|
},
|
|
9040
9054
|
});
|
|
@@ -9550,7 +9564,7 @@ defineType$4('ExportNamespaceSpecifier', {
|
|
|
9550
9564
|
aliases: ['ModuleSpecifier'],
|
|
9551
9565
|
fields: {
|
|
9552
9566
|
exported: {
|
|
9553
|
-
validate: assertNodeType('Identifier'),
|
|
9567
|
+
validate: assertNodeType('Identifier', 'StringLiteral'),
|
|
9554
9568
|
},
|
|
9555
9569
|
},
|
|
9556
9570
|
});
|
|
@@ -9869,7 +9883,7 @@ defineType$3('DeclareFunction', {
|
|
|
9869
9883
|
],
|
|
9870
9884
|
fields: {
|
|
9871
9885
|
id: validateType('Identifier'),
|
|
9872
|
-
predicate: validateOptionalType('
|
|
9886
|
+
predicate: validateOptionalType('FlowPredicate'),
|
|
9873
9887
|
},
|
|
9874
9888
|
});
|
|
9875
9889
|
defineInterfaceishType('DeclareInterface');
|
|
@@ -9981,7 +9995,7 @@ defineType$3('DeclaredPredicate', {
|
|
|
9981
9995
|
visitor: ['value'],
|
|
9982
9996
|
aliases: ['FlowPredicate'],
|
|
9983
9997
|
fields: {
|
|
9984
|
-
value: validateType('
|
|
9998
|
+
value: validateType('Expression'),
|
|
9985
9999
|
},
|
|
9986
10000
|
});
|
|
9987
10001
|
defineType$3('ExistsTypeAnnotation', {
|
|
@@ -10072,6 +10086,13 @@ defineType$3('NumberLiteralTypeAnnotation', {
|
|
|
10072
10086
|
value: validate$2(assertValueType('number')),
|
|
10073
10087
|
},
|
|
10074
10088
|
});
|
|
10089
|
+
defineType$3('BigIntLiteralTypeAnnotation', {
|
|
10090
|
+
builder: ['value'],
|
|
10091
|
+
aliases: ['FlowType'],
|
|
10092
|
+
fields: {
|
|
10093
|
+
value: validate$2(assertValueType('bigint')),
|
|
10094
|
+
},
|
|
10095
|
+
});
|
|
10075
10096
|
defineType$3('NumberTypeAnnotation', {
|
|
10076
10097
|
aliases: ['FlowType', 'FlowBaseAnnotation'],
|
|
10077
10098
|
});
|
|
@@ -10170,7 +10191,7 @@ defineType$3('ObjectTypeProperty', {
|
|
|
10170
10191
|
],
|
|
10171
10192
|
aliases: ['UserWhitespacable'],
|
|
10172
10193
|
fields: {
|
|
10173
|
-
key: validateType('Identifier', 'StringLiteral'),
|
|
10194
|
+
key: validateType('Identifier', 'StringLiteral', 'NumericLiteral'),
|
|
10174
10195
|
value: validateType('FlowType'),
|
|
10175
10196
|
kind: {
|
|
10176
10197
|
validate: assertOneOf('init', 'get', 'set'),
|
|
@@ -10651,7 +10672,7 @@ defineType$5('BindExpression', {
|
|
|
10651
10672
|
aliases: ['Expression'],
|
|
10652
10673
|
fields: {
|
|
10653
10674
|
object: {
|
|
10654
|
-
validate:
|
|
10675
|
+
validate: assertNodeOrValueType('null', 'Expression'),
|
|
10655
10676
|
},
|
|
10656
10677
|
callee: {
|
|
10657
10678
|
validate: assertNodeType('Expression'),
|
|
@@ -11195,7 +11216,7 @@ defineType('TSInterfaceDeclaration', {
|
|
|
11195
11216
|
declare: validateOptional(bool),
|
|
11196
11217
|
id: validateType('Identifier'),
|
|
11197
11218
|
typeParameters: validateOptionalType('TSTypeParameterDeclaration'),
|
|
11198
|
-
extends: validateOptional(arrayOfType('
|
|
11219
|
+
extends: validateOptional(arrayOfType('TSInterfaceHeritage')),
|
|
11199
11220
|
body: validateType('TSInterfaceBody'),
|
|
11200
11221
|
},
|
|
11201
11222
|
});
|
|
@@ -11282,7 +11303,7 @@ defineType('TSModuleDeclaration', {
|
|
|
11282
11303
|
visitor: ['id', 'body'],
|
|
11283
11304
|
fields: {
|
|
11284
11305
|
kind: {
|
|
11285
|
-
validate: assertOneOf('global', 'namespace'),
|
|
11306
|
+
validate: assertOneOf('global', 'namespace', 'module'),
|
|
11286
11307
|
default: 'namespace',
|
|
11287
11308
|
},
|
|
11288
11309
|
declare: validateOptional(bool),
|
|
@@ -13029,6 +13050,17 @@ function numberLiteralTypeAnnotation(value) {
|
|
|
13029
13050
|
return node;
|
|
13030
13051
|
}
|
|
13031
13052
|
|
|
13053
|
+
function bigIntLiteralTypeAnnotation(value) {
|
|
13054
|
+
const node = {
|
|
13055
|
+
type: 'BigIntLiteralTypeAnnotation',
|
|
13056
|
+
value,
|
|
13057
|
+
};
|
|
13058
|
+
|
|
13059
|
+
const defs2 = NODE_FIELDS.BigIntLiteralTypeAnnotation;
|
|
13060
|
+
validate(defs2.value, node, 'value', value);
|
|
13061
|
+
return node;
|
|
13062
|
+
}
|
|
13063
|
+
|
|
13032
13064
|
function numberTypeAnnotation() {
|
|
13033
13065
|
return {
|
|
13034
13066
|
type: 'NumberTypeAnnotation',
|
|
@@ -14581,6 +14613,7 @@ var b = /* @__PURE__ */Object.freeze({
|
|
|
14581
14613
|
assignmentPattern,
|
|
14582
14614
|
awaitExpression,
|
|
14583
14615
|
bigIntLiteral,
|
|
14616
|
+
bigIntLiteralTypeAnnotation,
|
|
14584
14617
|
binaryExpression,
|
|
14585
14618
|
bindExpression,
|
|
14586
14619
|
blockStatement,
|
|
@@ -14949,6 +14982,7 @@ var MixedTypeAnnotation = alias('mixedTypeAnnotation');
|
|
|
14949
14982
|
var EmptyTypeAnnotation = alias('emptyTypeAnnotation');
|
|
14950
14983
|
var NullableTypeAnnotation = alias('nullableTypeAnnotation');
|
|
14951
14984
|
var NumberLiteralTypeAnnotation = alias('numberLiteralTypeAnnotation');
|
|
14985
|
+
var BigIntLiteralTypeAnnotation = alias('bigIntLiteralTypeAnnotation');
|
|
14952
14986
|
var NumberTypeAnnotation = alias('numberTypeAnnotation');
|
|
14953
14987
|
var ObjectTypeAnnotation = alias('objectTypeAnnotation');
|
|
14954
14988
|
var ObjectTypeInternalSlot = alias('objectTypeInternalSlot');
|
|
@@ -15631,6 +15665,10 @@ function assertNumberLiteralTypeAnnotation(node, opts) {
|
|
|
15631
15665
|
assert('NumberLiteralTypeAnnotation', node, opts);
|
|
15632
15666
|
}
|
|
15633
15667
|
|
|
15668
|
+
function assertBigIntLiteralTypeAnnotation(node, opts) {
|
|
15669
|
+
assert('BigIntLiteralTypeAnnotation', node, opts);
|
|
15670
|
+
}
|
|
15671
|
+
|
|
15634
15672
|
function assertNumberTypeAnnotation(node, opts) {
|
|
15635
15673
|
assert('NumberTypeAnnotation', node, opts);
|
|
15636
15674
|
}
|
|
@@ -17794,13 +17832,18 @@ var react = {
|
|
|
17794
17832
|
|
|
17795
17833
|
// ../babel-babel/packages/babel-parser/lib/index.js
|
|
17796
17834
|
var Position = class {
|
|
17797
|
-
line;
|
|
17798
|
-
column;
|
|
17799
|
-
index;
|
|
17800
17835
|
constructor(line, col, index3) {
|
|
17836
|
+
this.line = void 0;
|
|
17837
|
+
this.column = void 0;
|
|
17838
|
+
|
|
17839
|
+
if (index3 !== void 0)
|
|
17840
|
+
this.index = void 0;
|
|
17841
|
+
|
|
17801
17842
|
this.line = line;
|
|
17802
17843
|
this.column = col;
|
|
17803
|
-
|
|
17844
|
+
|
|
17845
|
+
if (index3 !== void 0)
|
|
17846
|
+
this.index = index3;
|
|
17804
17847
|
}
|
|
17805
17848
|
};
|
|
17806
17849
|
|
|
@@ -18059,13 +18102,13 @@ function defineHidden(obj, key, value) {
|
|
|
18059
18102
|
function toParseErrorConstructor({toMessage, code: code2, reasonCode, syntaxPlugin}) {
|
|
18060
18103
|
const hasMissingPlugin = reasonCode === 'MissingPlugin' || reasonCode === 'MissingOneOfPlugins';
|
|
18061
18104
|
|
|
18062
|
-
return function constructor(loc, details) {
|
|
18105
|
+
return function constructor(loc, pos, details) {
|
|
18063
18106
|
const error = new SyntaxError();
|
|
18064
18107
|
|
|
18065
18108
|
error.code = code2;
|
|
18066
18109
|
error.reasonCode = reasonCode;
|
|
18067
18110
|
error.loc = loc;
|
|
18068
|
-
error.pos =
|
|
18111
|
+
error.pos = pos;
|
|
18069
18112
|
error.syntaxPlugin = syntaxPlugin;
|
|
18070
18113
|
|
|
18071
18114
|
if (hasMissingPlugin) {
|
|
@@ -18076,10 +18119,10 @@ function toParseErrorConstructor({toMessage, code: code2, reasonCode, syntaxPlug
|
|
|
18076
18119
|
const {
|
|
18077
18120
|
line,
|
|
18078
18121
|
column,
|
|
18079
|
-
index: index3,
|
|
18122
|
+
index: index3 = pos,
|
|
18080
18123
|
} = overrides.loc ?? loc;
|
|
18081
18124
|
|
|
18082
|
-
return constructor(new Position(line, column, index3
|
|
18125
|
+
return constructor(new Position(line, column), index3, {
|
|
18083
18126
|
...details,
|
|
18084
18127
|
...overrides.details,
|
|
18085
18128
|
});
|
|
@@ -18160,6 +18203,7 @@ function createDefaultOptions() {
|
|
|
18160
18203
|
plugins: [],
|
|
18161
18204
|
strictMode: void 0,
|
|
18162
18205
|
ranges: false,
|
|
18206
|
+
locations: true,
|
|
18163
18207
|
tokens: false,
|
|
18164
18208
|
createImportExpressions: true,
|
|
18165
18209
|
createParenthesizedExpressions: false,
|
|
@@ -18212,32 +18256,27 @@ function getOptions(opts) {
|
|
|
18212
18256
|
return options;
|
|
18213
18257
|
}
|
|
18214
18258
|
|
|
18215
|
-
var {defineProperty} = Object;
|
|
18216
|
-
|
|
18217
|
-
var toUnenumerable = (object, key) => {
|
|
18218
|
-
if (object) {
|
|
18219
|
-
defineProperty(object, key, {
|
|
18220
|
-
enumerable: false,
|
|
18221
|
-
value: object[key],
|
|
18222
|
-
});
|
|
18223
|
-
}
|
|
18224
|
-
};
|
|
18225
|
-
|
|
18226
18259
|
function toESTreeLocation(node) {
|
|
18227
|
-
|
|
18228
|
-
|
|
18260
|
+
const {start, end} = node.loc;
|
|
18261
|
+
|
|
18262
|
+
node.loc.start = new Position(start.line, start.column);
|
|
18263
|
+
node.loc.end = new Position(end.line, end.column);
|
|
18229
18264
|
return node;
|
|
18230
18265
|
}
|
|
18231
18266
|
|
|
18232
18267
|
var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
18268
|
+
createPosition(loc) {
|
|
18269
|
+
return new Position(loc.line, loc.column);
|
|
18270
|
+
}
|
|
18271
|
+
|
|
18233
18272
|
parse() {
|
|
18234
|
-
const file2 =
|
|
18273
|
+
const file2 = super.parse();
|
|
18235
18274
|
|
|
18236
|
-
if (this.optionFlags &
|
|
18275
|
+
if (this.optionFlags & 512) {
|
|
18237
18276
|
file2.tokens = file2.tokens.map(toESTreeLocation);
|
|
18238
18277
|
}
|
|
18239
18278
|
|
|
18240
|
-
return file2;
|
|
18279
|
+
return toESTreeLocation(file2);
|
|
18241
18280
|
}
|
|
18242
18281
|
|
|
18243
18282
|
parseRegExpLiteral({pattern, flags}) {
|
|
@@ -18291,11 +18330,11 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
18291
18330
|
return this.estreeParseLiteral(value);
|
|
18292
18331
|
}
|
|
18293
18332
|
|
|
18294
|
-
estreeParseChainExpression(node,
|
|
18333
|
+
estreeParseChainExpression(node, endNode) {
|
|
18295
18334
|
const chain2 = this.startNodeAtNode(node);
|
|
18296
18335
|
|
|
18297
18336
|
chain2.expression = node;
|
|
18298
|
-
return this.
|
|
18337
|
+
return this.finishNodeAtNode(chain2, 'ChainExpression', endNode);
|
|
18299
18338
|
}
|
|
18300
18339
|
|
|
18301
18340
|
directiveToStmt(directive2) {
|
|
@@ -18521,7 +18560,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
18521
18560
|
const {key, value} = node;
|
|
18522
18561
|
|
|
18523
18562
|
if (this.isPrivateName(key)) {
|
|
18524
|
-
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.
|
|
18563
|
+
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.start);
|
|
18525
18564
|
}
|
|
18526
18565
|
|
|
18527
18566
|
this.toAssignable(value, isLHS);
|
|
@@ -18592,7 +18631,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
18592
18631
|
const node = super.stopParseSubscript(base, state);
|
|
18593
18632
|
|
|
18594
18633
|
if (state.optionalChainMember) {
|
|
18595
|
-
return this.estreeParseChainExpression(node, base
|
|
18634
|
+
return this.estreeParseChainExpression(node, base);
|
|
18596
18635
|
}
|
|
18597
18636
|
|
|
18598
18637
|
return node;
|
|
@@ -18661,6 +18700,10 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
18661
18700
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
18662
18701
|
}
|
|
18663
18702
|
|
|
18703
|
+
finishNodeAtNode(node, type, endNode) {
|
|
18704
|
+
return toESTreeLocation(super.finishNodeAtNode(node, type, endNode));
|
|
18705
|
+
}
|
|
18706
|
+
|
|
18664
18707
|
finishNode(node, type) {
|
|
18665
18708
|
const result = super.finishNode(node, type);
|
|
18666
18709
|
this.fillOptionalPropertiesForTSESLint(result);
|
|
@@ -20550,7 +20593,7 @@ var ScopeHandler = class {
|
|
|
20550
20593
|
const topLevelScope = this.scopeStack[0];
|
|
20551
20594
|
|
|
20552
20595
|
if (!topLevelScope.names.has(name)) {
|
|
20553
|
-
this.undefinedExports.set(name, id.
|
|
20596
|
+
this.undefinedExports.set(name, id.start);
|
|
20554
20597
|
}
|
|
20555
20598
|
}
|
|
20556
20599
|
|
|
@@ -21257,6 +21300,7 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
21257
21300
|
this.next();
|
|
21258
21301
|
|
|
21259
21302
|
if (this.eat(52)) {
|
|
21303
|
+
this.setLoc(startLoc);
|
|
21260
21304
|
closingElement = this.jsxParseClosingElementAt(startLoc);
|
|
21261
21305
|
break contents;
|
|
21262
21306
|
}
|
|
@@ -22444,6 +22488,15 @@ var Token = class {
|
|
|
22444
22488
|
}
|
|
22445
22489
|
};
|
|
22446
22490
|
|
|
22491
|
+
var locDataCache;
|
|
22492
|
+
|
|
22493
|
+
function resetLocData() {
|
|
22494
|
+
const data = locDataCache;
|
|
22495
|
+
|
|
22496
|
+
locDataCache = void 0;
|
|
22497
|
+
return data;
|
|
22498
|
+
}
|
|
22499
|
+
|
|
22447
22500
|
var Tokenizer = class extends CommentsParser {
|
|
22448
22501
|
isLookahead;
|
|
22449
22502
|
tokens = [];
|
|
@@ -22455,6 +22508,26 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22455
22508
|
this.length = input.length;
|
|
22456
22509
|
this.comments = [];
|
|
22457
22510
|
this.isLookahead = false;
|
|
22511
|
+
|
|
22512
|
+
if (!locDataCache || locDataCache.length < (this.length + 1) * 2 || options.locations === 'packed') {
|
|
22513
|
+
locDataCache = new Uint32Array((this.length + 1) * 2);
|
|
22514
|
+
}
|
|
22515
|
+
|
|
22516
|
+
this.locData = locDataCache;
|
|
22517
|
+
}
|
|
22518
|
+
|
|
22519
|
+
setLoc(loc) {
|
|
22520
|
+
const dataIndex = this.offsetToSourcePos(loc.index);
|
|
22521
|
+
|
|
22522
|
+
this.locData[dataIndex * 2] = loc.line;
|
|
22523
|
+
this.locData[dataIndex * 2 + 1] = loc.column;
|
|
22524
|
+
}
|
|
22525
|
+
|
|
22526
|
+
getLoc(locIndex) {
|
|
22527
|
+
const dataIndex = this.offsetToSourcePos(locIndex);
|
|
22528
|
+
const loc = new Position(this.locData[dataIndex * 2], this.locData[dataIndex * 2 + 1], locIndex);
|
|
22529
|
+
|
|
22530
|
+
return loc;
|
|
22458
22531
|
}
|
|
22459
22532
|
|
|
22460
22533
|
pushToken(token) {
|
|
@@ -22466,7 +22539,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22466
22539
|
next() {
|
|
22467
22540
|
this.checkKeywordEscapes();
|
|
22468
22541
|
|
|
22469
|
-
if (this.optionFlags &
|
|
22542
|
+
if (this.optionFlags & 512) {
|
|
22470
22543
|
this.pushToken(new Token(this.state));
|
|
22471
22544
|
}
|
|
22472
22545
|
|
|
@@ -22621,7 +22694,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22621
22694
|
loc: new SourceLocation(startLoc, this.state.curPosition()),
|
|
22622
22695
|
};
|
|
22623
22696
|
|
|
22624
|
-
if (this.optionFlags &
|
|
22697
|
+
if (this.optionFlags & 512)
|
|
22625
22698
|
this.pushToken(comment);
|
|
22626
22699
|
|
|
22627
22700
|
return comment;
|
|
@@ -22656,7 +22729,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22656
22729
|
loc: new SourceLocation(startLoc, this.state.curPosition()),
|
|
22657
22730
|
};
|
|
22658
22731
|
|
|
22659
|
-
if (this.optionFlags &
|
|
22732
|
+
if (this.optionFlags & 512)
|
|
22660
22733
|
this.pushToken(comment);
|
|
22661
22734
|
|
|
22662
22735
|
return comment;
|
|
@@ -22664,7 +22737,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22664
22737
|
|
|
22665
22738
|
skipSpace() {
|
|
22666
22739
|
const spaceStart = this.state.pos;
|
|
22667
|
-
const comments = this.optionFlags &
|
|
22740
|
+
const comments = this.optionFlags & 8192 ? [] : null;
|
|
22668
22741
|
|
|
22669
22742
|
loop: while (this.state.pos < this.length) {
|
|
22670
22743
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
@@ -22722,7 +22795,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22722
22795
|
default:
|
|
22723
22796
|
if (isWhitespace(ch)) {
|
|
22724
22797
|
++this.state.pos;
|
|
22725
|
-
} else if (ch === 45 && !this.inModule && this.optionFlags &
|
|
22798
|
+
} else if (ch === 45 && !this.inModule && this.optionFlags & 16384) {
|
|
22726
22799
|
const pos = this.state.pos;
|
|
22727
22800
|
|
|
22728
22801
|
if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
|
|
@@ -22735,7 +22808,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
22735
22808
|
} else {
|
|
22736
22809
|
break loop;
|
|
22737
22810
|
}
|
|
22738
|
-
} else if (ch === 60 && !this.inModule && this.optionFlags &
|
|
22811
|
+
} else if (ch === 60 && !this.inModule && this.optionFlags & 16384) {
|
|
22739
22812
|
const pos = this.state.pos;
|
|
22740
22813
|
|
|
22741
22814
|
if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) {
|
|
@@ -23540,10 +23613,11 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23540
23613
|
}
|
|
23541
23614
|
|
|
23542
23615
|
raise(toParseError, at, details = {}) {
|
|
23543
|
-
const loc = at instanceof Position ? at : at.loc.start;
|
|
23544
|
-
const
|
|
23616
|
+
const loc = at instanceof Position ? at : typeof at === 'number' ? this.getLoc(at) : this.optionFlags & 256 ? at.loc.start : this.getLoc(at.start);
|
|
23617
|
+
const pos = at instanceof Position ? loc.index : typeof at === 'number' ? at : at.start;
|
|
23618
|
+
const error = toParseError(loc, pos, details);
|
|
23545
23619
|
|
|
23546
|
-
if (!(this.optionFlags &
|
|
23620
|
+
if (!(this.optionFlags & 4096))
|
|
23547
23621
|
throw error;
|
|
23548
23622
|
|
|
23549
23623
|
if (!this.isLookahead)
|
|
@@ -23553,22 +23627,22 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23553
23627
|
}
|
|
23554
23628
|
|
|
23555
23629
|
raiseOverwrite(toParseError, at, details = {}) {
|
|
23556
|
-
const loc = at instanceof Position ? at : at.loc.start;
|
|
23557
|
-
const pos = loc.index;
|
|
23630
|
+
const loc = at instanceof Position ? at : this.optionFlags & 256 ? at.loc.start : this.getLoc(at.start);
|
|
23631
|
+
const pos = at instanceof Position ? loc.index : at.start;
|
|
23558
23632
|
const errors = this.state.errors;
|
|
23559
23633
|
|
|
23560
23634
|
for (let i = errors.length - 1; i >= 0; i--) {
|
|
23561
23635
|
const error = errors[i];
|
|
23562
23636
|
|
|
23563
|
-
if (error.
|
|
23564
|
-
return errors[i] = toParseError(loc, details);
|
|
23637
|
+
if (error.pos === pos) {
|
|
23638
|
+
return errors[i] = toParseError(loc, pos, details);
|
|
23565
23639
|
}
|
|
23566
23640
|
|
|
23567
|
-
if (error.
|
|
23641
|
+
if (error.pos < pos)
|
|
23568
23642
|
break;
|
|
23569
23643
|
}
|
|
23570
23644
|
|
|
23571
|
-
return this.raise(toParseError,
|
|
23645
|
+
return this.raise(toParseError, loc, details);
|
|
23572
23646
|
}
|
|
23573
23647
|
|
|
23574
23648
|
updateContext() {}
|
|
@@ -23605,7 +23679,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23605
23679
|
|
|
23606
23680
|
errorHandlers_readInt = {
|
|
23607
23681
|
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
23608
|
-
if (!(this.optionFlags &
|
|
23682
|
+
if (!(this.optionFlags & 4096))
|
|
23609
23683
|
return false;
|
|
23610
23684
|
|
|
23611
23685
|
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
|
|
@@ -23648,7 +23722,6 @@ var ClassScope = class {
|
|
|
23648
23722
|
var ClassScopeHandler = class {
|
|
23649
23723
|
parser;
|
|
23650
23724
|
stack = [];
|
|
23651
|
-
undefinedPrivateNames = /* @__PURE__ */new Map();
|
|
23652
23725
|
constructor(parser) {
|
|
23653
23726
|
this.parser = parser;
|
|
23654
23727
|
}
|
|
@@ -23753,9 +23826,8 @@ var ArrowHeadParsingScope = class extends ExpressionScope {
|
|
|
23753
23826
|
super(type);
|
|
23754
23827
|
}
|
|
23755
23828
|
|
|
23756
|
-
recordDeclarationError(ParsingErrorClass,
|
|
23757
|
-
|
|
23758
|
-
this.declarationErrors.set(index3, [ParsingErrorClass, at]);
|
|
23829
|
+
recordDeclarationError(ParsingErrorClass, index3) {
|
|
23830
|
+
this.declarationErrors.set(index3, ParsingErrorClass);
|
|
23759
23831
|
}
|
|
23760
23832
|
|
|
23761
23833
|
clearDeclarationError(index3) {
|
|
@@ -23784,8 +23856,7 @@ var ExpressionScopeHandler = class {
|
|
|
23784
23856
|
this.stack.pop();
|
|
23785
23857
|
}
|
|
23786
23858
|
|
|
23787
|
-
recordParameterInitializerError(toParseError,
|
|
23788
|
-
const origin = node.loc.start;
|
|
23859
|
+
recordParameterInitializerError(toParseError, loc) {
|
|
23789
23860
|
const {stack} = this;
|
|
23790
23861
|
|
|
23791
23862
|
let i = stack.length - 1;
|
|
@@ -23793,7 +23864,7 @@ var ExpressionScopeHandler = class {
|
|
|
23793
23864
|
|
|
23794
23865
|
while (!scope2.isCertainlyParameterDeclaration()) {
|
|
23795
23866
|
if (scope2.canBeArrowParameterDeclaration()) {
|
|
23796
|
-
scope2.recordDeclarationError(toParseError,
|
|
23867
|
+
scope2.recordDeclarationError(toParseError, loc);
|
|
23797
23868
|
} else {
|
|
23798
23869
|
return;
|
|
23799
23870
|
}
|
|
@@ -23801,14 +23872,14 @@ var ExpressionScopeHandler = class {
|
|
|
23801
23872
|
scope2 = stack[--i];
|
|
23802
23873
|
}
|
|
23803
23874
|
|
|
23804
|
-
this.parser.raise(toParseError,
|
|
23875
|
+
this.parser.raise(toParseError, loc);
|
|
23805
23876
|
}
|
|
23806
23877
|
|
|
23807
23878
|
recordArrowParameterBindingError(error, node) {
|
|
23808
23879
|
const {stack} = this;
|
|
23809
23880
|
|
|
23810
23881
|
const scope2 = stack[stack.length - 1];
|
|
23811
|
-
const origin = node.
|
|
23882
|
+
const origin = node.start;
|
|
23812
23883
|
|
|
23813
23884
|
if (scope2.isCertainlyParameterDeclaration()) {
|
|
23814
23885
|
this.parser.raise(error, origin);
|
|
@@ -23842,13 +23913,13 @@ var ExpressionScopeHandler = class {
|
|
|
23842
23913
|
if (!currentScope.canBeArrowParameterDeclaration())
|
|
23843
23914
|
return;
|
|
23844
23915
|
|
|
23845
|
-
currentScope.iterateErrors((
|
|
23846
|
-
this.parser.raise(toParseError,
|
|
23916
|
+
currentScope.iterateErrors((toParseError, key) => {
|
|
23917
|
+
this.parser.raise(toParseError, key);
|
|
23847
23918
|
let i = stack.length - 2;
|
|
23848
23919
|
let scope2 = stack[i];
|
|
23849
23920
|
|
|
23850
23921
|
while (scope2.canBeArrowParameterDeclaration()) {
|
|
23851
|
-
scope2.clearDeclarationError(
|
|
23922
|
+
scope2.clearDeclarationError(key);
|
|
23852
23923
|
scope2 = stack[--i];
|
|
23853
23924
|
}
|
|
23854
23925
|
});
|
|
@@ -24170,17 +24241,18 @@ var ExpressionErrors = class {
|
|
|
24170
24241
|
};
|
|
24171
24242
|
|
|
24172
24243
|
var Node = class {
|
|
24173
|
-
constructor(
|
|
24244
|
+
constructor(optionFlags, filename, pos, loc) {
|
|
24174
24245
|
this.start = pos;
|
|
24175
24246
|
this.end = 0;
|
|
24176
|
-
this.loc = new SourceLocation(loc);
|
|
24177
24247
|
|
|
24178
|
-
if (
|
|
24179
|
-
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24248
|
+
if (loc !== void 0)
|
|
24249
|
+
this.loc = new SourceLocation(loc);
|
|
24250
|
+
|
|
24251
|
+
if (optionFlags & 128)
|
|
24252
|
+
this.range = [pos, 0];
|
|
24253
|
+
|
|
24254
|
+
if (loc !== void 0 && filename) {
|
|
24255
|
+
this.loc.filename = filename;
|
|
24184
24256
|
}
|
|
24185
24257
|
}
|
|
24186
24258
|
|
|
@@ -24190,17 +24262,35 @@ var Node = class {
|
|
|
24190
24262
|
var NodePrototype = Node.prototype;
|
|
24191
24263
|
|
|
24192
24264
|
var NodeUtils = class extends UtilParser {
|
|
24265
|
+
createPosition(loc) {
|
|
24266
|
+
return loc;
|
|
24267
|
+
}
|
|
24268
|
+
|
|
24193
24269
|
startNode() {
|
|
24194
|
-
const
|
|
24195
|
-
|
|
24270
|
+
const {startLoc} = this.state;
|
|
24271
|
+
|
|
24272
|
+
this.setLoc(startLoc);
|
|
24273
|
+
return this.startNodeAt(startLoc);
|
|
24196
24274
|
}
|
|
24197
24275
|
|
|
24198
24276
|
startNodeAt(loc) {
|
|
24199
|
-
|
|
24277
|
+
const {optionFlags, filename} = this;
|
|
24278
|
+
|
|
24279
|
+
if (!(optionFlags & 256)) {
|
|
24280
|
+
return new Node(optionFlags, filename, loc.index);
|
|
24281
|
+
}
|
|
24282
|
+
|
|
24283
|
+
return new Node(optionFlags, filename, loc.index, this.createPosition(loc));
|
|
24200
24284
|
}
|
|
24201
24285
|
|
|
24202
24286
|
startNodeAtNode(type) {
|
|
24203
|
-
|
|
24287
|
+
const {optionFlags, filename} = this;
|
|
24288
|
+
|
|
24289
|
+
if (!(optionFlags & 256)) {
|
|
24290
|
+
return new Node(optionFlags, filename, type.start);
|
|
24291
|
+
}
|
|
24292
|
+
|
|
24293
|
+
return new Node(optionFlags, filename, type.start, type.loc.start);
|
|
24204
24294
|
}
|
|
24205
24295
|
|
|
24206
24296
|
finishNode(node, type) {
|
|
@@ -24210,36 +24300,89 @@ var NodeUtils = class extends UtilParser {
|
|
|
24210
24300
|
finishNodeAt(node, type, endLoc) {
|
|
24211
24301
|
node.type = type;
|
|
24212
24302
|
node.end = endLoc.index;
|
|
24213
|
-
|
|
24303
|
+
const {optionFlags} = this;
|
|
24214
24304
|
|
|
24215
|
-
if (
|
|
24305
|
+
if (optionFlags & 256) {
|
|
24306
|
+
node.loc.end = this.createPosition(endLoc);
|
|
24307
|
+
}
|
|
24308
|
+
|
|
24309
|
+
if (optionFlags & 128)
|
|
24216
24310
|
node.range[1] = endLoc.index;
|
|
24217
24311
|
|
|
24218
|
-
if (
|
|
24312
|
+
if (optionFlags & 8192)
|
|
24219
24313
|
this.processComment(node);
|
|
24314
|
+
|
|
24315
|
+
return node;
|
|
24316
|
+
}
|
|
24317
|
+
|
|
24318
|
+
finishNodeAtNode(node, type, endNode) {
|
|
24319
|
+
if (process.env.NODE_ENV !== 'production' && node.end > 0) {
|
|
24320
|
+
throw new Error('Do not call finishNode*() twice on the same node. Instead use resetEndLocation() or change type directly.');
|
|
24321
|
+
}
|
|
24322
|
+
|
|
24323
|
+
node.type = type;
|
|
24324
|
+
node.end = endNode.end;
|
|
24325
|
+
const {optionFlags} = this;
|
|
24326
|
+
|
|
24327
|
+
if (optionFlags & 256) {
|
|
24328
|
+
node.loc.end = endNode.loc.end;
|
|
24220
24329
|
}
|
|
24221
24330
|
|
|
24331
|
+
if (optionFlags & 128)
|
|
24332
|
+
node.range[1] = node.end;
|
|
24333
|
+
|
|
24334
|
+
if (optionFlags & 8192)
|
|
24335
|
+
this.processComment(node);
|
|
24336
|
+
|
|
24222
24337
|
return node;
|
|
24223
24338
|
}
|
|
24224
24339
|
|
|
24225
24340
|
resetStartLocation(node, startLoc) {
|
|
24226
24341
|
node.start = startLoc.index;
|
|
24227
|
-
|
|
24342
|
+
const {optionFlags} = this;
|
|
24228
24343
|
|
|
24229
|
-
if (
|
|
24344
|
+
if (optionFlags & 256) {
|
|
24345
|
+
node.loc.start = this.createPosition(startLoc);
|
|
24346
|
+
}
|
|
24347
|
+
|
|
24348
|
+
if (optionFlags & 128)
|
|
24230
24349
|
node.range[0] = startLoc.index;
|
|
24231
24350
|
}
|
|
24232
24351
|
|
|
24233
24352
|
resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
|
|
24234
24353
|
node.end = endLoc.index;
|
|
24235
|
-
|
|
24354
|
+
const {optionFlags} = this;
|
|
24355
|
+
|
|
24356
|
+
if (optionFlags & 256) {
|
|
24357
|
+
node.loc.end = this.createPosition(endLoc);
|
|
24358
|
+
}
|
|
24236
24359
|
|
|
24237
|
-
if (
|
|
24360
|
+
if (optionFlags & 128)
|
|
24238
24361
|
node.range[1] = endLoc.index;
|
|
24239
24362
|
}
|
|
24240
24363
|
|
|
24241
24364
|
resetStartLocationFromNode(node, locationNode) {
|
|
24242
|
-
|
|
24365
|
+
node.start = locationNode.start;
|
|
24366
|
+
const {optionFlags} = this;
|
|
24367
|
+
|
|
24368
|
+
if (optionFlags & 256) {
|
|
24369
|
+
node.loc.start = locationNode.loc.start;
|
|
24370
|
+
}
|
|
24371
|
+
|
|
24372
|
+
if (optionFlags & 128)
|
|
24373
|
+
node.range[0] = locationNode.start;
|
|
24374
|
+
}
|
|
24375
|
+
|
|
24376
|
+
resetEndLocationFromNode(node, locationNode) {
|
|
24377
|
+
node.end = locationNode.end;
|
|
24378
|
+
const {optionFlags} = this;
|
|
24379
|
+
|
|
24380
|
+
if (optionFlags & 256) {
|
|
24381
|
+
node.loc.end = locationNode.loc.end;
|
|
24382
|
+
}
|
|
24383
|
+
|
|
24384
|
+
if (optionFlags & 128)
|
|
24385
|
+
node.range[1] = locationNode.end;
|
|
24243
24386
|
}
|
|
24244
24387
|
|
|
24245
24388
|
castNodeTo(node, type) {
|
|
@@ -24344,7 +24487,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24344
24487
|
const {key, value} = node;
|
|
24345
24488
|
|
|
24346
24489
|
if (this.isPrivateName(key)) {
|
|
24347
|
-
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.
|
|
24490
|
+
this.classScope.usePrivateName(this.getPrivateNameSV(key), key.start);
|
|
24348
24491
|
}
|
|
24349
24492
|
|
|
24350
24493
|
this.toAssignable(value, isLHS);
|
|
@@ -24361,7 +24504,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24361
24504
|
|
|
24362
24505
|
case 'AssignmentExpression':
|
|
24363
24506
|
if (node.operator !== '=') {
|
|
24364
|
-
this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
|
|
24507
|
+
this.raise(Errors.MissingEqInAssignment, this.optionFlags & 256 ? node.left.loc.end : node.left);
|
|
24365
24508
|
}
|
|
24366
24509
|
|
|
24367
24510
|
this.castNodeTo(node, 'AssignmentPattern');
|
|
@@ -24605,6 +24748,8 @@ var LValParser = class extends NodeUtils {
|
|
|
24605
24748
|
}
|
|
24606
24749
|
|
|
24607
24750
|
parseBindingElement(flags, decorators) {
|
|
24751
|
+
const {startLoc} = this.state;
|
|
24752
|
+
|
|
24608
24753
|
const left = this.parseMaybeDefault();
|
|
24609
24754
|
|
|
24610
24755
|
if (flags & 2) {
|
|
@@ -24616,7 +24761,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24616
24761
|
this.resetStartLocationFromNode(left, decorators[0]);
|
|
24617
24762
|
}
|
|
24618
24763
|
|
|
24619
|
-
const elt = this.parseMaybeDefault(
|
|
24764
|
+
const elt = this.parseMaybeDefault(startLoc, left);
|
|
24620
24765
|
|
|
24621
24766
|
return elt;
|
|
24622
24767
|
}
|
|
@@ -24667,7 +24812,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24667
24812
|
return true;
|
|
24668
24813
|
|
|
24669
24814
|
case 'CallExpression':
|
|
24670
|
-
if (!disallowCallExpression && !this.state.strict && this.optionFlags &
|
|
24815
|
+
if (!disallowCallExpression && !this.state.strict && this.optionFlags & 16384) {
|
|
24671
24816
|
return true;
|
|
24672
24817
|
}
|
|
24673
24818
|
}
|
|
@@ -24689,7 +24834,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24689
24834
|
|
|
24690
24835
|
if (isOptionalMemberExpression3 || type === 'MemberExpression') {
|
|
24691
24836
|
if (isOptionalMemberExpression3) {
|
|
24692
|
-
this.expectPlugin('optionalChainingAssign', expression2.
|
|
24837
|
+
this.expectPlugin('optionalChainingAssign', expression2.start);
|
|
24693
24838
|
|
|
24694
24839
|
if (ancestor.type !== 'AssignmentExpression') {
|
|
24695
24840
|
this.raise(Errors.InvalidLhsOptionalChaining, expression2, {
|
|
@@ -24788,7 +24933,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24788
24933
|
}
|
|
24789
24934
|
|
|
24790
24935
|
declareNameFromIdentifier(identifier4, binding) {
|
|
24791
|
-
this.scope.declareName(identifier4.name, binding, identifier4.
|
|
24936
|
+
this.scope.declareName(identifier4.name, binding, identifier4.start);
|
|
24792
24937
|
}
|
|
24793
24938
|
|
|
24794
24939
|
checkToRestConversion(node, allowPattern) {
|
|
@@ -25923,7 +26068,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
25923
26068
|
return this.tsParseTupleType();
|
|
25924
26069
|
|
|
25925
26070
|
case 6:
|
|
25926
|
-
if (!(this.optionFlags &
|
|
26071
|
+
if (!(this.optionFlags & 2048)) {
|
|
25927
26072
|
const startLoc = this.state.startLoc;
|
|
25928
26073
|
this.next();
|
|
25929
26074
|
const type = this.tsParseType();
|
|
@@ -26290,7 +26435,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
26290
26435
|
const expression2 = (this.state.canStartArrow = false, super.parseExprSubscripts());
|
|
26291
26436
|
|
|
26292
26437
|
if (!tsIsEntityName(expression2)) {
|
|
26293
|
-
this.raise(TSErrors.InvalidHeritageClauseType, expression2.
|
|
26438
|
+
this.raise(TSErrors.InvalidHeritageClauseType, expression2.start, {
|
|
26294
26439
|
token,
|
|
26295
26440
|
});
|
|
26296
26441
|
}
|
|
@@ -26773,7 +26918,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
26773
26918
|
}
|
|
26774
26919
|
|
|
26775
26920
|
parseBindingElement(flags, decorators) {
|
|
26776
|
-
const startLoc = decorators.length ?
|
|
26921
|
+
const startLoc = decorators.length ? null : this.state.startLoc;
|
|
26777
26922
|
const modified = {};
|
|
26778
26923
|
|
|
26779
26924
|
this.tsParseModifiers({
|
|
@@ -26790,19 +26935,20 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
26790
26935
|
const readonly = modified.readonly;
|
|
26791
26936
|
|
|
26792
26937
|
if (!(flags & 4) && (accessibility || readonly || override)) {
|
|
26793
|
-
this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
|
|
26938
|
+
this.raise(TSErrors.UnexpectedParameterModifier, startLoc || decorators[0]);
|
|
26794
26939
|
}
|
|
26795
26940
|
|
|
26796
|
-
const
|
|
26941
|
+
const startLoc2 = this.state.startLoc;
|
|
26942
|
+
const left = this.parseMaybeDefault(startLoc2);
|
|
26797
26943
|
|
|
26798
26944
|
if (flags & 2) {
|
|
26799
26945
|
this.parseFunctionParamType(left);
|
|
26800
26946
|
}
|
|
26801
26947
|
|
|
26802
|
-
const elt = this.parseMaybeDefault(
|
|
26948
|
+
const elt = this.parseMaybeDefault(startLoc2, left);
|
|
26803
26949
|
|
|
26804
26950
|
if (accessibility || readonly || override) {
|
|
26805
|
-
const pp = this.startNodeAt(startLoc);
|
|
26951
|
+
const pp = startLoc ? this.startNodeAt(startLoc) : this.startNodeAtNode(decorators[0]);
|
|
26806
26952
|
|
|
26807
26953
|
if (decorators.length) {
|
|
26808
26954
|
pp.decorators = decorators;
|
|
@@ -26818,7 +26964,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
26818
26964
|
pp.override = override;
|
|
26819
26965
|
|
|
26820
26966
|
if (elt.type !== 'Identifier' && elt.type !== 'AssignmentPattern') {
|
|
26821
|
-
this.raise(TSErrors.UnsupportedParameterPropertyKind,
|
|
26967
|
+
this.raise(TSErrors.UnsupportedParameterPropertyKind, startLoc || decorators[0]);
|
|
26822
26968
|
}
|
|
26823
26969
|
|
|
26824
26970
|
pp.parameter = elt;
|
|
@@ -27222,7 +27368,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
27222
27368
|
|
|
27223
27369
|
return declaration;
|
|
27224
27370
|
} else {
|
|
27225
|
-
node.expression = this.createIdentifier(this.
|
|
27371
|
+
node.expression = this.createIdentifier(this.startNodeAtNode(node), token === 121 ? 'declare' : 'abstract');
|
|
27226
27372
|
this.semicolon(false);
|
|
27227
27373
|
return this.finishNode(node, 'ExpressionStatement');
|
|
27228
27374
|
}
|
|
@@ -27708,7 +27854,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
27708
27854
|
const parameter = expr.typeParameters.params[0];
|
|
27709
27855
|
|
|
27710
27856
|
if (!parameter.constraint) {
|
|
27711
|
-
this.raise(TSErrors.SingleTypeParameterWithoutTrailingComma, createPositionWithColumnOffset(parameter.loc.end, 1), {
|
|
27857
|
+
this.raise(TSErrors.SingleTypeParameterWithoutTrailingComma, this.optionFlags & 256 ? createPositionWithColumnOffset(parameter.loc.end, 1) : parameter, {
|
|
27712
27858
|
typeParameterName: parameter.name.name,
|
|
27713
27859
|
});
|
|
27714
27860
|
}
|
|
@@ -28006,7 +28152,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
28006
28152
|
|
|
28007
28153
|
typeCastToParameter(node) {
|
|
28008
28154
|
node.expression.typeAnnotation = node.typeAnnotation;
|
|
28009
|
-
this.
|
|
28155
|
+
this.resetEndLocationFromNode(node.expression, node.typeAnnotation);
|
|
28010
28156
|
return node.expression;
|
|
28011
28157
|
}
|
|
28012
28158
|
|
|
@@ -28190,7 +28336,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
28190
28336
|
let rightOfAs;
|
|
28191
28337
|
let hasTypeSpecifier = false;
|
|
28192
28338
|
let canParseAsKeyword = true;
|
|
28193
|
-
const loc = leftOfAs.
|
|
28339
|
+
const loc = leftOfAs.start;
|
|
28194
28340
|
|
|
28195
28341
|
if (this.isContextual(89)) {
|
|
28196
28342
|
const firstAs = this.parseIdentifier();
|
|
@@ -28221,7 +28367,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
28221
28367
|
leftOfAs = this.parseIdentifier(true);
|
|
28222
28368
|
|
|
28223
28369
|
if (!this.isContextual(89)) {
|
|
28224
|
-
this.checkReservedWord(leftOfAs.name, leftOfAs.
|
|
28370
|
+
this.checkReservedWord(leftOfAs.name, leftOfAs.start, true, true);
|
|
28225
28371
|
}
|
|
28226
28372
|
} else {
|
|
28227
28373
|
leftOfAs = this.parseModuleExportName();
|
|
@@ -28906,7 +29052,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
28906
29052
|
if (sawProto) {
|
|
28907
29053
|
if (refExpressionErrors) {
|
|
28908
29054
|
if (refExpressionErrors.doubleProtoLoc === null) {
|
|
28909
|
-
refExpressionErrors.doubleProtoLoc = key.
|
|
29055
|
+
refExpressionErrors.doubleProtoLoc = this.getLoc(key.start);
|
|
28910
29056
|
}
|
|
28911
29057
|
} else {
|
|
28912
29058
|
this.raise(Errors.DuplicateProto, key);
|
|
@@ -28943,10 +29089,14 @@ var ExpressionParser = class extends LValParser {
|
|
|
28943
29089
|
expr.comments = this.comments;
|
|
28944
29090
|
expr.errors = this.state.errors;
|
|
28945
29091
|
|
|
28946
|
-
if (this.optionFlags &
|
|
29092
|
+
if (this.optionFlags & 512) {
|
|
28947
29093
|
expr.tokens = createExportedTokens(this.tokens);
|
|
28948
29094
|
}
|
|
28949
29095
|
|
|
29096
|
+
if (this.options.locations === 'packed') {
|
|
29097
|
+
expr.locData = resetLocData();
|
|
29098
|
+
}
|
|
29099
|
+
|
|
28950
29100
|
return expr;
|
|
28951
29101
|
}
|
|
28952
29102
|
|
|
@@ -29121,12 +29271,12 @@ var ExpressionParser = class extends LValParser {
|
|
|
29121
29271
|
const value = this.getPrivateNameSV(left);
|
|
29122
29272
|
|
|
29123
29273
|
if (minPrec >= tokenOperatorPrecedence(54) || !this.prodParam.hasIn || !this.match(54)) {
|
|
29124
|
-
this.raise(Errors.PrivateInExpectedIn,
|
|
29274
|
+
this.raise(Errors.PrivateInExpectedIn, leftStartLoc, {
|
|
29125
29275
|
identifierName: value,
|
|
29126
29276
|
});
|
|
29127
29277
|
}
|
|
29128
29278
|
|
|
29129
|
-
this.classScope.usePrivateName(value,
|
|
29279
|
+
this.classScope.usePrivateName(value, leftStartLoc);
|
|
29130
29280
|
}
|
|
29131
29281
|
|
|
29132
29282
|
const op = this.state.type;
|
|
@@ -29312,6 +29462,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
29312
29462
|
|
|
29313
29463
|
parseExprSubscripts(refExpressionErrors) {
|
|
29314
29464
|
const startLoc = this.state.startLoc;
|
|
29465
|
+
this.setLoc(startLoc);
|
|
29315
29466
|
const expr = this.parseExprAtom(refExpressionErrors);
|
|
29316
29467
|
|
|
29317
29468
|
if (this.shouldExitDescending(expr)) {
|
|
@@ -29575,7 +29726,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
29575
29726
|
}
|
|
29576
29727
|
|
|
29577
29728
|
if (this.match(6)) {
|
|
29578
|
-
if (this.optionFlags &
|
|
29729
|
+
if (this.optionFlags & 1024) {
|
|
29579
29730
|
return this.parseImportCall(node);
|
|
29580
29731
|
} else {
|
|
29581
29732
|
return this.finishNode(node, 'Import');
|
|
@@ -30055,7 +30206,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
30055
30206
|
}
|
|
30056
30207
|
|
|
30057
30208
|
wrapParenthesis(startLoc, expression2) {
|
|
30058
|
-
if (!(this.optionFlags &
|
|
30209
|
+
if (!(this.optionFlags & 2048)) {
|
|
30059
30210
|
this.addExtra(expression2, 'parenthesized', true);
|
|
30060
30211
|
this.addExtra(expression2, 'parenStart', startLoc.index);
|
|
30061
30212
|
this.takeSurroundingComments(expression2, startLoc.index, this.state.lastTokEndLoc.index);
|
|
@@ -30350,7 +30501,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
30350
30501
|
}
|
|
30351
30502
|
|
|
30352
30503
|
if (!prop.computed && prop.key.type === 'Identifier') {
|
|
30353
|
-
this.checkReservedWord(prop.key.name, prop.key.
|
|
30504
|
+
this.checkReservedWord(prop.key.name, prop.key.start, true, false);
|
|
30354
30505
|
|
|
30355
30506
|
if (isPattern3) {
|
|
30356
30507
|
prop.value = this.parseMaybeDefault(startLoc, this.cloneIdentifier(prop.key));
|
|
@@ -30515,7 +30666,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
30515
30666
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
30516
30667
|
|
|
30517
30668
|
if (hasStrictModeDirective && nonSimple) {
|
|
30518
|
-
this.raise(Errors.IllegalLanguageModeDirective, (node.kind === 'method' || node.kind === 'constructor') && !!node.key ? node.key.loc.end : node);
|
|
30669
|
+
this.raise(Errors.IllegalLanguageModeDirective, (node.kind === 'method' || node.kind === 'constructor') && !!node.key ? this.optionFlags & 256 ? node.key.loc.end : node.key : node);
|
|
30519
30670
|
}
|
|
30520
30671
|
|
|
30521
30672
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
@@ -30626,19 +30777,27 @@ var ExpressionParser = class extends LValParser {
|
|
|
30626
30777
|
|
|
30627
30778
|
createIdentifier(node, name) {
|
|
30628
30779
|
node.name = name;
|
|
30629
|
-
|
|
30780
|
+
|
|
30781
|
+
if (this.optionFlags & 256) {
|
|
30782
|
+
node.loc.identifierName = name;
|
|
30783
|
+
}
|
|
30784
|
+
|
|
30630
30785
|
return this.finishNode(node, 'Identifier');
|
|
30631
30786
|
}
|
|
30632
30787
|
|
|
30633
30788
|
createIdentifierAt(node, name, endLoc) {
|
|
30634
30789
|
node.name = name;
|
|
30635
|
-
|
|
30790
|
+
|
|
30791
|
+
if (this.optionFlags & 256) {
|
|
30792
|
+
node.loc.identifierName = name;
|
|
30793
|
+
}
|
|
30794
|
+
|
|
30636
30795
|
return this.finishNodeAt(node, 'Identifier', endLoc);
|
|
30637
30796
|
}
|
|
30638
30797
|
|
|
30639
30798
|
parseIdentifierName(liberal) {
|
|
30640
30799
|
let name;
|
|
30641
|
-
const {
|
|
30800
|
+
const {start, type} = this.state;
|
|
30642
30801
|
|
|
30643
30802
|
if (tokenIsKeywordOrIdentifier(type)) {
|
|
30644
30803
|
name = this.state.value;
|
|
@@ -30653,7 +30812,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
30653
30812
|
this.replaceToken(128);
|
|
30654
30813
|
}
|
|
30655
30814
|
} else {
|
|
30656
|
-
this.checkReservedWord(name,
|
|
30815
|
+
this.checkReservedWord(name, this.sourceToOffsetPos(start), tokenIsKeyword2, false);
|
|
30657
30816
|
}
|
|
30658
30817
|
|
|
30659
30818
|
this.next();
|
|
@@ -30721,11 +30880,13 @@ var ExpressionParser = class extends LValParser {
|
|
|
30721
30880
|
}
|
|
30722
30881
|
|
|
30723
30882
|
parseAwait(startLoc, soloAwait) {
|
|
30883
|
+
const startIndex = startLoc.index;
|
|
30884
|
+
this.setLoc(startLoc);
|
|
30724
30885
|
const node = this.startNodeAt(startLoc);
|
|
30725
|
-
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter,
|
|
30886
|
+
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, startIndex);
|
|
30726
30887
|
|
|
30727
30888
|
if (this.eat(51)) {
|
|
30728
|
-
this.raise(Errors.ObsoleteAwaitStar,
|
|
30889
|
+
this.raise(Errors.ObsoleteAwaitStar, startLoc);
|
|
30729
30890
|
}
|
|
30730
30891
|
|
|
30731
30892
|
if (!this.scope.inFunction && !(this.optionFlags & 1)) {
|
|
@@ -30761,8 +30922,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
30761
30922
|
}
|
|
30762
30923
|
|
|
30763
30924
|
parseYield(startLoc) {
|
|
30925
|
+
this.setLoc(startLoc);
|
|
30764
30926
|
const node = this.startNodeAt(startLoc);
|
|
30765
|
-
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter,
|
|
30927
|
+
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, startLoc.index);
|
|
30766
30928
|
let delegating = false;
|
|
30767
30929
|
let argument = null;
|
|
30768
30930
|
|
|
@@ -30855,7 +31017,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
30855
31017
|
const prodParamToSet = 16 & ~flags;
|
|
30856
31018
|
|
|
30857
31019
|
if (prodParamToClear || prodParamToSet) {
|
|
30858
|
-
this.prodParam.enter(flags &
|
|
31020
|
+
this.prodParam.enter(flags & -9 | 16);
|
|
30859
31021
|
try {
|
|
30860
31022
|
return callback();
|
|
30861
31023
|
} finally {
|
|
@@ -30880,7 +31042,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
30880
31042
|
|
|
30881
31043
|
parseFSharpPipelineBody(prec) {
|
|
30882
31044
|
const startLoc = this.state.startLoc;
|
|
30883
|
-
this.prodParam.enter(this.prodParam.currentFlags() &
|
|
31045
|
+
this.prodParam.enter(this.prodParam.currentFlags() & -17);
|
|
30884
31046
|
let ret;
|
|
30885
31047
|
|
|
30886
31048
|
if (this.isContextual(92) && this.recordAwaitIfAllowed()) {
|
|
@@ -30978,7 +31140,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
30978
31140
|
file2.program = this.parseProgram(program3, 135, this.options.sourceType === 'module' ? 'module' : 'script');
|
|
30979
31141
|
file2.comments = this.comments;
|
|
30980
31142
|
|
|
30981
|
-
if (this.optionFlags &
|
|
31143
|
+
if (this.optionFlags & 512) {
|
|
30982
31144
|
file2.tokens = createExportedTokens(this.tokens);
|
|
30983
31145
|
}
|
|
30984
31146
|
|
|
@@ -31978,11 +32140,11 @@ var StatementParser = class extends ExpressionParser {
|
|
|
31978
32140
|
|
|
31979
32141
|
if (kind === 'using' || kind === 'await using') {
|
|
31980
32142
|
if (id.type === 'ArrayPattern' || id.type === 'ObjectPattern') {
|
|
31981
|
-
this.raise(Errors.UsingDeclarationHasBindingPattern, id
|
|
32143
|
+
this.raise(Errors.UsingDeclarationHasBindingPattern, id);
|
|
31982
32144
|
}
|
|
31983
32145
|
} else {
|
|
31984
32146
|
if (id.type === 'VoidPattern') {
|
|
31985
|
-
this.raise(Errors.UnexpectedVoidPattern, id
|
|
32147
|
+
this.raise(Errors.UnexpectedVoidPattern, id);
|
|
31986
32148
|
}
|
|
31987
32149
|
}
|
|
31988
32150
|
|
|
@@ -32051,7 +32213,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32051
32213
|
if (!node.id)
|
|
32052
32214
|
return;
|
|
32053
32215
|
|
|
32054
|
-
this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, node.id.
|
|
32216
|
+
this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, node.id.start);
|
|
32055
32217
|
}
|
|
32056
32218
|
|
|
32057
32219
|
parseClass(node, isStatement5, optionalId) {
|
|
@@ -32366,7 +32528,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32366
32528
|
pushClassPrivateProperty(classBody2, prop) {
|
|
32367
32529
|
const node = this.parseClassPrivateProperty(prop);
|
|
32368
32530
|
classBody2.body.push(node);
|
|
32369
|
-
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.
|
|
32531
|
+
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.start);
|
|
32370
32532
|
}
|
|
32371
32533
|
|
|
32372
32534
|
pushClassAccessorProperty(classBody2, prop, isPrivate2) {
|
|
@@ -32378,7 +32540,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32378
32540
|
classBody2.body.push(node);
|
|
32379
32541
|
|
|
32380
32542
|
if (isPrivate2) {
|
|
32381
|
-
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.
|
|
32543
|
+
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.start);
|
|
32382
32544
|
}
|
|
32383
32545
|
}
|
|
32384
32546
|
|
|
@@ -32402,7 +32564,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32402
32564
|
}
|
|
32403
32565
|
|
|
32404
32566
|
declareClassPrivateMethodInScope(node, kind) {
|
|
32405
|
-
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.
|
|
32567
|
+
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.start);
|
|
32406
32568
|
}
|
|
32407
32569
|
|
|
32408
32570
|
parsePostMemberNameModifiers() {}
|
|
@@ -32546,7 +32708,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32546
32708
|
|
|
32547
32709
|
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
32548
32710
|
if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) {
|
|
32549
|
-
this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier?.
|
|
32711
|
+
this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier?.start);
|
|
32550
32712
|
const id = maybeDefaultIdentifier || this.parseIdentifier(true);
|
|
32551
32713
|
const specifier = this.startNodeAtNode(id);
|
|
32552
32714
|
|
|
@@ -32755,7 +32917,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32755
32917
|
exportName,
|
|
32756
32918
|
});
|
|
32757
32919
|
} else {
|
|
32758
|
-
this.checkReservedWord(local.name, local.
|
|
32920
|
+
this.checkReservedWord(local.name, local.start, true, false);
|
|
32759
32921
|
this.scope.checkLocalExport(local);
|
|
32760
32922
|
}
|
|
32761
32923
|
}
|
|
@@ -32886,11 +33048,11 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32886
33048
|
|
|
32887
33049
|
if (node.phase === 'source') {
|
|
32888
33050
|
if (singleBindingType !== 'ImportDefaultSpecifier') {
|
|
32889
|
-
this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0]
|
|
33051
|
+
this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0]);
|
|
32890
33052
|
}
|
|
32891
33053
|
} else if (node.phase === 'defer') {
|
|
32892
33054
|
if (singleBindingType !== 'ImportNamespaceSpecifier') {
|
|
32893
|
-
this.raise(Errors.DeferImportRequiresNamespace, specifiers[0]
|
|
33055
|
+
this.raise(Errors.DeferImportRequiresNamespace, specifiers[0]);
|
|
32894
33056
|
}
|
|
32895
33057
|
}
|
|
32896
33058
|
}
|
|
@@ -32933,7 +33095,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
32933
33095
|
const isImportPhase = tokenIsKeywordOrIdentifier(type) ? type !== 94 || this.lookaheadCharCode() === 102 : type !== 8;
|
|
32934
33096
|
|
|
32935
33097
|
if (isImportPhase) {
|
|
32936
|
-
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.
|
|
33098
|
+
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.start);
|
|
32937
33099
|
return null;
|
|
32938
33100
|
} else {
|
|
32939
33101
|
this.applyImportPhase(node, isExport, null);
|
|
@@ -33120,7 +33282,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
33120
33282
|
});
|
|
33121
33283
|
}
|
|
33122
33284
|
|
|
33123
|
-
this.checkReservedWord(imported.name, specifier.
|
|
33285
|
+
this.checkReservedWord(imported.name, specifier.start, true, true);
|
|
33124
33286
|
|
|
33125
33287
|
if (!specifier.local) {
|
|
33126
33288
|
specifier.local = this.cloneIdentifier(imported);
|
|
@@ -33178,30 +33340,34 @@ var Parser = class extends StatementParser {
|
|
|
33178
33340
|
optionFlags |= 128;
|
|
33179
33341
|
}
|
|
33180
33342
|
|
|
33181
|
-
if (normalizedOptions.
|
|
33343
|
+
if (normalizedOptions.locations === true) {
|
|
33182
33344
|
optionFlags |= 256;
|
|
33183
33345
|
}
|
|
33184
33346
|
|
|
33185
|
-
if (normalizedOptions.
|
|
33347
|
+
if (normalizedOptions.tokens) {
|
|
33186
33348
|
optionFlags |= 512;
|
|
33187
33349
|
}
|
|
33188
33350
|
|
|
33189
|
-
if (normalizedOptions.
|
|
33351
|
+
if (normalizedOptions.createImportExpressions) {
|
|
33190
33352
|
optionFlags |= 1024;
|
|
33191
33353
|
}
|
|
33192
33354
|
|
|
33193
|
-
if (normalizedOptions.
|
|
33355
|
+
if (normalizedOptions.createParenthesizedExpressions) {
|
|
33194
33356
|
optionFlags |= 2048;
|
|
33195
33357
|
}
|
|
33196
33358
|
|
|
33197
|
-
if (normalizedOptions.
|
|
33359
|
+
if (normalizedOptions.errorRecovery) {
|
|
33198
33360
|
optionFlags |= 4096;
|
|
33199
33361
|
}
|
|
33200
33362
|
|
|
33201
|
-
if (normalizedOptions.
|
|
33363
|
+
if (normalizedOptions.attachComment) {
|
|
33202
33364
|
optionFlags |= 8192;
|
|
33203
33365
|
}
|
|
33204
33366
|
|
|
33367
|
+
if (normalizedOptions.annexB) {
|
|
33368
|
+
optionFlags |= 16384;
|
|
33369
|
+
}
|
|
33370
|
+
|
|
33205
33371
|
this.optionFlags = optionFlags;
|
|
33206
33372
|
}
|
|
33207
33373
|
|
|
@@ -33220,6 +33386,11 @@ var Parser = class extends StatementParser {
|
|
|
33220
33386
|
|
|
33221
33387
|
result.errors = this.state.errors;
|
|
33222
33388
|
result.comments.length = this.state.commentsLen;
|
|
33389
|
+
|
|
33390
|
+
if (this.options.locations === 'packed') {
|
|
33391
|
+
result.locData = resetLocData();
|
|
33392
|
+
}
|
|
33393
|
+
|
|
33223
33394
|
return result;
|
|
33224
33395
|
}
|
|
33225
33396
|
};
|
|
@@ -33335,6 +33506,22 @@ function getParserClass(pluginsMap) {
|
|
|
33335
33506
|
return cls;
|
|
33336
33507
|
}
|
|
33337
33508
|
|
|
33509
|
+
function getLine(locData, pos) {
|
|
33510
|
+
if (pos < 0 || pos * 2 >= locData.length) {
|
|
33511
|
+
throw new Error(`Position ${pos} is out of bounds for location data.`);
|
|
33512
|
+
}
|
|
33513
|
+
|
|
33514
|
+
return locData[pos * 2];
|
|
33515
|
+
}
|
|
33516
|
+
|
|
33517
|
+
function getColumn(locData, pos) {
|
|
33518
|
+
if (pos < 0 || pos * 2 + 1 >= locData.length) {
|
|
33519
|
+
throw new Error(`Position ${pos} is out of bounds for location data.`);
|
|
33520
|
+
}
|
|
33521
|
+
|
|
33522
|
+
return locData[pos * 2 + 1];
|
|
33523
|
+
}
|
|
33524
|
+
|
|
33338
33525
|
// ../babel-babel/packages/babel-code-frame/lib/common-BO7XIBW3.js
|
|
33339
33526
|
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
33340
33527
|
|
|
@@ -36259,28 +36446,28 @@ var PRECEDENCE = /* @__PURE__ */new Map([
|
|
|
36259
36446
|
]);
|
|
36260
36447
|
|
|
36261
36448
|
function isTSTypeExpression(nodeId) {
|
|
36262
|
-
return nodeId ===
|
|
36449
|
+
return nodeId === 154 || nodeId === 199 || nodeId === 207;
|
|
36263
36450
|
}
|
|
36264
36451
|
|
|
36265
36452
|
var isClassExtendsClause = (node, parent, parentId) => {
|
|
36266
|
-
return (parentId ===
|
|
36453
|
+
return (parentId === 22 || parentId === 23) && parent.superClass === node;
|
|
36267
36454
|
};
|
|
36268
36455
|
|
|
36269
36456
|
var hasPostfixPart = (node, parent, parentId) => {
|
|
36270
36457
|
switch(parentId) {
|
|
36271
|
-
case
|
|
36272
|
-
case
|
|
36458
|
+
case 109:
|
|
36459
|
+
case 133:
|
|
36273
36460
|
return parent.object === node;
|
|
36274
36461
|
|
|
36275
|
-
case
|
|
36276
|
-
case
|
|
36277
|
-
case
|
|
36462
|
+
case 18:
|
|
36463
|
+
case 131:
|
|
36464
|
+
case 113:
|
|
36278
36465
|
return parent.callee === node;
|
|
36279
36466
|
|
|
36280
|
-
case
|
|
36467
|
+
case 220:
|
|
36281
36468
|
return parent.tag === node;
|
|
36282
36469
|
|
|
36283
|
-
case
|
|
36470
|
+
case 189:
|
|
36284
36471
|
return true;
|
|
36285
36472
|
}
|
|
36286
36473
|
|
|
@@ -36292,8 +36479,8 @@ function NullableTypeAnnotation$1(node, parent, parentId) {
|
|
|
36292
36479
|
}
|
|
36293
36480
|
|
|
36294
36481
|
function FunctionTypeAnnotation$1(node, parent, parentId, tokenContext) {
|
|
36295
|
-
return parentId ===
|
|
36296
|
-
|| parentId ===
|
|
36482
|
+
return parentId === 237
|
|
36483
|
+
|| parentId === 91
|
|
36297
36484
|
|| parentId === 4
|
|
36298
36485
|
|| (tokenContext & 8) > 0;
|
|
36299
36486
|
}
|
|
@@ -36319,20 +36506,20 @@ function BinaryLike(node, parent, parentId, nodeType) {
|
|
|
36319
36506
|
return true;
|
|
36320
36507
|
}
|
|
36321
36508
|
|
|
36322
|
-
if (hasPostfixPart(node, parent, parentId) || parentId ===
|
|
36509
|
+
if (hasPostfixPart(node, parent, parentId) || parentId === 236 || parentId === 143 || parentId === 8) {
|
|
36323
36510
|
return true;
|
|
36324
36511
|
}
|
|
36325
36512
|
|
|
36326
36513
|
let parentPos;
|
|
36327
36514
|
|
|
36328
36515
|
switch(parentId) {
|
|
36329
|
-
case
|
|
36330
|
-
case
|
|
36516
|
+
case 11:
|
|
36517
|
+
case 108:
|
|
36331
36518
|
parentPos = PRECEDENCE.get(parent.operator);
|
|
36332
36519
|
break;
|
|
36333
36520
|
|
|
36334
|
-
case
|
|
36335
|
-
case
|
|
36521
|
+
case 154:
|
|
36522
|
+
case 199:
|
|
36336
36523
|
parentPos = 7;
|
|
36337
36524
|
}
|
|
36338
36525
|
|
|
@@ -36342,11 +36529,11 @@ function BinaryLike(node, parent, parentId, nodeType) {
|
|
|
36342
36529
|
if (parentPos > nodePos)
|
|
36343
36530
|
return true;
|
|
36344
36531
|
|
|
36345
|
-
if (parentPos === nodePos && parentId ===
|
|
36532
|
+
if (parentPos === nodePos && parentId === 11 && (nodePos === 11 ? parent.left === node : parent.right === node)) {
|
|
36346
36533
|
return true;
|
|
36347
36534
|
}
|
|
36348
36535
|
|
|
36349
|
-
if (nodeType === 1 && parentId ===
|
|
36536
|
+
if (nodeType === 1 && parentId === 108 && (nodePos === 1 && parentPos !== 1 || parentPos === 1 && nodePos !== 1)) {
|
|
36350
36537
|
return true;
|
|
36351
36538
|
}
|
|
36352
36539
|
}
|
|
@@ -36357,9 +36544,9 @@ function BinaryLike(node, parent, parentId, nodeType) {
|
|
|
36357
36544
|
function UnionTypeAnnotation$1(node, parent, parentId) {
|
|
36358
36545
|
switch(parentId) {
|
|
36359
36546
|
case 4:
|
|
36360
|
-
case
|
|
36361
|
-
case
|
|
36362
|
-
case
|
|
36547
|
+
case 116:
|
|
36548
|
+
case 91:
|
|
36549
|
+
case 237:
|
|
36363
36550
|
return true;
|
|
36364
36551
|
}
|
|
36365
36552
|
|
|
@@ -36367,7 +36554,7 @@ function UnionTypeAnnotation$1(node, parent, parentId) {
|
|
|
36367
36554
|
}
|
|
36368
36555
|
|
|
36369
36556
|
function OptionalIndexedAccessType$1(node, parent, parentId) {
|
|
36370
|
-
return parentId ===
|
|
36557
|
+
return parentId === 85 && parent.objectType === node;
|
|
36371
36558
|
}
|
|
36372
36559
|
|
|
36373
36560
|
function TSAsExpression$1(node, parent, parentId) {
|
|
@@ -36375,7 +36562,7 @@ function TSAsExpression$1(node, parent, parentId) {
|
|
|
36375
36562
|
return true;
|
|
36376
36563
|
}
|
|
36377
36564
|
|
|
36378
|
-
if (parentId ===
|
|
36565
|
+
if (parentId === 11 && (parent.operator === '|' || parent.operator === '&') && node === parent.left) {
|
|
36379
36566
|
return true;
|
|
36380
36567
|
}
|
|
36381
36568
|
|
|
@@ -36384,18 +36571,18 @@ function TSAsExpression$1(node, parent, parentId) {
|
|
|
36384
36571
|
|
|
36385
36572
|
function TSConditionalType$1(node, parent, parentId) {
|
|
36386
36573
|
switch(parentId) {
|
|
36387
|
-
case
|
|
36388
|
-
case
|
|
36389
|
-
case 208:
|
|
36574
|
+
case 153:
|
|
36575
|
+
case 193:
|
|
36390
36576
|
case 209:
|
|
36391
|
-
case
|
|
36392
|
-
case
|
|
36577
|
+
case 210:
|
|
36578
|
+
case 179:
|
|
36579
|
+
case 217:
|
|
36393
36580
|
return true;
|
|
36394
36581
|
|
|
36395
|
-
case
|
|
36582
|
+
case 173:
|
|
36396
36583
|
return parent.objectType === node;
|
|
36397
36584
|
|
|
36398
|
-
case
|
|
36585
|
+
case 159:
|
|
36399
36586
|
return parent.checkType === node || parent.extendsType === node;
|
|
36400
36587
|
}
|
|
36401
36588
|
|
|
@@ -36404,13 +36591,13 @@ function TSConditionalType$1(node, parent, parentId) {
|
|
|
36404
36591
|
|
|
36405
36592
|
function TSUnionType$1(node, parent, parentId) {
|
|
36406
36593
|
switch(parentId) {
|
|
36407
|
-
case
|
|
36408
|
-
case
|
|
36409
|
-
case
|
|
36410
|
-
case
|
|
36594
|
+
case 179:
|
|
36595
|
+
case 209:
|
|
36596
|
+
case 153:
|
|
36597
|
+
case 193:
|
|
36411
36598
|
return true;
|
|
36412
36599
|
|
|
36413
|
-
case
|
|
36600
|
+
case 173:
|
|
36414
36601
|
return parent.objectType === node;
|
|
36415
36602
|
}
|
|
36416
36603
|
|
|
@@ -36418,7 +36605,7 @@ function TSUnionType$1(node, parent, parentId) {
|
|
|
36418
36605
|
}
|
|
36419
36606
|
|
|
36420
36607
|
function TSIntersectionType$1(node, parent, parentId) {
|
|
36421
|
-
return parentId ===
|
|
36608
|
+
return parentId === 209 || TSTypeOperator$1(node, parent, parentId);
|
|
36422
36609
|
}
|
|
36423
36610
|
|
|
36424
36611
|
function TSInferType$1(node, parent, parentId) {
|
|
@@ -36426,7 +36613,7 @@ function TSInferType$1(node, parent, parentId) {
|
|
|
36426
36613
|
return true;
|
|
36427
36614
|
}
|
|
36428
36615
|
|
|
36429
|
-
if ((parentId ===
|
|
36616
|
+
if ((parentId === 179 || parentId === 217) && node.typeParameter.constraint != null) {
|
|
36430
36617
|
return true;
|
|
36431
36618
|
}
|
|
36432
36619
|
|
|
@@ -36435,11 +36622,11 @@ function TSInferType$1(node, parent, parentId) {
|
|
|
36435
36622
|
|
|
36436
36623
|
function TSTypeOperator$1(node, parent, parentId) {
|
|
36437
36624
|
switch(parentId) {
|
|
36438
|
-
case
|
|
36439
|
-
case
|
|
36625
|
+
case 153:
|
|
36626
|
+
case 193:
|
|
36440
36627
|
return true;
|
|
36441
36628
|
|
|
36442
|
-
case
|
|
36629
|
+
case 173:
|
|
36443
36630
|
if (parent.objectType === node) {
|
|
36444
36631
|
return true;
|
|
36445
36632
|
}
|
|
@@ -36450,10 +36637,10 @@ function TSTypeOperator$1(node, parent, parentId) {
|
|
|
36450
36637
|
|
|
36451
36638
|
function TSInstantiationExpression$1(node, parent, parentId) {
|
|
36452
36639
|
switch(parentId) {
|
|
36453
|
-
case
|
|
36454
|
-
case
|
|
36455
|
-
case
|
|
36456
|
-
case
|
|
36640
|
+
case 18:
|
|
36641
|
+
case 131:
|
|
36642
|
+
case 113:
|
|
36643
|
+
case 175:
|
|
36457
36644
|
return parent.typeArguments != null;
|
|
36458
36645
|
}
|
|
36459
36646
|
|
|
@@ -36464,8 +36651,8 @@ function TSFunctionType$1(node, parent, parentId) {
|
|
|
36464
36651
|
if (TSUnionType$1(node, parent, parentId))
|
|
36465
36652
|
return true;
|
|
36466
36653
|
|
|
36467
|
-
return parentId ===
|
|
36468
|
-
|| parentId ===
|
|
36654
|
+
return parentId === 217
|
|
36655
|
+
|| parentId === 159
|
|
36469
36656
|
&& (parent.checkType === node
|
|
36470
36657
|
|| parent.extendsType === node);
|
|
36471
36658
|
}
|
|
@@ -36482,19 +36669,19 @@ function LogicalExpression2(node, parent, parentId) {
|
|
|
36482
36669
|
}
|
|
36483
36670
|
|
|
36484
36671
|
function SequenceExpression$1(node, parent, parentId) {
|
|
36485
|
-
if (parentId ===
|
|
36672
|
+
if (parentId === 142 || parentId === 134 || parentId === 109 && parent.property === node || parentId === 133 && parent.property === node || parentId === 222) {
|
|
36486
36673
|
return false;
|
|
36487
36674
|
}
|
|
36488
36675
|
|
|
36489
|
-
if (parentId ===
|
|
36676
|
+
if (parentId === 22) {
|
|
36490
36677
|
return true;
|
|
36491
36678
|
}
|
|
36492
36679
|
|
|
36493
|
-
if (parentId ===
|
|
36680
|
+
if (parentId === 69) {
|
|
36494
36681
|
return parent.right === node;
|
|
36495
36682
|
}
|
|
36496
36683
|
|
|
36497
|
-
if (parentId ===
|
|
36684
|
+
if (parentId === 61) {
|
|
36498
36685
|
return true;
|
|
36499
36686
|
}
|
|
36500
36687
|
|
|
@@ -36502,14 +36689,14 @@ function SequenceExpression$1(node, parent, parentId) {
|
|
|
36502
36689
|
}
|
|
36503
36690
|
|
|
36504
36691
|
function YieldExpression$1(node, parent, parentId) {
|
|
36505
|
-
return parentId ===
|
|
36506
|
-
|| parentId ===
|
|
36507
|
-
|| parentId ===
|
|
36508
|
-
|| parentId ===
|
|
36692
|
+
return parentId === 11
|
|
36693
|
+
|| parentId === 108
|
|
36694
|
+
|| parentId === 236
|
|
36695
|
+
|| parentId === 143
|
|
36509
36696
|
|| hasPostfixPart(node, parent, parentId)
|
|
36510
36697
|
|| parentId === 8
|
|
36511
36698
|
&& isYieldExpression2(node)
|
|
36512
|
-
|| parentId ===
|
|
36699
|
+
|| parentId === 29
|
|
36513
36700
|
&& node === parent.test
|
|
36514
36701
|
|| isClassExtendsClause(node, parent, parentId)
|
|
36515
36702
|
|| isTSTypeExpression(parentId);
|
|
@@ -36521,7 +36708,7 @@ function ClassExpression2(node, parent, parentId, tokenContext) {
|
|
|
36521
36708
|
|
|
36522
36709
|
function UnaryLike(node, parent, parentId) {
|
|
36523
36710
|
return hasPostfixPart(node, parent, parentId)
|
|
36524
|
-
|| parentId ===
|
|
36711
|
+
|| parentId === 11
|
|
36525
36712
|
&& parent.operator === '**'
|
|
36526
36713
|
&& parent.left === node
|
|
36527
36714
|
|| isClassExtendsClause(node, parent, parentId);
|
|
@@ -36533,14 +36720,14 @@ function FunctionExpression$1(node, parent, parentId, tokenContext) {
|
|
|
36533
36720
|
|
|
36534
36721
|
function ConditionalExpression$1(node, parent, parentId) {
|
|
36535
36722
|
switch(parentId) {
|
|
36536
|
-
case
|
|
36537
|
-
case
|
|
36538
|
-
case
|
|
36539
|
-
case
|
|
36723
|
+
case 236:
|
|
36724
|
+
case 143:
|
|
36725
|
+
case 11:
|
|
36726
|
+
case 108:
|
|
36540
36727
|
case 8:
|
|
36541
36728
|
return true;
|
|
36542
36729
|
|
|
36543
|
-
case
|
|
36730
|
+
case 29:
|
|
36544
36731
|
if (parent.test === node) {
|
|
36545
36732
|
return true;
|
|
36546
36733
|
}
|
|
@@ -36555,10 +36742,10 @@ function ConditionalExpression$1(node, parent, parentId) {
|
|
|
36555
36742
|
|
|
36556
36743
|
function OptionalMemberExpression$1(node, parent, parentId) {
|
|
36557
36744
|
switch(parentId) {
|
|
36558
|
-
case
|
|
36745
|
+
case 18:
|
|
36559
36746
|
return parent.callee === node;
|
|
36560
36747
|
|
|
36561
|
-
case
|
|
36748
|
+
case 109:
|
|
36562
36749
|
return parent.object === node;
|
|
36563
36750
|
}
|
|
36564
36751
|
|
|
@@ -36586,7 +36773,7 @@ function Identifier$1(node, parent, parentId, tokenContext, getRawIdentifier) {
|
|
|
36586
36773
|
}
|
|
36587
36774
|
}
|
|
36588
36775
|
|
|
36589
|
-
if (tokenContext & 64 || (parentId ===
|
|
36776
|
+
if (tokenContext & 64 || (parentId === 109 || parentId === 133) && tokenContext & (1 | 16 | 32)) {
|
|
36590
36777
|
if (node.name === 'let') {
|
|
36591
36778
|
const isFollowedByBracket = isMemberExpression$1(parent, {
|
|
36592
36779
|
object: node,
|
|
@@ -36605,7 +36792,7 @@ function Identifier$1(node, parent, parentId, tokenContext, getRawIdentifier) {
|
|
|
36605
36792
|
}
|
|
36606
36793
|
}
|
|
36607
36794
|
|
|
36608
|
-
return parentId ===
|
|
36795
|
+
return parentId === 69
|
|
36609
36796
|
&& parent.left === node
|
|
36610
36797
|
&& node.name === 'async'
|
|
36611
36798
|
&& !parent.await;
|
|
@@ -39934,6 +40121,7 @@ var generatorFunctions = /* @__PURE__ */Object.freeze({
|
|
|
39934
40121
|
AssignmentPattern: AssignmentPattern2,
|
|
39935
40122
|
AwaitExpression: AwaitExpression2,
|
|
39936
40123
|
BigIntLiteral: BigIntLiteral2,
|
|
40124
|
+
BigIntLiteralTypeAnnotation: BigIntLiteral2,
|
|
39937
40125
|
BinaryExpression: BinaryExpression2,
|
|
39938
40126
|
BindExpression: BindExpression2,
|
|
39939
40127
|
BlockStatement: BlockStatement2,
|
|
@@ -40224,7 +40412,7 @@ function isOrHasCallExpression(node) {
|
|
|
40224
40412
|
|
|
40225
40413
|
function parentNeedsParens(node, parent, parentId) {
|
|
40226
40414
|
switch(parentId) {
|
|
40227
|
-
case
|
|
40415
|
+
case 113:
|
|
40228
40416
|
if (parent.callee === node) {
|
|
40229
40417
|
if (isOrHasCallExpression(node))
|
|
40230
40418
|
return true;
|
|
@@ -40232,7 +40420,7 @@ function parentNeedsParens(node, parent, parentId) {
|
|
|
40232
40420
|
|
|
40233
40421
|
break;
|
|
40234
40422
|
|
|
40235
|
-
case
|
|
40423
|
+
case 43:
|
|
40236
40424
|
return !isDecoratorMemberExpression(node) && !(node.type === 'CallExpression' && isDecoratorMemberExpression(node.callee)) && node.type !== 'ParenthesizedExpression';
|
|
40237
40425
|
}
|
|
40238
40426
|
|
|
@@ -41036,7 +41224,7 @@ var Printer = class {
|
|
|
41036
41224
|
&& flags & 1
|
|
41037
41225
|
|| parenthesized
|
|
41038
41226
|
&& flags & 16
|
|
41039
|
-
&& nodeId ===
|
|
41227
|
+
&& nodeId === 72
|
|
41040
41228
|
|| parent
|
|
41041
41229
|
&& (parentNeedsParens(node, parent, parentId)
|
|
41042
41230
|
|| needsParens != null
|
|
@@ -41044,15 +41232,15 @@ var Printer = class {
|
|
|
41044
41232
|
|
|
41045
41233
|
if (!shouldPrintParens && parenthesized && node.leadingComments?.length && node.leadingComments[0].type === 'CommentBlock') {
|
|
41046
41234
|
switch(parentId) {
|
|
41047
|
-
case
|
|
41048
|
-
case
|
|
41235
|
+
case 66:
|
|
41236
|
+
case 241:
|
|
41049
41237
|
case 6:
|
|
41050
|
-
case
|
|
41238
|
+
case 141:
|
|
41051
41239
|
break;
|
|
41052
41240
|
|
|
41053
|
-
case
|
|
41054
|
-
case
|
|
41055
|
-
case
|
|
41241
|
+
case 18:
|
|
41242
|
+
case 131:
|
|
41243
|
+
case 113:
|
|
41056
41244
|
if (parent.callee !== node)
|
|
41057
41245
|
break;
|
|
41058
41246
|
|
|
@@ -41105,7 +41293,7 @@ var Printer = class {
|
|
|
41105
41293
|
}
|
|
41106
41294
|
|
|
41107
41295
|
this._printLeadingComments(node, parent);
|
|
41108
|
-
this.exactSource(nodeId ===
|
|
41296
|
+
this.exactSource(nodeId === 137 || nodeId === 67 ? null : loc, printMethod.bind(this, node, parent));
|
|
41109
41297
|
|
|
41110
41298
|
if (shouldPrintParens) {
|
|
41111
41299
|
this._printTrailingComments(node, parent);
|
|
@@ -41344,7 +41532,7 @@ var Printer = class {
|
|
|
41344
41532
|
}
|
|
41345
41533
|
|
|
41346
41534
|
noIndentInnerCommentsHere() {
|
|
41347
|
-
this._innerCommentsState &=
|
|
41535
|
+
this._innerCommentsState &= -5;
|
|
41348
41536
|
}
|
|
41349
41537
|
|
|
41350
41538
|
printSequence(nodes, indent, resetTokenContext, trailingCommentsLineOffset) {
|
|
@@ -48340,6 +48528,8 @@ traverse3.cache = cache;
|
|
|
48340
48528
|
export {
|
|
48341
48529
|
codeFrameColumns,
|
|
48342
48530
|
generate,
|
|
48531
|
+
getColumn,
|
|
48532
|
+
getLine,
|
|
48343
48533
|
parse,
|
|
48344
48534
|
parseExpression,
|
|
48345
48535
|
index as template,
|