meriyah 7.3.1 → 7.3.2
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 +8 -0
- package/dist/meriyah.cjs +76 -70
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +76 -70
- package/dist/meriyah.umd.js +76 -70
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +2 -1
- package/dist/types/parser/scope.d.ts +5 -5
- package/package.json +1 -1
package/dist/meriyah.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.meriyah = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version$1 = "7.3.
|
|
7
|
+
var version$1 = "7.3.2";
|
|
8
8
|
var packageJson = {
|
|
9
9
|
version: version$1};
|
|
10
10
|
|
|
@@ -2046,6 +2046,9 @@
|
|
|
2046
2046
|
}
|
|
2047
2047
|
case 8390721: {
|
|
2048
2048
|
advanceChar(parser);
|
|
2049
|
+
if (context & 1048576) {
|
|
2050
|
+
return 8390721;
|
|
2051
|
+
}
|
|
2049
2052
|
const ch = parser.currentChar;
|
|
2050
2053
|
if (ch === 61) {
|
|
2051
2054
|
advanceChar(parser);
|
|
@@ -4569,7 +4572,7 @@
|
|
|
4569
4572
|
parser.setToken(138);
|
|
4570
4573
|
}
|
|
4571
4574
|
function rescanJSXIdentifier(parser) {
|
|
4572
|
-
if (
|
|
4575
|
+
if (parser.getToken() & 143360) {
|
|
4573
4576
|
const { index } = parser;
|
|
4574
4577
|
let char = parser.currentChar;
|
|
4575
4578
|
while (CharTypes[char] & (32768 | 2)) {
|
|
@@ -4674,18 +4677,18 @@
|
|
|
4674
4677
|
createChildScope(type) {
|
|
4675
4678
|
return new Scope(this.parser, type, this);
|
|
4676
4679
|
}
|
|
4677
|
-
addVarOrBlock(context, name, kind, origin) {
|
|
4680
|
+
addVarOrBlock(context, name, kind, tokenStart, tokenEnd, origin) {
|
|
4678
4681
|
if (kind & 4) {
|
|
4679
|
-
this.addVarName(context, name, kind);
|
|
4682
|
+
this.addVarName(context, name, kind, tokenStart, tokenEnd);
|
|
4680
4683
|
}
|
|
4681
4684
|
else {
|
|
4682
|
-
this.addBlockName(context, name, kind, origin);
|
|
4685
|
+
this.addBlockName(context, name, kind, tokenStart, tokenEnd, origin);
|
|
4683
4686
|
}
|
|
4684
4687
|
if (origin & 64) {
|
|
4685
4688
|
this.parser.declareUnboundVariable(name);
|
|
4686
4689
|
}
|
|
4687
4690
|
}
|
|
4688
|
-
addVarName(context, name, kind) {
|
|
4691
|
+
addVarName(context, name, kind, tokenStart, tokenEnd) {
|
|
4689
4692
|
const { parser } = this;
|
|
4690
4693
|
let currentScope = this;
|
|
4691
4694
|
while (currentScope && (currentScope.type & 128) === 0) {
|
|
@@ -4697,17 +4700,17 @@
|
|
|
4697
4700
|
((kind & 128 && value & 68) ||
|
|
4698
4701
|
(value & 128 && kind & 68))) ;
|
|
4699
4702
|
else {
|
|
4700
|
-
|
|
4703
|
+
throw new ParseError(tokenStart, tokenEnd, 147, name);
|
|
4701
4704
|
}
|
|
4702
4705
|
}
|
|
4703
4706
|
if (currentScope === this) {
|
|
4704
4707
|
if (value && value & 1 && kind & 1) {
|
|
4705
|
-
currentScope.recordScopeError(147, name);
|
|
4708
|
+
currentScope.recordScopeError(147, tokenStart, tokenEnd, name);
|
|
4706
4709
|
}
|
|
4707
4710
|
}
|
|
4708
4711
|
if (value &&
|
|
4709
4712
|
(value & 256 || (value & 512 && !parser.options.webcompat))) {
|
|
4710
|
-
|
|
4713
|
+
throw new ParseError(tokenStart, tokenEnd, 147, name);
|
|
4711
4714
|
}
|
|
4712
4715
|
currentScope.variableBindings.set(name, kind);
|
|
4713
4716
|
currentScope = currentScope.parent;
|
|
@@ -4716,12 +4719,12 @@
|
|
|
4716
4719
|
hasVariable(name) {
|
|
4717
4720
|
return this.variableBindings.has(name);
|
|
4718
4721
|
}
|
|
4719
|
-
addBlockName(context, name, kind, origin = 0) {
|
|
4722
|
+
addBlockName(context, name, kind, tokenStart, tokenEnd, origin = 0) {
|
|
4720
4723
|
const { parser } = this;
|
|
4721
4724
|
const value = this.variableBindings.get(name);
|
|
4722
4725
|
if (value && (value & 2) === 0) {
|
|
4723
4726
|
if (kind & 1) {
|
|
4724
|
-
this.recordScopeError(147, name);
|
|
4727
|
+
this.recordScopeError(147, tokenStart, tokenEnd, name);
|
|
4725
4728
|
}
|
|
4726
4729
|
else if (parser.options.webcompat &&
|
|
4727
4730
|
(context & 1) === 0 &&
|
|
@@ -4729,31 +4732,31 @@
|
|
|
4729
4732
|
value === 64 &&
|
|
4730
4733
|
kind === 64) ;
|
|
4731
4734
|
else {
|
|
4732
|
-
|
|
4735
|
+
throw new ParseError(tokenStart, tokenEnd, 147, name);
|
|
4733
4736
|
}
|
|
4734
4737
|
}
|
|
4735
4738
|
if (this.type & 64 &&
|
|
4736
4739
|
this.parent?.hasVariable(name) &&
|
|
4737
4740
|
(this.parent.variableBindings.get(name) & 2) === 0) {
|
|
4738
|
-
|
|
4741
|
+
throw new ParseError(tokenStart, tokenEnd, 147, name);
|
|
4739
4742
|
}
|
|
4740
4743
|
if (this.type & 512 && value && (value & 2) === 0) {
|
|
4741
4744
|
if (kind & 1) {
|
|
4742
|
-
this.recordScopeError(147, name);
|
|
4745
|
+
this.recordScopeError(147, tokenStart, tokenEnd, name);
|
|
4743
4746
|
}
|
|
4744
4747
|
}
|
|
4745
4748
|
if (this.type & 32) {
|
|
4746
4749
|
if (this.parent.variableBindings.get(name) & 768)
|
|
4747
|
-
|
|
4750
|
+
throw new ParseError(tokenStart, tokenEnd, 161, name);
|
|
4748
4751
|
}
|
|
4749
4752
|
this.variableBindings.set(name, kind);
|
|
4750
4753
|
}
|
|
4751
|
-
recordScopeError(type, ...params) {
|
|
4752
|
-
this.scopeError
|
|
4754
|
+
recordScopeError(type, tokenStart, tokenEnd, ...params) {
|
|
4755
|
+
this.scopeError ??= {
|
|
4753
4756
|
type,
|
|
4754
4757
|
params,
|
|
4755
|
-
start:
|
|
4756
|
-
end:
|
|
4758
|
+
start: tokenStart,
|
|
4759
|
+
end: tokenEnd,
|
|
4757
4760
|
};
|
|
4758
4761
|
}
|
|
4759
4762
|
reportScopeError() {
|
|
@@ -4764,9 +4767,9 @@
|
|
|
4764
4767
|
throw new ParseError(scopeError.start, scopeError.end, scopeError.type, ...scopeError.params);
|
|
4765
4768
|
}
|
|
4766
4769
|
}
|
|
4767
|
-
function createArrowHeadParsingScope(parser, context, value) {
|
|
4770
|
+
function createArrowHeadParsingScope(parser, context, value, tokenStart, tokenEnd) {
|
|
4768
4771
|
const scope = parser.createScope().createChildScope(512);
|
|
4769
|
-
scope.addBlockName(context, value, 1);
|
|
4772
|
+
scope.addBlockName(context, value, 1, tokenStart, tokenEnd);
|
|
4770
4773
|
return scope;
|
|
4771
4774
|
}
|
|
4772
4775
|
|
|
@@ -5528,7 +5531,7 @@
|
|
|
5528
5531
|
}, start);
|
|
5529
5532
|
}
|
|
5530
5533
|
function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin) {
|
|
5531
|
-
const { tokenValue, tokenStart } = parser;
|
|
5534
|
+
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
5532
5535
|
const token = parser.getToken();
|
|
5533
5536
|
let expr = parseIdentifier(parser, context);
|
|
5534
5537
|
if (parser.getToken() & (143360 | 2097152) &&
|
|
@@ -5550,7 +5553,7 @@
|
|
|
5550
5553
|
if (parser.getToken() === 10) {
|
|
5551
5554
|
let scope = void 0;
|
|
5552
5555
|
if (parser.options.lexical)
|
|
5553
|
-
scope = createArrowHeadParsingScope(parser, context, tokenValue);
|
|
5556
|
+
scope = createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation);
|
|
5554
5557
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
5555
5558
|
expr = parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], 0, tokenStart);
|
|
5556
5559
|
}
|
|
@@ -5769,6 +5772,7 @@
|
|
|
5769
5772
|
}
|
|
5770
5773
|
else if (parser.getToken() === 471156) {
|
|
5771
5774
|
const ofStart = parser.tokenStart;
|
|
5775
|
+
const ofEnd = parser.currentLocation;
|
|
5772
5776
|
const ofToken = parser.getToken();
|
|
5773
5777
|
const ofValue = parser.tokenValue;
|
|
5774
5778
|
const ofIdentifier = parseIdentifier(parser, context);
|
|
@@ -5784,7 +5788,7 @@
|
|
|
5784
5788
|
else {
|
|
5785
5789
|
resourceDeclarationKind = 'using';
|
|
5786
5790
|
validateBindingIdentifier(parser, context, 16, ofToken, 0);
|
|
5787
|
-
scope?.addBlockName(context, ofValue, 16, 32);
|
|
5791
|
+
scope?.addBlockName(context, ofValue, 16, ofStart, ofEnd, 32);
|
|
5788
5792
|
let declarationInitializer = null;
|
|
5789
5793
|
if (parser.getToken() === 1077936155) {
|
|
5790
5794
|
nextToken(parser, context | 32);
|
|
@@ -5975,7 +5979,7 @@
|
|
|
5975
5979
|
parser.report(120);
|
|
5976
5980
|
if ((parser.getToken() & 537079808) === 537079808)
|
|
5977
5981
|
parser.report(121);
|
|
5978
|
-
scope?.addBlockName(context, parser.tokenValue, 8);
|
|
5982
|
+
scope?.addBlockName(context, parser.tokenValue, 8, parser.tokenStart, parser.currentLocation);
|
|
5979
5983
|
return parseIdentifier(parser, context);
|
|
5980
5984
|
}
|
|
5981
5985
|
function parseImportDeclaration(parser, context, scope) {
|
|
@@ -5992,7 +5996,7 @@
|
|
|
5992
5996
|
else {
|
|
5993
5997
|
if (parser.getToken() & 143360) {
|
|
5994
5998
|
const token = parser.getToken();
|
|
5995
|
-
const { tokenValue } = parser;
|
|
5999
|
+
const { tokenValue, tokenStart: start, currentLocation } = parser;
|
|
5996
6000
|
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && tokenValue == 'defer';
|
|
5997
6001
|
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && tokenValue == 'source';
|
|
5998
6002
|
if (isPhaseDefer || isPhaseSource) {
|
|
@@ -6003,7 +6007,7 @@
|
|
|
6003
6007
|
specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
|
|
6004
6008
|
}
|
|
6005
6009
|
else if (parser.getToken() === 209011 || parser.getToken() === 18) {
|
|
6006
|
-
scope?.addBlockName(context, tokenValue, 8);
|
|
6010
|
+
scope?.addBlockName(context, tokenValue, 8, start, currentLocation);
|
|
6007
6011
|
specifiers = [
|
|
6008
6012
|
parser.finishNode({
|
|
6009
6013
|
type: 'ImportDefaultSpecifier',
|
|
@@ -6018,10 +6022,11 @@
|
|
|
6018
6022
|
else if (parser.getToken() === 209011) {
|
|
6019
6023
|
const fromToken = parser.getToken();
|
|
6020
6024
|
const fromStart = parser.tokenStart;
|
|
6025
|
+
const fromEnd = parser.currentLocation;
|
|
6021
6026
|
const fromLocal = parseIdentifier(parser, context);
|
|
6022
6027
|
if (parser.getToken() === 209011) {
|
|
6023
6028
|
validateBindingIdentifier(parser, context, 16, fromToken, 0);
|
|
6024
|
-
scope?.addBlockName(context, fromLocal.name, 8);
|
|
6029
|
+
scope?.addBlockName(context, fromLocal.name, 8, fromStart, fromEnd);
|
|
6025
6030
|
phase = 'source';
|
|
6026
6031
|
specifiers = [
|
|
6027
6032
|
parser.finishNode({
|
|
@@ -6031,7 +6036,7 @@
|
|
|
6031
6036
|
];
|
|
6032
6037
|
}
|
|
6033
6038
|
else {
|
|
6034
|
-
scope?.addBlockName(context, tokenValue, 8);
|
|
6039
|
+
scope?.addBlockName(context, tokenValue, 8, start, currentLocation);
|
|
6035
6040
|
specifiers = [
|
|
6036
6041
|
parser.finishNode({
|
|
6037
6042
|
type: 'ImportDefaultSpecifier',
|
|
@@ -6056,7 +6061,7 @@
|
|
|
6056
6061
|
];
|
|
6057
6062
|
}
|
|
6058
6063
|
else if (parser.getToken() === 18) {
|
|
6059
|
-
scope?.addBlockName(context, tokenValue, 8);
|
|
6064
|
+
scope?.addBlockName(context, tokenValue, 8, start, currentLocation);
|
|
6060
6065
|
specifiers = [
|
|
6061
6066
|
parser.finishNode({
|
|
6062
6067
|
type: 'ImportDefaultSpecifier',
|
|
@@ -6141,7 +6146,8 @@
|
|
|
6141
6146
|
function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers) {
|
|
6142
6147
|
nextToken(parser, context);
|
|
6143
6148
|
while (parser.getToken() & 143360 || parser.getToken() === 134283267) {
|
|
6144
|
-
let { tokenValue, tokenStart } = parser;
|
|
6149
|
+
let { tokenValue, tokenStart, currentLocation } = parser;
|
|
6150
|
+
const start = tokenStart;
|
|
6145
6151
|
const token = parser.getToken();
|
|
6146
6152
|
const imported = parseModuleExportName(parser, context);
|
|
6147
6153
|
let local;
|
|
@@ -6154,6 +6160,8 @@
|
|
|
6154
6160
|
validateBindingIdentifier(parser, context, 16, parser.getToken(), 0);
|
|
6155
6161
|
}
|
|
6156
6162
|
tokenValue = parser.tokenValue;
|
|
6163
|
+
tokenStart = parser.tokenStart;
|
|
6164
|
+
currentLocation = parser.currentLocation;
|
|
6157
6165
|
local = parseIdentifier(parser, context);
|
|
6158
6166
|
}
|
|
6159
6167
|
else if (imported.type === 'Identifier') {
|
|
@@ -6163,12 +6171,12 @@
|
|
|
6163
6171
|
else {
|
|
6164
6172
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
6165
6173
|
}
|
|
6166
|
-
scope?.addBlockName(context, tokenValue, 8);
|
|
6174
|
+
scope?.addBlockName(context, tokenValue, 8, tokenStart, currentLocation);
|
|
6167
6175
|
specifiers.push(parser.finishNode({
|
|
6168
6176
|
type: 'ImportSpecifier',
|
|
6169
6177
|
local,
|
|
6170
6178
|
imported,
|
|
6171
|
-
},
|
|
6179
|
+
}, start));
|
|
6172
6180
|
if (parser.getToken() !== 1074790415)
|
|
6173
6181
|
consume(parser, context, 18);
|
|
6174
6182
|
}
|
|
@@ -6235,7 +6243,7 @@
|
|
|
6235
6243
|
}
|
|
6236
6244
|
else if (parser.getToken() & 143360) {
|
|
6237
6245
|
if (scope)
|
|
6238
|
-
scope = createArrowHeadParsingScope(parser, context, parser.tokenValue);
|
|
6246
|
+
scope = createArrowHeadParsingScope(parser, context, parser.tokenValue, parser.tokenStart, parser.currentLocation);
|
|
6239
6247
|
declaration = parseIdentifier(parser, context);
|
|
6240
6248
|
declaration = parseArrowFunctionExpression(parser, context, scope, undefined, [declaration], 1, tokenStart);
|
|
6241
6249
|
}
|
|
@@ -7324,12 +7332,7 @@
|
|
|
7324
7332
|
: 64 | (isAsync ? 1024 : 0) | (isGenerator ? 1024 : 0);
|
|
7325
7333
|
validateFunctionName(parser, context, parser.getToken());
|
|
7326
7334
|
if (scope) {
|
|
7327
|
-
|
|
7328
|
-
scope.addVarName(context, parser.tokenValue, kind);
|
|
7329
|
-
}
|
|
7330
|
-
else {
|
|
7331
|
-
scope.addBlockName(context, parser.tokenValue, kind, origin);
|
|
7332
|
-
}
|
|
7335
|
+
scope.addVarOrBlock(context, parser.tokenValue, kind, parser.tokenStart, parser.currentLocation, origin);
|
|
7333
7336
|
functionScope = functionScope?.createChildScope(128);
|
|
7334
7337
|
if (flags) {
|
|
7335
7338
|
if (flags & 2) {
|
|
@@ -7434,7 +7437,7 @@
|
|
|
7434
7437
|
}
|
|
7435
7438
|
else {
|
|
7436
7439
|
let left;
|
|
7437
|
-
const { tokenStart, tokenValue } = parser;
|
|
7440
|
+
const { tokenStart, tokenValue, currentLocation } = parser;
|
|
7438
7441
|
const token = parser.getToken();
|
|
7439
7442
|
if (token & 143360) {
|
|
7440
7443
|
left = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, inGroup, 1, tokenStart);
|
|
@@ -7442,7 +7445,7 @@
|
|
|
7442
7445
|
if (parser.assignable & 2)
|
|
7443
7446
|
parser.report(26);
|
|
7444
7447
|
nextToken(parser, context | 32);
|
|
7445
|
-
scope?.addVarOrBlock(context, tokenValue, kind, origin);
|
|
7448
|
+
scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
|
|
7446
7449
|
const right = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
|
|
7447
7450
|
left = parser.finishNode(isPattern
|
|
7448
7451
|
? {
|
|
@@ -7468,7 +7471,7 @@
|
|
|
7468
7471
|
destructible |= 16;
|
|
7469
7472
|
}
|
|
7470
7473
|
else {
|
|
7471
|
-
scope?.addVarOrBlock(context, tokenValue, kind, origin);
|
|
7474
|
+
scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
|
|
7472
7475
|
}
|
|
7473
7476
|
destructible |=
|
|
7474
7477
|
parser.destructible & 256
|
|
@@ -7606,7 +7609,7 @@
|
|
|
7606
7609
|
nextToken(parser, context | 32);
|
|
7607
7610
|
let argument = null;
|
|
7608
7611
|
let destructible = 0;
|
|
7609
|
-
const { tokenValue, tokenStart } = parser;
|
|
7612
|
+
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
7610
7613
|
let token = parser.getToken();
|
|
7611
7614
|
if (token & 143360) {
|
|
7612
7615
|
parser.assignable = 1;
|
|
@@ -7623,7 +7626,7 @@
|
|
|
7623
7626
|
destructible |= 16;
|
|
7624
7627
|
}
|
|
7625
7628
|
else if (token === closingToken || token === 18) {
|
|
7626
|
-
scope?.addVarOrBlock(context, tokenValue, kind, origin);
|
|
7629
|
+
scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
|
|
7627
7630
|
}
|
|
7628
7631
|
else {
|
|
7629
7632
|
destructible |= 32;
|
|
@@ -7778,7 +7781,7 @@
|
|
|
7778
7781
|
let prototypeCount = 0;
|
|
7779
7782
|
context = (context | 131072) ^ 131072;
|
|
7780
7783
|
while (parser.getToken() !== 1074790415) {
|
|
7781
|
-
const { tokenValue, tokenStart } = parser;
|
|
7784
|
+
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
7782
7785
|
const token = parser.getToken();
|
|
7783
7786
|
if (token === 14) {
|
|
7784
7787
|
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind, 0, inGroup, isPattern, origin));
|
|
@@ -7803,7 +7806,7 @@
|
|
|
7803
7806
|
else {
|
|
7804
7807
|
validateBindingIdentifier(parser, context, kind, token, 0);
|
|
7805
7808
|
}
|
|
7806
|
-
scope?.addVarOrBlock(context, tokenValue, kind, origin);
|
|
7809
|
+
scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
|
|
7807
7810
|
if (consumeOpt(parser, context | 32, 1077936155)) {
|
|
7808
7811
|
destructible |= 8;
|
|
7809
7812
|
const right = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
|
|
@@ -7827,7 +7830,7 @@
|
|
|
7827
7830
|
}
|
|
7828
7831
|
}
|
|
7829
7832
|
else if (consumeOpt(parser, context | 32, 21)) {
|
|
7830
|
-
const { tokenStart } = parser;
|
|
7833
|
+
const { tokenStart, currentLocation } = parser;
|
|
7831
7834
|
if (tokenValue === '__proto__')
|
|
7832
7835
|
prototypeCount++;
|
|
7833
7836
|
if (parser.getToken() & 143360) {
|
|
@@ -7843,7 +7846,7 @@
|
|
|
7843
7846
|
destructible |= 16;
|
|
7844
7847
|
}
|
|
7845
7848
|
else if ((tokenAfterColon & 143360) === 143360) {
|
|
7846
|
-
scope?.addVarOrBlock(context, valueAfterColon, kind, origin);
|
|
7849
|
+
scope?.addVarOrBlock(context, valueAfterColon, kind, tokenStart, currentLocation, origin);
|
|
7847
7850
|
}
|
|
7848
7851
|
}
|
|
7849
7852
|
else {
|
|
@@ -7861,7 +7864,7 @@
|
|
|
7861
7864
|
destructible |= 32;
|
|
7862
7865
|
}
|
|
7863
7866
|
else {
|
|
7864
|
-
scope?.addVarOrBlock(context, valueAfterColon, kind, origin);
|
|
7867
|
+
scope?.addVarOrBlock(context, valueAfterColon, kind, tokenStart, currentLocation, origin);
|
|
7865
7868
|
}
|
|
7866
7869
|
value = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, value);
|
|
7867
7870
|
}
|
|
@@ -8029,7 +8032,7 @@
|
|
|
8029
8032
|
prototypeCount++;
|
|
8030
8033
|
if (parser.getToken() & 143360) {
|
|
8031
8034
|
value = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, inGroup, 1, tokenStart);
|
|
8032
|
-
const { tokenValue: valueAfterColon } = parser;
|
|
8035
|
+
const { tokenValue: valueAfterColon, tokenStart: start, currentLocation } = parser;
|
|
8033
8036
|
const token = parser.getToken();
|
|
8034
8037
|
value = parseMemberOrUpdateExpression(parser, context, privateScope, value, inGroup, 0, tokenStart);
|
|
8035
8038
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
@@ -8038,7 +8041,7 @@
|
|
|
8038
8041
|
destructible |= 16;
|
|
8039
8042
|
}
|
|
8040
8043
|
else {
|
|
8041
|
-
scope?.addVarOrBlock(context, valueAfterColon, kind, origin);
|
|
8044
|
+
scope?.addVarOrBlock(context, valueAfterColon, kind, start, currentLocation, origin);
|
|
8042
8045
|
}
|
|
8043
8046
|
}
|
|
8044
8047
|
else {
|
|
@@ -8130,7 +8133,7 @@
|
|
|
8130
8133
|
state |= 2;
|
|
8131
8134
|
if (parser.getToken() === 21) {
|
|
8132
8135
|
nextToken(parser, context | 32);
|
|
8133
|
-
const { tokenStart, tokenValue } = parser;
|
|
8136
|
+
const { tokenStart, tokenValue, currentLocation } = parser;
|
|
8134
8137
|
const tokenAfterColon = parser.getToken();
|
|
8135
8138
|
if (parser.getToken() & 143360) {
|
|
8136
8139
|
value = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, inGroup, 1, tokenStart);
|
|
@@ -8151,7 +8154,7 @@
|
|
|
8151
8154
|
destructible |= 16;
|
|
8152
8155
|
}
|
|
8153
8156
|
else if ((tokenAfterColon & 143360) === 143360) {
|
|
8154
|
-
scope?.addVarOrBlock(context, tokenValue, kind, origin);
|
|
8157
|
+
scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
|
|
8155
8158
|
}
|
|
8156
8159
|
}
|
|
8157
8160
|
else {
|
|
@@ -8410,10 +8413,10 @@
|
|
|
8410
8413
|
const tokenAfterParenthesesStart = parser.tokenStart;
|
|
8411
8414
|
parser.assignable = 1;
|
|
8412
8415
|
while (parser.getToken() !== 16) {
|
|
8413
|
-
const { tokenStart } = parser;
|
|
8416
|
+
const { tokenStart, currentLocation } = parser;
|
|
8414
8417
|
const token = parser.getToken();
|
|
8415
8418
|
if (token & 143360) {
|
|
8416
|
-
scope?.addBlockName(context, parser.tokenValue, 1);
|
|
8419
|
+
scope?.addBlockName(context, parser.tokenValue, 1, tokenStart, currentLocation);
|
|
8417
8420
|
if ((token & 537079808) === 537079808) {
|
|
8418
8421
|
isNonSimpleParameterList = 1;
|
|
8419
8422
|
}
|
|
@@ -8570,8 +8573,7 @@
|
|
|
8570
8573
|
: expr;
|
|
8571
8574
|
}
|
|
8572
8575
|
function parseIdentifierOrArrow(parser, context, privateScope) {
|
|
8573
|
-
const { tokenStart
|
|
8574
|
-
const { tokenValue } = parser;
|
|
8576
|
+
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
8575
8577
|
let isNonSimpleParameterList = 0;
|
|
8576
8578
|
let hasStrictReserved = 0;
|
|
8577
8579
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
@@ -8583,12 +8585,14 @@
|
|
|
8583
8585
|
const expr = parseIdentifier(parser, context);
|
|
8584
8586
|
parser.assignable = 1;
|
|
8585
8587
|
if (parser.getToken() === 10) {
|
|
8586
|
-
const scope = parser.options.lexical
|
|
8588
|
+
const scope = parser.options.lexical
|
|
8589
|
+
? createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation)
|
|
8590
|
+
: undefined;
|
|
8587
8591
|
if (isNonSimpleParameterList)
|
|
8588
8592
|
parser.flags |= 128;
|
|
8589
8593
|
if (hasStrictReserved)
|
|
8590
8594
|
parser.flags |= 256;
|
|
8591
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], 0,
|
|
8595
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], 0, tokenStart);
|
|
8592
8596
|
}
|
|
8593
8597
|
return expr;
|
|
8594
8598
|
}
|
|
@@ -8598,7 +8602,9 @@
|
|
|
8598
8602
|
if (inNew)
|
|
8599
8603
|
parser.report(51);
|
|
8600
8604
|
parser.flags &= -129;
|
|
8601
|
-
const scope = parser.options.lexical
|
|
8605
|
+
const scope = parser.options.lexical
|
|
8606
|
+
? createArrowHeadParsingScope(parser, context, value, start, parser.currentLocation)
|
|
8607
|
+
: void 0;
|
|
8602
8608
|
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start, origin);
|
|
8603
8609
|
}
|
|
8604
8610
|
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start, origin = 0) {
|
|
@@ -8856,10 +8862,10 @@
|
|
|
8856
8862
|
(256 | 128);
|
|
8857
8863
|
const params = [];
|
|
8858
8864
|
while (parser.getToken() !== 16) {
|
|
8859
|
-
const { tokenStart } = parser;
|
|
8865
|
+
const { tokenStart, currentLocation } = parser;
|
|
8860
8866
|
const token = parser.getToken();
|
|
8861
8867
|
if (token & 143360) {
|
|
8862
|
-
scope?.addBlockName(context, parser.tokenValue, kind);
|
|
8868
|
+
scope?.addBlockName(context, parser.tokenValue, kind, tokenStart, currentLocation);
|
|
8863
8869
|
if ((token & 537079808) === 537079808) {
|
|
8864
8870
|
parser.flags |= 512;
|
|
8865
8871
|
}
|
|
@@ -9016,7 +9022,7 @@
|
|
|
9016
9022
|
consume(parser, context, 86094);
|
|
9017
9023
|
let id = null;
|
|
9018
9024
|
let superClass = null;
|
|
9019
|
-
const { tokenValue } = parser;
|
|
9025
|
+
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
9020
9026
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
9021
9027
|
if (isStrictReservedWord(parser, context, parser.getToken())) {
|
|
9022
9028
|
parser.report(120);
|
|
@@ -9025,7 +9031,7 @@
|
|
|
9025
9031
|
parser.report(121);
|
|
9026
9032
|
}
|
|
9027
9033
|
if (scope) {
|
|
9028
|
-
scope.addBlockName(context, tokenValue, 32);
|
|
9034
|
+
scope.addBlockName(context, tokenValue, 32, tokenStart, currentLocation);
|
|
9029
9035
|
if (flags) {
|
|
9030
9036
|
if (flags & 2) {
|
|
9031
9037
|
parser.declareUnboundVariable(tokenValue);
|
|
@@ -9428,13 +9434,13 @@
|
|
|
9428
9434
|
if (context & 2)
|
|
9429
9435
|
parser.report(112);
|
|
9430
9436
|
}
|
|
9431
|
-
const { tokenValue, tokenStart
|
|
9437
|
+
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
9432
9438
|
nextToken(parser, context);
|
|
9433
|
-
scope?.addVarOrBlock(context, tokenValue, kind, origin);
|
|
9439
|
+
scope?.addVarOrBlock(context, tokenValue, kind, tokenStart, currentLocation, origin);
|
|
9434
9440
|
return parser.finishNode({
|
|
9435
9441
|
type: 'Identifier',
|
|
9436
9442
|
name: tokenValue,
|
|
9437
|
-
},
|
|
9443
|
+
}, tokenStart);
|
|
9438
9444
|
}
|
|
9439
9445
|
function parseJSXRootElementOrFragment(parser, context, privateScope, inJSXChild, start) {
|
|
9440
9446
|
if (!inJSXChild)
|
|
@@ -9573,7 +9579,7 @@
|
|
|
9573
9579
|
const attributes = parseJSXAttributes(parser, context, privateScope);
|
|
9574
9580
|
const selfClosing = parser.getToken() === 8457014;
|
|
9575
9581
|
if (selfClosing)
|
|
9576
|
-
consume(parser, context, 8457014);
|
|
9582
|
+
consume(parser, context | 1048576, 8457014);
|
|
9577
9583
|
if (parser.getToken() !== 8390721) {
|
|
9578
9584
|
parser.report(25, KeywordDescTable[8390721 & 255]);
|
|
9579
9585
|
}
|
|
@@ -9724,7 +9730,7 @@
|
|
|
9724
9730
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
9725
9731
|
}
|
|
9726
9732
|
const { tokenValue } = parser;
|
|
9727
|
-
nextToken(parser, context);
|
|
9733
|
+
nextToken(parser, context | 1048576);
|
|
9728
9734
|
return parser.finishNode({
|
|
9729
9735
|
type: 'JSXIdentifier',
|
|
9730
9736
|
name: tokenValue,
|