meriyah 7.1.2 → 7.2.0
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 +16 -0
- package/README.md +0 -4
- package/dist/meriyah.cjs +370 -135
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +370 -135
- package/dist/meriyah.umd.js +370 -135
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/estree.d.ts +1 -1
- package/dist/types/token.d.ts +22 -21
- package/package.json +2 -1
package/dist/meriyah.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version$1 = "7.
|
|
1
|
+
var version$1 = "7.2.0";
|
|
2
2
|
var packageJson = {
|
|
3
3
|
version: version$1};
|
|
4
4
|
|
|
@@ -486,7 +486,7 @@ function convertTokenType(t) {
|
|
|
486
486
|
return 'RegularExpression';
|
|
487
487
|
case 67174408:
|
|
488
488
|
case 67174409:
|
|
489
|
-
case
|
|
489
|
+
case 132:
|
|
490
490
|
return 'TemplateLiteral';
|
|
491
491
|
default:
|
|
492
492
|
if ((t & 143360) === 143360)
|
|
@@ -794,7 +794,7 @@ class ParseError extends SyntaxError {
|
|
|
794
794
|
loc;
|
|
795
795
|
description;
|
|
796
796
|
constructor(start, end, type, ...params) {
|
|
797
|
-
const description = errorMessages[type].
|
|
797
|
+
const description = errorMessages[type].replaceAll(/%(\d+)/g, (_, i) => params[i]);
|
|
798
798
|
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
799
799
|
super(message);
|
|
800
800
|
this.start = start.index;
|
|
@@ -829,7 +829,7 @@ const KeywordDescTable = [
|
|
|
829
829
|
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
830
830
|
'this', 'throw', 'try', 'while', 'with',
|
|
831
831
|
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
832
|
-
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
832
|
+
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of', 'using',
|
|
833
833
|
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
834
834
|
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
835
835
|
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
@@ -876,6 +876,7 @@ const descKeywordTable = {
|
|
|
876
876
|
let: 241737,
|
|
877
877
|
null: 86023,
|
|
878
878
|
of: 471156,
|
|
879
|
+
using: 209013,
|
|
879
880
|
package: 36966,
|
|
880
881
|
private: 36967,
|
|
881
882
|
protected: 36968,
|
|
@@ -886,12 +887,12 @@ const descKeywordTable = {
|
|
|
886
887
|
true: 86022,
|
|
887
888
|
with: 20579,
|
|
888
889
|
yield: 241771,
|
|
889
|
-
enum:
|
|
890
|
-
eval:
|
|
890
|
+
enum: 86134,
|
|
891
|
+
eval: 537079927,
|
|
891
892
|
as: 77932,
|
|
892
|
-
arguments:
|
|
893
|
-
target:
|
|
894
|
-
meta:
|
|
893
|
+
arguments: 537079928,
|
|
894
|
+
target: 209030,
|
|
895
|
+
meta: 209031,
|
|
895
896
|
accessor: 12402,
|
|
896
897
|
};
|
|
897
898
|
|
|
@@ -953,24 +954,24 @@ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
|
953
954
|
if ((context & (2 | 2048)) === 0) {
|
|
954
955
|
return token | -2147483648;
|
|
955
956
|
}
|
|
956
|
-
return -
|
|
957
|
+
return -2147483527;
|
|
957
958
|
}
|
|
958
959
|
if (context & 1) {
|
|
959
960
|
if (token === 36970) {
|
|
960
|
-
return -
|
|
961
|
+
return -2147483526;
|
|
961
962
|
}
|
|
962
963
|
if ((token & 36864) === 36864) {
|
|
963
|
-
return -
|
|
964
|
+
return -2147483526;
|
|
964
965
|
}
|
|
965
966
|
if ((token & 20480) === 20480) {
|
|
966
967
|
if (context & 262144 && (context & 8) === 0) {
|
|
967
968
|
return token | -2147483648;
|
|
968
969
|
}
|
|
969
970
|
else {
|
|
970
|
-
return -
|
|
971
|
+
return -2147483527;
|
|
971
972
|
}
|
|
972
973
|
}
|
|
973
|
-
return
|
|
974
|
+
return 209019 | -2147483648;
|
|
974
975
|
}
|
|
975
976
|
if (context & 262144 &&
|
|
976
977
|
(context & 8) === 0 &&
|
|
@@ -979,31 +980,31 @@ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
|
979
980
|
}
|
|
980
981
|
if (token === 241771) {
|
|
981
982
|
return context & 262144
|
|
982
|
-
?
|
|
983
|
+
? 209019 | -2147483648
|
|
983
984
|
: context & 1024
|
|
984
|
-
? -
|
|
985
|
+
? -2147483527
|
|
985
986
|
: token | -2147483648;
|
|
986
987
|
}
|
|
987
988
|
if (token === 209005) {
|
|
988
|
-
return
|
|
989
|
+
return 209019 | -2147483648;
|
|
989
990
|
}
|
|
990
991
|
if ((token & 36864) === 36864) {
|
|
991
992
|
return token | 12288 | -2147483648;
|
|
992
993
|
}
|
|
993
|
-
return -
|
|
994
|
+
return -2147483527;
|
|
994
995
|
}
|
|
995
996
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
996
997
|
}
|
|
997
998
|
function scanPrivateIdentifier(parser) {
|
|
998
999
|
let char = advanceChar(parser);
|
|
999
1000
|
if (char === 92)
|
|
1000
|
-
return
|
|
1001
|
+
return 131;
|
|
1001
1002
|
const merged = consumePossibleSurrogatePair(parser);
|
|
1002
1003
|
if (merged)
|
|
1003
1004
|
char = merged;
|
|
1004
1005
|
if (!isIdentifierStart(char))
|
|
1005
1006
|
parser.report(96);
|
|
1006
|
-
return
|
|
1007
|
+
return 131;
|
|
1007
1008
|
}
|
|
1008
1009
|
function scanIdentifierUnicodeEscape(parser) {
|
|
1009
1010
|
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
@@ -1209,7 +1210,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1209
1210
|
if (isBigInt) {
|
|
1210
1211
|
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1211
1212
|
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1212
|
-
return
|
|
1213
|
+
return 134283389;
|
|
1213
1214
|
}
|
|
1214
1215
|
parser.tokenValue =
|
|
1215
1216
|
kind & (1 | 2 | 8 | 4)
|
|
@@ -1578,6 +1579,7 @@ function scanTemplate(parser, context) {
|
|
|
1578
1579
|
const { index: start } = parser;
|
|
1579
1580
|
let token = 67174409;
|
|
1580
1581
|
let ret = '';
|
|
1582
|
+
let hasCarriageReturn = false;
|
|
1581
1583
|
let char = advanceChar(parser);
|
|
1582
1584
|
while (char !== 96) {
|
|
1583
1585
|
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
@@ -1587,6 +1589,8 @@ function scanTemplate(parser, context) {
|
|
|
1587
1589
|
}
|
|
1588
1590
|
else if (char === 92) {
|
|
1589
1591
|
char = advanceChar(parser);
|
|
1592
|
+
if (char === 13)
|
|
1593
|
+
hasCarriageReturn = true;
|
|
1590
1594
|
if (char > 0x7e) {
|
|
1591
1595
|
ret += String.fromCodePoint(char);
|
|
1592
1596
|
}
|
|
@@ -1601,7 +1605,9 @@ function scanTemplate(parser, context) {
|
|
|
1601
1605
|
parser.line = line;
|
|
1602
1606
|
parser.column = column;
|
|
1603
1607
|
ret = null;
|
|
1604
|
-
char = scanBadTemplate(parser, char)
|
|
1608
|
+
char = scanBadTemplate(parser, char, () => {
|
|
1609
|
+
hasCarriageReturn = true;
|
|
1610
|
+
});
|
|
1605
1611
|
if (char < 0)
|
|
1606
1612
|
token = 67174408;
|
|
1607
1613
|
break;
|
|
@@ -1612,10 +1618,13 @@ function scanTemplate(parser, context) {
|
|
|
1612
1618
|
}
|
|
1613
1619
|
}
|
|
1614
1620
|
else if (parser.index < parser.end) {
|
|
1615
|
-
if (char === 13
|
|
1616
|
-
|
|
1621
|
+
if (char === 13)
|
|
1622
|
+
hasCarriageReturn = true;
|
|
1623
|
+
if (char === 13 && parser.source.charCodeAt(parser.index + 1) === 10) {
|
|
1617
1624
|
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
1618
1625
|
}
|
|
1626
|
+
if (char === 13)
|
|
1627
|
+
char = 10;
|
|
1619
1628
|
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
1620
1629
|
parser.column = -1;
|
|
1621
1630
|
parser.line++;
|
|
@@ -1628,12 +1637,16 @@ function scanTemplate(parser, context) {
|
|
|
1628
1637
|
}
|
|
1629
1638
|
advanceChar(parser);
|
|
1630
1639
|
parser.tokenValue = ret;
|
|
1631
|
-
|
|
1640
|
+
const tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
1641
|
+
parser.tokenRaw = hasCarriageReturn ? tokenRaw.replaceAll(/\r\n?/g, '\n') : tokenRaw;
|
|
1632
1642
|
return token;
|
|
1633
1643
|
}
|
|
1634
|
-
function scanBadTemplate(parser, ch) {
|
|
1644
|
+
function scanBadTemplate(parser, ch, onCarriageReturn) {
|
|
1635
1645
|
while (ch !== 96) {
|
|
1636
1646
|
switch (ch) {
|
|
1647
|
+
case 13:
|
|
1648
|
+
onCarriageReturn();
|
|
1649
|
+
break;
|
|
1637
1650
|
case 36: {
|
|
1638
1651
|
const index = parser.index + 1;
|
|
1639
1652
|
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
@@ -1664,42 +1677,42 @@ function scanTemplateTail(parser, context) {
|
|
|
1664
1677
|
}
|
|
1665
1678
|
|
|
1666
1679
|
const TokenLookup = [
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
128,
|
|
1676
|
-
127,
|
|
1677
|
-
135,
|
|
1678
|
-
127,
|
|
1679
|
-
127,
|
|
1680
|
+
129,
|
|
1681
|
+
129,
|
|
1682
|
+
129,
|
|
1683
|
+
129,
|
|
1684
|
+
129,
|
|
1685
|
+
129,
|
|
1686
|
+
129,
|
|
1687
|
+
129,
|
|
1680
1688
|
129,
|
|
1681
1689
|
128,
|
|
1690
|
+
136,
|
|
1682
1691
|
128,
|
|
1683
1692
|
128,
|
|
1693
|
+
130,
|
|
1694
|
+
129,
|
|
1695
|
+
129,
|
|
1696
|
+
129,
|
|
1697
|
+
129,
|
|
1698
|
+
129,
|
|
1699
|
+
129,
|
|
1700
|
+
129,
|
|
1701
|
+
129,
|
|
1702
|
+
129,
|
|
1703
|
+
129,
|
|
1704
|
+
129,
|
|
1705
|
+
129,
|
|
1706
|
+
129,
|
|
1707
|
+
129,
|
|
1708
|
+
129,
|
|
1709
|
+
129,
|
|
1710
|
+
129,
|
|
1711
|
+
129,
|
|
1684
1712
|
128,
|
|
1685
|
-
128,
|
|
1686
|
-
128,
|
|
1687
|
-
128,
|
|
1688
|
-
128,
|
|
1689
|
-
128,
|
|
1690
|
-
128,
|
|
1691
|
-
128,
|
|
1692
|
-
128,
|
|
1693
|
-
128,
|
|
1694
|
-
128,
|
|
1695
|
-
128,
|
|
1696
|
-
128,
|
|
1697
|
-
128,
|
|
1698
|
-
128,
|
|
1699
|
-
127,
|
|
1700
1713
|
16842798,
|
|
1701
1714
|
134283267,
|
|
1702
|
-
|
|
1715
|
+
131,
|
|
1703
1716
|
208897,
|
|
1704
1717
|
8391477,
|
|
1705
1718
|
8390213,
|
|
@@ -1728,7 +1741,7 @@ const TokenLookup = [
|
|
|
1728
1741
|
1077936155,
|
|
1729
1742
|
8390721,
|
|
1730
1743
|
22,
|
|
1731
|
-
|
|
1744
|
+
133,
|
|
1732
1745
|
208897,
|
|
1733
1746
|
208897,
|
|
1734
1747
|
208897,
|
|
@@ -1756,11 +1769,11 @@ const TokenLookup = [
|
|
|
1756
1769
|
208897,
|
|
1757
1770
|
208897,
|
|
1758
1771
|
69271571,
|
|
1759
|
-
|
|
1772
|
+
137,
|
|
1760
1773
|
20,
|
|
1761
1774
|
8389959,
|
|
1762
1775
|
208897,
|
|
1763
|
-
|
|
1776
|
+
132,
|
|
1764
1777
|
4096,
|
|
1765
1778
|
4096,
|
|
1766
1779
|
4096,
|
|
@@ -1791,7 +1804,7 @@ const TokenLookup = [
|
|
|
1791
1804
|
8389702,
|
|
1792
1805
|
1074790415,
|
|
1793
1806
|
16842799,
|
|
1794
|
-
|
|
1807
|
+
129,
|
|
1795
1808
|
];
|
|
1796
1809
|
function nextToken(parser, context) {
|
|
1797
1810
|
parser.flags = (parser.flags | 1) ^ 1;
|
|
@@ -1821,8 +1834,8 @@ function scanSingleToken(parser, context, state) {
|
|
|
1821
1834
|
case 1074790417:
|
|
1822
1835
|
case 18:
|
|
1823
1836
|
case 16842799:
|
|
1824
|
-
case
|
|
1825
|
-
case
|
|
1837
|
+
case 133:
|
|
1838
|
+
case 129:
|
|
1826
1839
|
advanceChar(parser);
|
|
1827
1840
|
return token;
|
|
1828
1841
|
case 208897:
|
|
@@ -1833,20 +1846,20 @@ function scanSingleToken(parser, context, state) {
|
|
|
1833
1846
|
return scanNumber(parser, context, 16 | 128);
|
|
1834
1847
|
case 134283267:
|
|
1835
1848
|
return scanString(parser, context, char);
|
|
1836
|
-
case
|
|
1849
|
+
case 132:
|
|
1837
1850
|
return scanTemplate(parser, context);
|
|
1838
|
-
case
|
|
1851
|
+
case 137:
|
|
1839
1852
|
return scanUnicodeIdentifier(parser, context);
|
|
1840
|
-
case
|
|
1853
|
+
case 131:
|
|
1841
1854
|
return scanPrivateIdentifier(parser);
|
|
1842
|
-
case
|
|
1855
|
+
case 128:
|
|
1843
1856
|
advanceChar(parser);
|
|
1844
1857
|
break;
|
|
1845
|
-
case
|
|
1858
|
+
case 130:
|
|
1846
1859
|
state |= 1 | 4;
|
|
1847
1860
|
scanNewLine(parser);
|
|
1848
1861
|
break;
|
|
1849
|
-
case
|
|
1862
|
+
case 136:
|
|
1850
1863
|
consumeLineFeed(parser, state);
|
|
1851
1864
|
state = (state & -5) | 1;
|
|
1852
1865
|
break;
|
|
@@ -2069,7 +2082,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2069
2082
|
advanceChar(parser);
|
|
2070
2083
|
return 4718634;
|
|
2071
2084
|
}
|
|
2072
|
-
return
|
|
2085
|
+
return 276824446;
|
|
2073
2086
|
}
|
|
2074
2087
|
if (ch === 46) {
|
|
2075
2088
|
const index = parser.index + 1;
|
|
@@ -2077,7 +2090,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2077
2090
|
ch = source.charCodeAt(index);
|
|
2078
2091
|
if (!(ch >= 48 && ch <= 57)) {
|
|
2079
2092
|
advanceChar(parser);
|
|
2080
|
-
return
|
|
2093
|
+
return 67108991;
|
|
2081
2094
|
}
|
|
2082
2095
|
}
|
|
2083
2096
|
}
|
|
@@ -2185,7 +2198,7 @@ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
|
2185
2198
|
parser.report(119);
|
|
2186
2199
|
}
|
|
2187
2200
|
}
|
|
2188
|
-
if ((t & 20480) === 20480 || t === -
|
|
2201
|
+
if ((t & 20480) === 20480 || t === -2147483527) {
|
|
2189
2202
|
parser.report(102);
|
|
2190
2203
|
}
|
|
2191
2204
|
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
@@ -2206,10 +2219,10 @@ function validateFunctionName(parser, context, t) {
|
|
|
2206
2219
|
if ((t & 537079808) === 537079808) {
|
|
2207
2220
|
parser.report(119);
|
|
2208
2221
|
}
|
|
2209
|
-
if (t === -
|
|
2222
|
+
if (t === -2147483526) {
|
|
2210
2223
|
parser.report(95);
|
|
2211
2224
|
}
|
|
2212
|
-
if (t === -
|
|
2225
|
+
if (t === -2147483527) {
|
|
2213
2226
|
parser.report(95);
|
|
2214
2227
|
}
|
|
2215
2228
|
}
|
|
@@ -2233,7 +2246,7 @@ function isStrictReservedWord(parser, context, t) {
|
|
|
2233
2246
|
parser.report(97, 'yield');
|
|
2234
2247
|
return ((t & 20480) === 20480 ||
|
|
2235
2248
|
(t & 36864) === 36864 ||
|
|
2236
|
-
t == -
|
|
2249
|
+
t == -2147483526);
|
|
2237
2250
|
}
|
|
2238
2251
|
function isPropertyWithPrivateFieldKey(expr) {
|
|
2239
2252
|
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
@@ -4448,7 +4461,7 @@ const decodeMap = {
|
|
|
4448
4461
|
'159': 376,
|
|
4449
4462
|
};
|
|
4450
4463
|
function decodeHTMLStrict(text) {
|
|
4451
|
-
return text.
|
|
4464
|
+
return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
|
|
4452
4465
|
if (key.charAt(1) === '#') {
|
|
4453
4466
|
const secondChar = key.charAt(2);
|
|
4454
4467
|
const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
|
|
@@ -4531,7 +4544,7 @@ function nextJSXToken(parser) {
|
|
|
4531
4544
|
if (parser.options.raw)
|
|
4532
4545
|
parser.tokenRaw = raw;
|
|
4533
4546
|
parser.tokenValue = decodeHTMLStrict(raw);
|
|
4534
|
-
parser.setToken(
|
|
4547
|
+
parser.setToken(138);
|
|
4535
4548
|
}
|
|
4536
4549
|
function rescanJSXIdentifier(parser) {
|
|
4537
4550
|
if ((parser.getToken() & 143360) === 143360) {
|
|
@@ -4992,7 +5005,7 @@ function parseModuleItemList(parser, context, scope) {
|
|
|
4992
5005
|
return statements;
|
|
4993
5006
|
}
|
|
4994
5007
|
function parseModuleItem(parser, context, scope) {
|
|
4995
|
-
if (parser.getToken() ===
|
|
5008
|
+
if (parser.getToken() === 133) {
|
|
4996
5009
|
Object.assign(parser.leadingDecorators, {
|
|
4997
5010
|
start: parser.tokenStart,
|
|
4998
5011
|
decorators: parseDecorators(parser, context, undefined),
|
|
@@ -5019,13 +5032,21 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
5019
5032
|
switch (parser.getToken()) {
|
|
5020
5033
|
case 86104:
|
|
5021
5034
|
return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 0, start);
|
|
5022
|
-
case
|
|
5035
|
+
case 133:
|
|
5023
5036
|
case 86094:
|
|
5024
5037
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5025
5038
|
case 86090:
|
|
5026
5039
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, 0);
|
|
5027
5040
|
case 241737:
|
|
5028
5041
|
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
5042
|
+
case 209013:
|
|
5043
|
+
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels);
|
|
5044
|
+
case 209006:
|
|
5045
|
+
if ((context & 2048 || (context & 2 && context & 8)) &&
|
|
5046
|
+
nextTokenIsUsingOnSameLine(parser)) {
|
|
5047
|
+
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels);
|
|
5048
|
+
}
|
|
5049
|
+
return parseStatement(parser, context, scope, privateScope, origin, labels, 1);
|
|
5029
5050
|
case 20564:
|
|
5030
5051
|
parser.report(103, 'export');
|
|
5031
5052
|
case 86106:
|
|
@@ -5109,15 +5130,18 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
|
|
|
5109
5130
|
default:
|
|
5110
5131
|
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart);
|
|
5111
5132
|
}
|
|
5133
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, allowFuncDecl, expr, token, tokenValue, tokenStart);
|
|
5134
|
+
}
|
|
5135
|
+
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, allowFuncDecl, initialExpression, token, tokenValue, tokenStart) {
|
|
5112
5136
|
if (token & 143360 && parser.getToken() === 21) {
|
|
5113
|
-
return parseLabelledStatement(parser, context, scope, privateScope, origin, labels, tokenValue,
|
|
5137
|
+
return parseLabelledStatement(parser, context, scope, privateScope, origin, labels, tokenValue, initialExpression, token, allowFuncDecl, tokenStart);
|
|
5114
5138
|
}
|
|
5115
|
-
|
|
5116
|
-
|
|
5139
|
+
let expression = parseMemberOrUpdateExpression(parser, context, privateScope, initialExpression, 0, 0, tokenStart);
|
|
5140
|
+
expression = parseAssignmentExpression(parser, context, privateScope, 0, 0, tokenStart, expression);
|
|
5117
5141
|
if (parser.getToken() === 18) {
|
|
5118
|
-
|
|
5142
|
+
expression = parseSequenceExpression(parser, context, privateScope, 0, tokenStart, expression);
|
|
5119
5143
|
}
|
|
5120
|
-
return parseExpressionStatement(parser, context,
|
|
5144
|
+
return parseExpressionStatement(parser, context, expression, tokenStart);
|
|
5121
5145
|
}
|
|
5122
5146
|
function parseBlock(parser, context, scope, privateScope, labels, start = parser.tokenStart, type = 'BlockStatement') {
|
|
5123
5147
|
const body = [];
|
|
@@ -5306,9 +5330,14 @@ function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
|
5306
5330
|
while (parser.getToken() !== 20556 &&
|
|
5307
5331
|
parser.getToken() !== 1074790415 &&
|
|
5308
5332
|
parser.getToken() !== 20561) {
|
|
5309
|
-
|
|
5333
|
+
const statement = parseStatementListItem(parser, context | 4, scope, privateScope, 2, {
|
|
5310
5334
|
$: labels,
|
|
5311
|
-
})
|
|
5335
|
+
});
|
|
5336
|
+
if (statement.type === 'VariableDeclaration' &&
|
|
5337
|
+
(statement.kind === 'using' || statement.kind === 'await using')) {
|
|
5338
|
+
parser.report(30, statement.kind);
|
|
5339
|
+
}
|
|
5340
|
+
consequent.push(statement);
|
|
5312
5341
|
}
|
|
5313
5342
|
cases.push(parser.finishNode({
|
|
5314
5343
|
type: 'SwitchCase',
|
|
@@ -5510,14 +5539,90 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
5510
5539
|
}
|
|
5511
5540
|
return parseExpressionStatement(parser, context, expr, tokenStart);
|
|
5512
5541
|
}
|
|
5513
|
-
function
|
|
5542
|
+
function nextTokenIsUsingOnSameLine(parser) {
|
|
5543
|
+
const { index: parserIndex, source } = parser;
|
|
5544
|
+
let index = parserIndex;
|
|
5545
|
+
while (index < parser.end) {
|
|
5546
|
+
const char = source.charCodeAt(index);
|
|
5547
|
+
if (char === 0x0a || char === 0x0d || char === 0x2028 || char === 0x2029)
|
|
5548
|
+
return false;
|
|
5549
|
+
if (/\s/u.test(source[index])) {
|
|
5550
|
+
index++;
|
|
5551
|
+
continue;
|
|
5552
|
+
}
|
|
5553
|
+
if (char === 0x2f && source.charCodeAt(index + 1) === 0x2a) {
|
|
5554
|
+
index += 2;
|
|
5555
|
+
while (index < parser.end) {
|
|
5556
|
+
const commentChar = source.charCodeAt(index);
|
|
5557
|
+
if (commentChar === 0x0a || commentChar === 0x0d || commentChar === 0x2028 || commentChar === 0x2029) {
|
|
5558
|
+
return false;
|
|
5559
|
+
}
|
|
5560
|
+
if (commentChar === 0x2a && source.charCodeAt(index + 1) === 0x2f) {
|
|
5561
|
+
index += 2;
|
|
5562
|
+
break;
|
|
5563
|
+
}
|
|
5564
|
+
index++;
|
|
5565
|
+
}
|
|
5566
|
+
continue;
|
|
5567
|
+
}
|
|
5568
|
+
break;
|
|
5569
|
+
}
|
|
5570
|
+
if (source.slice(index, index + 5) !== 'using')
|
|
5571
|
+
return false;
|
|
5572
|
+
const following = source.codePointAt(index + 5);
|
|
5573
|
+
return following === undefined || (following !== 0x5c && !isIdentifierPart(following));
|
|
5574
|
+
}
|
|
5575
|
+
function isResourceBindingStart(token) {
|
|
5576
|
+
return (token & 143360) === 143360 && (token & 20480) !== 20480;
|
|
5577
|
+
}
|
|
5578
|
+
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5579
|
+
const { tokenStart, tokenValue } = parser;
|
|
5580
|
+
const token = parser.getToken();
|
|
5581
|
+
const expression = parseIdentifier(parser, context);
|
|
5582
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5583
|
+
if (origin & 4 && context & 8 && (context & 2) === 0) {
|
|
5584
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5585
|
+
}
|
|
5586
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'using', tokenStart, 1);
|
|
5587
|
+
}
|
|
5588
|
+
parser.assignable = 1;
|
|
5589
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, 1, expression, token, tokenValue, tokenStart);
|
|
5590
|
+
}
|
|
5591
|
+
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5514
5592
|
const start = parser.tokenStart;
|
|
5515
|
-
|
|
5516
|
-
|
|
5593
|
+
if (context & 524288)
|
|
5594
|
+
parser.report(177);
|
|
5595
|
+
nextToken(parser, context | 32);
|
|
5596
|
+
let argument;
|
|
5597
|
+
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
5598
|
+
const usingStart = parser.tokenStart;
|
|
5599
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5600
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5601
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'await using', start, 1);
|
|
5602
|
+
}
|
|
5603
|
+
argument = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, usingStart);
|
|
5604
|
+
}
|
|
5605
|
+
else {
|
|
5606
|
+
argument = parseLeftHandSideExpression(parser, context, privateScope, 0, 0, 1);
|
|
5607
|
+
}
|
|
5608
|
+
if (parser.getToken() === 8391735)
|
|
5609
|
+
parser.report(33);
|
|
5610
|
+
parser.assignable = 2;
|
|
5611
|
+
const expression = parser.finishNode({
|
|
5612
|
+
type: 'AwaitExpression',
|
|
5613
|
+
argument,
|
|
5614
|
+
}, start);
|
|
5615
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, 0, expression, 1048576, '', start);
|
|
5616
|
+
}
|
|
5617
|
+
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5618
|
+
const start = declarationStart;
|
|
5619
|
+
if (!keywordConsumed)
|
|
5620
|
+
nextToken(parser, context);
|
|
5621
|
+
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5517
5622
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5518
5623
|
return parser.finishNode({
|
|
5519
5624
|
type: 'VariableDeclaration',
|
|
5520
|
-
kind: kind & 8 ? 'let' : 'const',
|
|
5625
|
+
kind: declarationKind ?? (kind & 8 ? 'let' : 'const'),
|
|
5521
5626
|
declarations,
|
|
5522
5627
|
}, start);
|
|
5523
5628
|
}
|
|
@@ -5532,24 +5637,34 @@ function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
|
5532
5637
|
declarations,
|
|
5533
5638
|
}, start);
|
|
5534
5639
|
}
|
|
5535
|
-
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin) {
|
|
5640
|
+
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5536
5641
|
let bindingCount = 1;
|
|
5537
|
-
const
|
|
5538
|
-
|
|
5539
|
-
];
|
|
5642
|
+
const firstDeclaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5643
|
+
const list = [firstDeclaration];
|
|
5644
|
+
const resourceNames = declarationKind && parser.options.lexical ? new Set([firstDeclaration.id.name]) : undefined;
|
|
5540
5645
|
while (consumeOpt(parser, context, 18)) {
|
|
5541
5646
|
bindingCount++;
|
|
5542
|
-
|
|
5647
|
+
const declaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5648
|
+
if (resourceNames) {
|
|
5649
|
+
const { name } = declaration.id;
|
|
5650
|
+
if (resourceNames.has(name))
|
|
5651
|
+
parser.report(145, name);
|
|
5652
|
+
resourceNames.add(name);
|
|
5653
|
+
}
|
|
5654
|
+
list.push(declaration);
|
|
5543
5655
|
}
|
|
5544
5656
|
if (bindingCount > 1 && origin & 32 && parser.getToken() & 262144) {
|
|
5545
5657
|
parser.report(61, KeywordDescTable[parser.getToken() & 255]);
|
|
5546
5658
|
}
|
|
5547
5659
|
return list;
|
|
5548
5660
|
}
|
|
5549
|
-
function parseVariableDeclaration(parser, context, scope, privateScope, kind, origin) {
|
|
5661
|
+
function parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5550
5662
|
const { tokenStart } = parser;
|
|
5551
5663
|
const token = parser.getToken();
|
|
5552
5664
|
let init = null;
|
|
5665
|
+
if (declarationKind && (token & 2097152) === 2097152) {
|
|
5666
|
+
parser.report(50);
|
|
5667
|
+
}
|
|
5553
5668
|
const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
|
|
5554
5669
|
if (parser.getToken() === 1077936155) {
|
|
5555
5670
|
nextToken(parser, context | 32);
|
|
@@ -5564,7 +5679,7 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
5564
5679
|
}
|
|
5565
5680
|
else if ((kind & 16 || (token & 2097152) > 0) &&
|
|
5566
5681
|
(parser.getToken() & 262144) !== 262144) {
|
|
5567
|
-
parser.report(59, kind & 16 ? 'const' : 'destructuring');
|
|
5682
|
+
parser.report(59, declarationKind ?? (kind & 16 ? 'const' : 'destructuring'));
|
|
5568
5683
|
}
|
|
5569
5684
|
return parser.finishNode({
|
|
5570
5685
|
type: 'VariableDeclarator',
|
|
@@ -5585,7 +5700,10 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5585
5700
|
let init = null;
|
|
5586
5701
|
let isVarDecl = parser.getToken() === 86088 ||
|
|
5587
5702
|
parser.getToken() === 241737 ||
|
|
5588
|
-
parser.getToken() === 86090
|
|
5703
|
+
parser.getToken() === 86090 ||
|
|
5704
|
+
parser.getToken() === 209013;
|
|
5705
|
+
let resourceDeclarationKind;
|
|
5706
|
+
let consumedForOfDelimiter = false;
|
|
5589
5707
|
let right;
|
|
5590
5708
|
const { tokenStart } = parser;
|
|
5591
5709
|
const token = parser.getToken();
|
|
@@ -5612,6 +5730,81 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5612
5730
|
parser.report(115);
|
|
5613
5731
|
}
|
|
5614
5732
|
}
|
|
5733
|
+
else if (token === 209013) {
|
|
5734
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5735
|
+
if ((parser.flags & 1) !== 0 || !isResourceBindingStart(parser.getToken())) {
|
|
5736
|
+
isVarDecl = false;
|
|
5737
|
+
parser.assignable = 1;
|
|
5738
|
+
init = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, tokenStart);
|
|
5739
|
+
}
|
|
5740
|
+
else if (parser.getToken() === 471156) {
|
|
5741
|
+
const ofStart = parser.tokenStart;
|
|
5742
|
+
const ofToken = parser.getToken();
|
|
5743
|
+
const ofValue = parser.tokenValue;
|
|
5744
|
+
const ofIdentifier = parseIdentifier(parser, context);
|
|
5745
|
+
if (parser.getToken() !== 1077936155 &&
|
|
5746
|
+
parser.getToken() !== 8673330 &&
|
|
5747
|
+
parser.getToken() !== 1074790417 &&
|
|
5748
|
+
parser.getToken() !== 18) {
|
|
5749
|
+
isVarDecl = false;
|
|
5750
|
+
consumedForOfDelimiter = true;
|
|
5751
|
+
parser.assignable = 1;
|
|
5752
|
+
init = usingIdentifier;
|
|
5753
|
+
}
|
|
5754
|
+
else {
|
|
5755
|
+
resourceDeclarationKind = 'using';
|
|
5756
|
+
validateBindingIdentifier(parser, context, 16, ofToken, 0);
|
|
5757
|
+
scope?.addBlockName(context, ofValue, 16, 32);
|
|
5758
|
+
let declarationInitializer = null;
|
|
5759
|
+
if (parser.getToken() === 1077936155) {
|
|
5760
|
+
nextToken(parser, context | 32);
|
|
5761
|
+
declarationInitializer = parseExpression(parser, context | 131072, privateScope, 1, 0, parser.tokenStart);
|
|
5762
|
+
if ((parser.getToken() & 262144) === 262144) {
|
|
5763
|
+
throw new ParseError(ofStart, parser.currentLocation, 60, parser.getToken() === 471156 ? 'of' : 'in');
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
else if (parser.getToken() !== 8673330) {
|
|
5767
|
+
parser.report(59, resourceDeclarationKind);
|
|
5768
|
+
}
|
|
5769
|
+
const declarations = [
|
|
5770
|
+
parser.finishNode({
|
|
5771
|
+
type: 'VariableDeclarator',
|
|
5772
|
+
id: ofIdentifier,
|
|
5773
|
+
init: declarationInitializer,
|
|
5774
|
+
}, ofStart),
|
|
5775
|
+
];
|
|
5776
|
+
const resourceNames = parser.options.lexical ? new Set([ofValue]) : undefined;
|
|
5777
|
+
while (consumeOpt(parser, context | 131072, 18)) {
|
|
5778
|
+
const declaration = parseVariableDeclaration(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind);
|
|
5779
|
+
if (resourceNames) {
|
|
5780
|
+
const { name } = declaration.id;
|
|
5781
|
+
if (resourceNames.has(name))
|
|
5782
|
+
parser.report(145, name);
|
|
5783
|
+
resourceNames.add(name);
|
|
5784
|
+
}
|
|
5785
|
+
declarations.push(declaration);
|
|
5786
|
+
}
|
|
5787
|
+
if (declarations.length > 1 && parser.getToken() & 262144) {
|
|
5788
|
+
parser.report(61, KeywordDescTable[parser.getToken() & 255]);
|
|
5789
|
+
}
|
|
5790
|
+
init = parser.finishNode({
|
|
5791
|
+
type: 'VariableDeclaration',
|
|
5792
|
+
kind: resourceDeclarationKind,
|
|
5793
|
+
declarations,
|
|
5794
|
+
}, tokenStart);
|
|
5795
|
+
parser.assignable = 1;
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
else {
|
|
5799
|
+
resourceDeclarationKind = 'using';
|
|
5800
|
+
init = parser.finishNode({
|
|
5801
|
+
type: 'VariableDeclaration',
|
|
5802
|
+
kind: resourceDeclarationKind,
|
|
5803
|
+
declarations: parseVariableDeclarationList(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind),
|
|
5804
|
+
}, tokenStart);
|
|
5805
|
+
parser.assignable = 1;
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5615
5808
|
else {
|
|
5616
5809
|
nextToken(parser, context);
|
|
5617
5810
|
init = parser.finishNode(token === 86088
|
|
@@ -5628,6 +5821,42 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5628
5821
|
parser.assignable = 1;
|
|
5629
5822
|
}
|
|
5630
5823
|
}
|
|
5824
|
+
else if (token === 209006 &&
|
|
5825
|
+
(context & 2048 || (context & 2 && context & 8))) {
|
|
5826
|
+
if (context & 524288)
|
|
5827
|
+
parser.report(177);
|
|
5828
|
+
nextToken(parser, context | 32);
|
|
5829
|
+
let awaitArgument;
|
|
5830
|
+
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
5831
|
+
const usingStart = parser.tokenStart;
|
|
5832
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5833
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5834
|
+
resourceDeclarationKind = 'await using';
|
|
5835
|
+
isVarDecl = true;
|
|
5836
|
+
init = parser.finishNode({
|
|
5837
|
+
type: 'VariableDeclaration',
|
|
5838
|
+
kind: resourceDeclarationKind,
|
|
5839
|
+
declarations: parseVariableDeclarationList(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind),
|
|
5840
|
+
}, tokenStart);
|
|
5841
|
+
parser.assignable = 1;
|
|
5842
|
+
}
|
|
5843
|
+
else {
|
|
5844
|
+
awaitArgument = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, usingStart);
|
|
5845
|
+
}
|
|
5846
|
+
}
|
|
5847
|
+
else {
|
|
5848
|
+
awaitArgument = parseLeftHandSideExpression(parser, context, privateScope, 0, 0, 1);
|
|
5849
|
+
}
|
|
5850
|
+
if (!isVarDecl) {
|
|
5851
|
+
if (parser.getToken() === 8391735)
|
|
5852
|
+
parser.report(33);
|
|
5853
|
+
parser.assignable = 2;
|
|
5854
|
+
init = parser.finishNode({
|
|
5855
|
+
type: 'AwaitExpression',
|
|
5856
|
+
argument: awaitArgument,
|
|
5857
|
+
}, tokenStart);
|
|
5858
|
+
}
|
|
5859
|
+
}
|
|
5631
5860
|
else if (token === 1074790417) {
|
|
5632
5861
|
if (forAwait)
|
|
5633
5862
|
parser.report(82);
|
|
@@ -5649,12 +5878,13 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5649
5878
|
else {
|
|
5650
5879
|
init = parseLeftHandSideExpression(parser, context | 131072, privateScope, 1, 0, 1);
|
|
5651
5880
|
}
|
|
5652
|
-
if ((parser.getToken() & 262144) === 262144) {
|
|
5653
|
-
if (parser.getToken() === 471156) {
|
|
5881
|
+
if (consumedForOfDelimiter || (parser.getToken() & 262144) === 262144) {
|
|
5882
|
+
if (consumedForOfDelimiter || parser.getToken() === 471156) {
|
|
5654
5883
|
if (parser.assignable & 2)
|
|
5655
5884
|
parser.report(80, forAwait ? 'await' : 'of');
|
|
5656
5885
|
reinterpretToPattern(parser, init);
|
|
5657
|
-
|
|
5886
|
+
if (!consumedForOfDelimiter)
|
|
5887
|
+
nextToken(parser, context | 32);
|
|
5658
5888
|
right = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5659
5889
|
consume(parser, context | 32, 16);
|
|
5660
5890
|
const body = parseIterationStatementBody(parser, context, scope, privateScope, labels);
|
|
@@ -5666,6 +5896,8 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5666
5896
|
await: forAwait,
|
|
5667
5897
|
}, start);
|
|
5668
5898
|
}
|
|
5899
|
+
if (resourceDeclarationKind)
|
|
5900
|
+
parser.report(30, 'in');
|
|
5669
5901
|
if (parser.assignable & 2)
|
|
5670
5902
|
parser.report(80, 'in');
|
|
5671
5903
|
reinterpretToPattern(parser, init);
|
|
@@ -5863,7 +6095,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
5863
6095
|
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 4, 1, 1, 0, parser.tokenStart);
|
|
5864
6096
|
break;
|
|
5865
6097
|
}
|
|
5866
|
-
case
|
|
6098
|
+
case 133:
|
|
5867
6099
|
case 86094:
|
|
5868
6100
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
|
|
5869
6101
|
break;
|
|
@@ -5986,7 +6218,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
5986
6218
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5987
6219
|
break;
|
|
5988
6220
|
}
|
|
5989
|
-
case
|
|
6221
|
+
case 133:
|
|
5990
6222
|
case 86094:
|
|
5991
6223
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
5992
6224
|
break;
|
|
@@ -6324,7 +6556,7 @@ function parseSuperExpression(parser, context) {
|
|
|
6324
6556
|
const { tokenStart } = parser;
|
|
6325
6557
|
nextToken(parser, context);
|
|
6326
6558
|
switch (parser.getToken()) {
|
|
6327
|
-
case
|
|
6559
|
+
case 67108991:
|
|
6328
6560
|
parser.report(167);
|
|
6329
6561
|
case 67174411: {
|
|
6330
6562
|
if ((context & 512) === 0)
|
|
@@ -6371,10 +6603,13 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6371
6603
|
switch (parser.getToken()) {
|
|
6372
6604
|
case 67108877: {
|
|
6373
6605
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6374
|
-
if (context & 16 && parser.getToken() ===
|
|
6606
|
+
if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
|
|
6375
6607
|
parser.report(173);
|
|
6376
6608
|
}
|
|
6377
|
-
parser.assignable =
|
|
6609
|
+
parser.assignable =
|
|
6610
|
+
(parser.flags & 2048) === 2048
|
|
6611
|
+
? 2
|
|
6612
|
+
: 1;
|
|
6378
6613
|
const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
|
|
6379
6614
|
expr = parser.finishNode({
|
|
6380
6615
|
type: 'MemberExpression',
|
|
@@ -6399,7 +6634,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6399
6634
|
const { tokenStart } = parser;
|
|
6400
6635
|
const property = parseExpressions(parser, context, privateScope, inGroup, 1, tokenStart);
|
|
6401
6636
|
consume(parser, context, 20);
|
|
6402
|
-
parser.assignable = 1;
|
|
6637
|
+
parser.assignable = restoreHasOptionalChaining ? 2 : 1;
|
|
6403
6638
|
expr = parser.finishNode({
|
|
6404
6639
|
type: 'MemberExpression',
|
|
6405
6640
|
object: expr,
|
|
@@ -6440,7 +6675,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6440
6675
|
}
|
|
6441
6676
|
break;
|
|
6442
6677
|
}
|
|
6443
|
-
case
|
|
6678
|
+
case 67108991: {
|
|
6444
6679
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6445
6680
|
parser.flags |= 2048;
|
|
6446
6681
|
parser.assignable = 2;
|
|
@@ -6527,12 +6762,12 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
|
|
|
6527
6762
|
}
|
|
6528
6763
|
function parsePropertyOrPrivatePropertyName(parser, context, privateScope) {
|
|
6529
6764
|
if ((parser.getToken() & 143360) === 0 &&
|
|
6530
|
-
parser.getToken() !== -2147483528 &&
|
|
6531
6765
|
parser.getToken() !== -2147483527 &&
|
|
6532
|
-
parser.getToken() !==
|
|
6766
|
+
parser.getToken() !== -2147483526 &&
|
|
6767
|
+
parser.getToken() !== 131) {
|
|
6533
6768
|
parser.report(160);
|
|
6534
6769
|
}
|
|
6535
|
-
return parser.getToken() ===
|
|
6770
|
+
return parser.getToken() === 131
|
|
6536
6771
|
? parsePrivateIdentifier(parser, context, privateScope, 0)
|
|
6537
6772
|
: parseIdentifier(parser, context);
|
|
6538
6773
|
}
|
|
@@ -6625,7 +6860,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6625
6860
|
return parseThisExpression(parser, context);
|
|
6626
6861
|
case 65540:
|
|
6627
6862
|
return parseRegExpLiteral(parser, context);
|
|
6628
|
-
case
|
|
6863
|
+
case 133:
|
|
6629
6864
|
case 86094:
|
|
6630
6865
|
return parseClassExpression(parser, context, privateScope, inGroup, start);
|
|
6631
6866
|
case 86109:
|
|
@@ -6636,9 +6871,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6636
6871
|
return parseTemplate(parser, context, privateScope);
|
|
6637
6872
|
case 86107:
|
|
6638
6873
|
return parseNewExpression(parser, context, privateScope, inGroup);
|
|
6639
|
-
case
|
|
6874
|
+
case 134283389:
|
|
6640
6875
|
return parseBigIntLiteral(parser, context);
|
|
6641
|
-
case
|
|
6876
|
+
case 131:
|
|
6642
6877
|
return parsePrivateIdentifier(parser, context, privateScope, 0);
|
|
6643
6878
|
case 86106:
|
|
6644
6879
|
return parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start);
|
|
@@ -6667,7 +6902,7 @@ function parseImportMetaExpression(parser, context, meta, start) {
|
|
|
6667
6902
|
parser.report(169);
|
|
6668
6903
|
nextToken(parser, context);
|
|
6669
6904
|
const token = parser.getToken();
|
|
6670
|
-
if (token !==
|
|
6905
|
+
if (token !== 209031 && parser.tokenValue !== 'meta') {
|
|
6671
6906
|
parser.report(174);
|
|
6672
6907
|
}
|
|
6673
6908
|
else if (token & -2147483648) {
|
|
@@ -6715,7 +6950,7 @@ function parseImportAttributes(parser, context) {
|
|
|
6715
6950
|
const value = parseStringLiteral(parser, context);
|
|
6716
6951
|
const keyContent = key.type === 'Literal' ? key.value : key.name;
|
|
6717
6952
|
if (keysContent.has(keyContent)) {
|
|
6718
|
-
parser.report(145,
|
|
6953
|
+
parser.report(145, keyContent);
|
|
6719
6954
|
}
|
|
6720
6955
|
keysContent.add(keyContent);
|
|
6721
6956
|
attributes.push(parser.finishNode({
|
|
@@ -6891,7 +7126,7 @@ function parseIdentifier(parser, context) {
|
|
|
6891
7126
|
}
|
|
6892
7127
|
function parseLiteral(parser, context) {
|
|
6893
7128
|
const { tokenValue, tokenRaw, tokenStart } = parser;
|
|
6894
|
-
if (parser.getToken() ===
|
|
7129
|
+
if (parser.getToken() === 134283389) {
|
|
6895
7130
|
return parseBigIntLiteral(parser, context);
|
|
6896
7131
|
}
|
|
6897
7132
|
const node = {
|
|
@@ -7408,9 +7643,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7408
7643
|
let key = null;
|
|
7409
7644
|
let value;
|
|
7410
7645
|
if (parser.getToken() & 143360 ||
|
|
7411
|
-
parser.getToken() === -
|
|
7412
|
-
parser.getToken() === -
|
|
7413
|
-
if (parser.getToken() === -
|
|
7646
|
+
parser.getToken() === -2147483527 ||
|
|
7647
|
+
parser.getToken() === -2147483526) {
|
|
7648
|
+
if (parser.getToken() === -2147483526)
|
|
7414
7649
|
destructible |= 16;
|
|
7415
7650
|
key = parseIdentifier(parser, context);
|
|
7416
7651
|
if (parser.getToken() === 18 ||
|
|
@@ -7442,7 +7677,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7442
7677
|
else {
|
|
7443
7678
|
destructible |=
|
|
7444
7679
|
(token === 209006 ? 128 : 0) |
|
|
7445
|
-
(token === -
|
|
7680
|
+
(token === -2147483527 ? 16 : 0);
|
|
7446
7681
|
value = parser.cloneIdentifier(key);
|
|
7447
7682
|
}
|
|
7448
7683
|
}
|
|
@@ -7569,7 +7804,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7569
7804
|
}
|
|
7570
7805
|
else if (parser.getToken() & 143360) {
|
|
7571
7806
|
destructible |= 16;
|
|
7572
|
-
if (token === -
|
|
7807
|
+
if (token === -2147483527)
|
|
7573
7808
|
parser.report(95);
|
|
7574
7809
|
if (token === 209005) {
|
|
7575
7810
|
if (parser.flags & 1)
|
|
@@ -8380,7 +8615,7 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
8380
8615
|
const id = parseIdentifier(parser, context | 32);
|
|
8381
8616
|
const { tokenStart } = parser;
|
|
8382
8617
|
if (consumeOpt(parser, context, 67108877)) {
|
|
8383
|
-
if (context & 65536 && parser.getToken() ===
|
|
8618
|
+
if (context & 65536 && parser.getToken() === 209030) {
|
|
8384
8619
|
parser.assignable = 2;
|
|
8385
8620
|
return parseMetaProperty(parser, context, id, start);
|
|
8386
8621
|
}
|
|
@@ -8392,7 +8627,7 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
8392
8627
|
}
|
|
8393
8628
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
8394
8629
|
context = (context | 131072) ^ 131072;
|
|
8395
|
-
if (parser.getToken() ===
|
|
8630
|
+
if (parser.getToken() === 67108991)
|
|
8396
8631
|
parser.report(168);
|
|
8397
8632
|
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
8398
8633
|
parser.assignable = 2;
|
|
@@ -8593,7 +8828,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8593
8828
|
let start;
|
|
8594
8829
|
let decorators;
|
|
8595
8830
|
if (parser.leadingDecorators.decorators.length) {
|
|
8596
|
-
if (parser.getToken() ===
|
|
8831
|
+
if (parser.getToken() === 133) {
|
|
8597
8832
|
parser.report(30, '@');
|
|
8598
8833
|
}
|
|
8599
8834
|
start = parser.leadingDecorators.start;
|
|
@@ -8682,7 +8917,7 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
|
8682
8917
|
function parseDecorators(parser, context, privateScope) {
|
|
8683
8918
|
const list = [];
|
|
8684
8919
|
if (parser.options.next) {
|
|
8685
|
-
while (parser.getToken() ===
|
|
8920
|
+
while (parser.getToken() === 133) {
|
|
8686
8921
|
list.push(parseDecoratorList(parser, context, privateScope));
|
|
8687
8922
|
}
|
|
8688
8923
|
}
|
|
@@ -8735,7 +8970,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8735
8970
|
let kind = isStatic ? 32 : 0;
|
|
8736
8971
|
let key = null;
|
|
8737
8972
|
const token = parser.getToken();
|
|
8738
|
-
if (token & (143360 | 36864) || token === -
|
|
8973
|
+
if (token & (143360 | 36864) || token === -2147483527) {
|
|
8739
8974
|
key = parseIdentifier(parser, context);
|
|
8740
8975
|
switch (token) {
|
|
8741
8976
|
case 36970:
|
|
@@ -8798,7 +9033,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8798
9033
|
kind |= 8;
|
|
8799
9034
|
nextToken(parser, context);
|
|
8800
9035
|
}
|
|
8801
|
-
else if (parser.getToken() ===
|
|
9036
|
+
else if (parser.getToken() === 131) {
|
|
8802
9037
|
kind |= 8192;
|
|
8803
9038
|
key = parsePrivateIdentifier(parser, context | 16, privateScope, 768);
|
|
8804
9039
|
}
|
|
@@ -8808,7 +9043,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8808
9043
|
else if (isStatic && token === 2162700) {
|
|
8809
9044
|
return parseStaticBlock(parser, context | 16, scope, privateScope, start);
|
|
8810
9045
|
}
|
|
8811
|
-
else if (token === -
|
|
9046
|
+
else if (token === -2147483526) {
|
|
8812
9047
|
key = parseIdentifier(parser, context);
|
|
8813
9048
|
if (parser.getToken() !== 67174411)
|
|
8814
9049
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -8818,8 +9053,8 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8818
9053
|
}
|
|
8819
9054
|
if (kind & (8 | 16 | 768 | 1024)) {
|
|
8820
9055
|
if (parser.getToken() & 143360 ||
|
|
8821
|
-
parser.getToken() === -
|
|
8822
|
-
parser.getToken() === -
|
|
9056
|
+
parser.getToken() === -2147483527 ||
|
|
9057
|
+
parser.getToken() === -2147483526) {
|
|
8823
9058
|
key = parseIdentifier(parser, context);
|
|
8824
9059
|
}
|
|
8825
9060
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -8829,7 +9064,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8829
9064
|
kind |= 2;
|
|
8830
9065
|
key = parseComputedPropertyName(parser, context, privateScope, 0);
|
|
8831
9066
|
}
|
|
8832
|
-
else if (parser.getToken() ===
|
|
9067
|
+
else if (parser.getToken() === 131) {
|
|
8833
9068
|
kind |= 8192;
|
|
8834
9069
|
key = parsePrivateIdentifier(parser, context, privateScope, kind);
|
|
8835
9070
|
}
|
|
@@ -8909,7 +9144,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
8909
9144
|
if (parser.getToken() === 1077936155) {
|
|
8910
9145
|
nextToken(parser, context | 32);
|
|
8911
9146
|
const { tokenStart } = parser;
|
|
8912
|
-
if (parser.getToken() ===
|
|
9147
|
+
if (parser.getToken() === 537079928)
|
|
8913
9148
|
parser.report(119);
|
|
8914
9149
|
const modifierFlags = 1024 |
|
|
8915
9150
|
2048 |
|
|
@@ -8941,7 +9176,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
8941
9176
|
}
|
|
8942
9177
|
function parseBindingPattern(parser, context, scope, privateScope, type, origin) {
|
|
8943
9178
|
if (parser.getToken() & 143360 ||
|
|
8944
|
-
((context & 1) === 0 && parser.getToken() === -
|
|
9179
|
+
((context & 1) === 0 && parser.getToken() === -2147483526))
|
|
8945
9180
|
return parseAndClassifyIdentifier(parser, context, scope, type, origin);
|
|
8946
9181
|
if ((parser.getToken() & 2097152) !== 2097152)
|
|
8947
9182
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -8960,7 +9195,7 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
|
8960
9195
|
if ((token & 537079808) === 537079808) {
|
|
8961
9196
|
parser.report(119);
|
|
8962
9197
|
}
|
|
8963
|
-
else if ((token & 36864) === 36864 || token === -
|
|
9198
|
+
else if ((token & 36864) === 36864 || token === -2147483526) {
|
|
8964
9199
|
parser.report(118);
|
|
8965
9200
|
}
|
|
8966
9201
|
}
|
|
@@ -9081,7 +9316,7 @@ function parseJSXChildrenAndClosingFragment(parser, context, privateScope, inJSX
|
|
|
9081
9316
|
}
|
|
9082
9317
|
}
|
|
9083
9318
|
function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild) {
|
|
9084
|
-
if (parser.getToken() ===
|
|
9319
|
+
if (parser.getToken() === 138)
|
|
9085
9320
|
return parseJSXText(parser, context);
|
|
9086
9321
|
if (parser.getToken() === 2162700)
|
|
9087
9322
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
@@ -9095,7 +9330,7 @@ function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild
|
|
|
9095
9330
|
parser.report(0);
|
|
9096
9331
|
}
|
|
9097
9332
|
function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChild) {
|
|
9098
|
-
if (parser.getToken() ===
|
|
9333
|
+
if (parser.getToken() === 138)
|
|
9099
9334
|
return parseJSXText(parser, context);
|
|
9100
9335
|
if (parser.getToken() === 2162700)
|
|
9101
9336
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|