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.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version$1 = "7.
|
|
3
|
+
var version$1 = "7.2.0";
|
|
4
4
|
var packageJson = {
|
|
5
5
|
version: version$1};
|
|
6
6
|
|
|
@@ -488,7 +488,7 @@ function convertTokenType(t) {
|
|
|
488
488
|
return 'RegularExpression';
|
|
489
489
|
case 67174408:
|
|
490
490
|
case 67174409:
|
|
491
|
-
case
|
|
491
|
+
case 132:
|
|
492
492
|
return 'TemplateLiteral';
|
|
493
493
|
default:
|
|
494
494
|
if ((t & 143360) === 143360)
|
|
@@ -796,7 +796,7 @@ class ParseError extends SyntaxError {
|
|
|
796
796
|
loc;
|
|
797
797
|
description;
|
|
798
798
|
constructor(start, end, type, ...params) {
|
|
799
|
-
const description = errorMessages[type].
|
|
799
|
+
const description = errorMessages[type].replaceAll(/%(\d+)/g, (_, i) => params[i]);
|
|
800
800
|
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
801
801
|
super(message);
|
|
802
802
|
this.start = start.index;
|
|
@@ -831,7 +831,7 @@ const KeywordDescTable = [
|
|
|
831
831
|
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
832
832
|
'this', 'throw', 'try', 'while', 'with',
|
|
833
833
|
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
834
|
-
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
834
|
+
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of', 'using',
|
|
835
835
|
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
836
836
|
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
837
837
|
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
@@ -878,6 +878,7 @@ const descKeywordTable = {
|
|
|
878
878
|
let: 241737,
|
|
879
879
|
null: 86023,
|
|
880
880
|
of: 471156,
|
|
881
|
+
using: 209013,
|
|
881
882
|
package: 36966,
|
|
882
883
|
private: 36967,
|
|
883
884
|
protected: 36968,
|
|
@@ -888,12 +889,12 @@ const descKeywordTable = {
|
|
|
888
889
|
true: 86022,
|
|
889
890
|
with: 20579,
|
|
890
891
|
yield: 241771,
|
|
891
|
-
enum:
|
|
892
|
-
eval:
|
|
892
|
+
enum: 86134,
|
|
893
|
+
eval: 537079927,
|
|
893
894
|
as: 77932,
|
|
894
|
-
arguments:
|
|
895
|
-
target:
|
|
896
|
-
meta:
|
|
895
|
+
arguments: 537079928,
|
|
896
|
+
target: 209030,
|
|
897
|
+
meta: 209031,
|
|
897
898
|
accessor: 12402,
|
|
898
899
|
};
|
|
899
900
|
|
|
@@ -955,24 +956,24 @@ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
|
955
956
|
if ((context & (2 | 2048)) === 0) {
|
|
956
957
|
return token | -2147483648;
|
|
957
958
|
}
|
|
958
|
-
return -
|
|
959
|
+
return -2147483527;
|
|
959
960
|
}
|
|
960
961
|
if (context & 1) {
|
|
961
962
|
if (token === 36970) {
|
|
962
|
-
return -
|
|
963
|
+
return -2147483526;
|
|
963
964
|
}
|
|
964
965
|
if ((token & 36864) === 36864) {
|
|
965
|
-
return -
|
|
966
|
+
return -2147483526;
|
|
966
967
|
}
|
|
967
968
|
if ((token & 20480) === 20480) {
|
|
968
969
|
if (context & 262144 && (context & 8) === 0) {
|
|
969
970
|
return token | -2147483648;
|
|
970
971
|
}
|
|
971
972
|
else {
|
|
972
|
-
return -
|
|
973
|
+
return -2147483527;
|
|
973
974
|
}
|
|
974
975
|
}
|
|
975
|
-
return
|
|
976
|
+
return 209019 | -2147483648;
|
|
976
977
|
}
|
|
977
978
|
if (context & 262144 &&
|
|
978
979
|
(context & 8) === 0 &&
|
|
@@ -981,31 +982,31 @@ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
|
981
982
|
}
|
|
982
983
|
if (token === 241771) {
|
|
983
984
|
return context & 262144
|
|
984
|
-
?
|
|
985
|
+
? 209019 | -2147483648
|
|
985
986
|
: context & 1024
|
|
986
|
-
? -
|
|
987
|
+
? -2147483527
|
|
987
988
|
: token | -2147483648;
|
|
988
989
|
}
|
|
989
990
|
if (token === 209005) {
|
|
990
|
-
return
|
|
991
|
+
return 209019 | -2147483648;
|
|
991
992
|
}
|
|
992
993
|
if ((token & 36864) === 36864) {
|
|
993
994
|
return token | 12288 | -2147483648;
|
|
994
995
|
}
|
|
995
|
-
return -
|
|
996
|
+
return -2147483527;
|
|
996
997
|
}
|
|
997
998
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
998
999
|
}
|
|
999
1000
|
function scanPrivateIdentifier(parser) {
|
|
1000
1001
|
let char = advanceChar(parser);
|
|
1001
1002
|
if (char === 92)
|
|
1002
|
-
return
|
|
1003
|
+
return 131;
|
|
1003
1004
|
const merged = consumePossibleSurrogatePair(parser);
|
|
1004
1005
|
if (merged)
|
|
1005
1006
|
char = merged;
|
|
1006
1007
|
if (!isIdentifierStart(char))
|
|
1007
1008
|
parser.report(96);
|
|
1008
|
-
return
|
|
1009
|
+
return 131;
|
|
1009
1010
|
}
|
|
1010
1011
|
function scanIdentifierUnicodeEscape(parser) {
|
|
1011
1012
|
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
@@ -1211,7 +1212,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1211
1212
|
if (isBigInt) {
|
|
1212
1213
|
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1213
1214
|
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1214
|
-
return
|
|
1215
|
+
return 134283389;
|
|
1215
1216
|
}
|
|
1216
1217
|
parser.tokenValue =
|
|
1217
1218
|
kind & (1 | 2 | 8 | 4)
|
|
@@ -1580,6 +1581,7 @@ function scanTemplate(parser, context) {
|
|
|
1580
1581
|
const { index: start } = parser;
|
|
1581
1582
|
let token = 67174409;
|
|
1582
1583
|
let ret = '';
|
|
1584
|
+
let hasCarriageReturn = false;
|
|
1583
1585
|
let char = advanceChar(parser);
|
|
1584
1586
|
while (char !== 96) {
|
|
1585
1587
|
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
@@ -1589,6 +1591,8 @@ function scanTemplate(parser, context) {
|
|
|
1589
1591
|
}
|
|
1590
1592
|
else if (char === 92) {
|
|
1591
1593
|
char = advanceChar(parser);
|
|
1594
|
+
if (char === 13)
|
|
1595
|
+
hasCarriageReturn = true;
|
|
1592
1596
|
if (char > 0x7e) {
|
|
1593
1597
|
ret += String.fromCodePoint(char);
|
|
1594
1598
|
}
|
|
@@ -1603,7 +1607,9 @@ function scanTemplate(parser, context) {
|
|
|
1603
1607
|
parser.line = line;
|
|
1604
1608
|
parser.column = column;
|
|
1605
1609
|
ret = null;
|
|
1606
|
-
char = scanBadTemplate(parser, char)
|
|
1610
|
+
char = scanBadTemplate(parser, char, () => {
|
|
1611
|
+
hasCarriageReturn = true;
|
|
1612
|
+
});
|
|
1607
1613
|
if (char < 0)
|
|
1608
1614
|
token = 67174408;
|
|
1609
1615
|
break;
|
|
@@ -1614,10 +1620,13 @@ function scanTemplate(parser, context) {
|
|
|
1614
1620
|
}
|
|
1615
1621
|
}
|
|
1616
1622
|
else if (parser.index < parser.end) {
|
|
1617
|
-
if (char === 13
|
|
1618
|
-
|
|
1623
|
+
if (char === 13)
|
|
1624
|
+
hasCarriageReturn = true;
|
|
1625
|
+
if (char === 13 && parser.source.charCodeAt(parser.index + 1) === 10) {
|
|
1619
1626
|
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
1620
1627
|
}
|
|
1628
|
+
if (char === 13)
|
|
1629
|
+
char = 10;
|
|
1621
1630
|
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
1622
1631
|
parser.column = -1;
|
|
1623
1632
|
parser.line++;
|
|
@@ -1630,12 +1639,16 @@ function scanTemplate(parser, context) {
|
|
|
1630
1639
|
}
|
|
1631
1640
|
advanceChar(parser);
|
|
1632
1641
|
parser.tokenValue = ret;
|
|
1633
|
-
|
|
1642
|
+
const tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
1643
|
+
parser.tokenRaw = hasCarriageReturn ? tokenRaw.replaceAll(/\r\n?/g, '\n') : tokenRaw;
|
|
1634
1644
|
return token;
|
|
1635
1645
|
}
|
|
1636
|
-
function scanBadTemplate(parser, ch) {
|
|
1646
|
+
function scanBadTemplate(parser, ch, onCarriageReturn) {
|
|
1637
1647
|
while (ch !== 96) {
|
|
1638
1648
|
switch (ch) {
|
|
1649
|
+
case 13:
|
|
1650
|
+
onCarriageReturn();
|
|
1651
|
+
break;
|
|
1639
1652
|
case 36: {
|
|
1640
1653
|
const index = parser.index + 1;
|
|
1641
1654
|
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
@@ -1666,42 +1679,42 @@ function scanTemplateTail(parser, context) {
|
|
|
1666
1679
|
}
|
|
1667
1680
|
|
|
1668
1681
|
const TokenLookup = [
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
128,
|
|
1678
|
-
127,
|
|
1679
|
-
135,
|
|
1680
|
-
127,
|
|
1681
|
-
127,
|
|
1682
|
+
129,
|
|
1683
|
+
129,
|
|
1684
|
+
129,
|
|
1685
|
+
129,
|
|
1686
|
+
129,
|
|
1687
|
+
129,
|
|
1688
|
+
129,
|
|
1689
|
+
129,
|
|
1682
1690
|
129,
|
|
1683
1691
|
128,
|
|
1692
|
+
136,
|
|
1684
1693
|
128,
|
|
1685
1694
|
128,
|
|
1695
|
+
130,
|
|
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,
|
|
1712
|
+
129,
|
|
1713
|
+
129,
|
|
1686
1714
|
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
|
-
128,
|
|
1700
|
-
128,
|
|
1701
|
-
127,
|
|
1702
1715
|
16842798,
|
|
1703
1716
|
134283267,
|
|
1704
|
-
|
|
1717
|
+
131,
|
|
1705
1718
|
208897,
|
|
1706
1719
|
8391477,
|
|
1707
1720
|
8390213,
|
|
@@ -1730,7 +1743,7 @@ const TokenLookup = [
|
|
|
1730
1743
|
1077936155,
|
|
1731
1744
|
8390721,
|
|
1732
1745
|
22,
|
|
1733
|
-
|
|
1746
|
+
133,
|
|
1734
1747
|
208897,
|
|
1735
1748
|
208897,
|
|
1736
1749
|
208897,
|
|
@@ -1758,11 +1771,11 @@ const TokenLookup = [
|
|
|
1758
1771
|
208897,
|
|
1759
1772
|
208897,
|
|
1760
1773
|
69271571,
|
|
1761
|
-
|
|
1774
|
+
137,
|
|
1762
1775
|
20,
|
|
1763
1776
|
8389959,
|
|
1764
1777
|
208897,
|
|
1765
|
-
|
|
1778
|
+
132,
|
|
1766
1779
|
4096,
|
|
1767
1780
|
4096,
|
|
1768
1781
|
4096,
|
|
@@ -1793,7 +1806,7 @@ const TokenLookup = [
|
|
|
1793
1806
|
8389702,
|
|
1794
1807
|
1074790415,
|
|
1795
1808
|
16842799,
|
|
1796
|
-
|
|
1809
|
+
129,
|
|
1797
1810
|
];
|
|
1798
1811
|
function nextToken(parser, context) {
|
|
1799
1812
|
parser.flags = (parser.flags | 1) ^ 1;
|
|
@@ -1823,8 +1836,8 @@ function scanSingleToken(parser, context, state) {
|
|
|
1823
1836
|
case 1074790417:
|
|
1824
1837
|
case 18:
|
|
1825
1838
|
case 16842799:
|
|
1826
|
-
case
|
|
1827
|
-
case
|
|
1839
|
+
case 133:
|
|
1840
|
+
case 129:
|
|
1828
1841
|
advanceChar(parser);
|
|
1829
1842
|
return token;
|
|
1830
1843
|
case 208897:
|
|
@@ -1835,20 +1848,20 @@ function scanSingleToken(parser, context, state) {
|
|
|
1835
1848
|
return scanNumber(parser, context, 16 | 128);
|
|
1836
1849
|
case 134283267:
|
|
1837
1850
|
return scanString(parser, context, char);
|
|
1838
|
-
case
|
|
1851
|
+
case 132:
|
|
1839
1852
|
return scanTemplate(parser, context);
|
|
1840
|
-
case
|
|
1853
|
+
case 137:
|
|
1841
1854
|
return scanUnicodeIdentifier(parser, context);
|
|
1842
|
-
case
|
|
1855
|
+
case 131:
|
|
1843
1856
|
return scanPrivateIdentifier(parser);
|
|
1844
|
-
case
|
|
1857
|
+
case 128:
|
|
1845
1858
|
advanceChar(parser);
|
|
1846
1859
|
break;
|
|
1847
|
-
case
|
|
1860
|
+
case 130:
|
|
1848
1861
|
state |= 1 | 4;
|
|
1849
1862
|
scanNewLine(parser);
|
|
1850
1863
|
break;
|
|
1851
|
-
case
|
|
1864
|
+
case 136:
|
|
1852
1865
|
consumeLineFeed(parser, state);
|
|
1853
1866
|
state = (state & -5) | 1;
|
|
1854
1867
|
break;
|
|
@@ -2071,7 +2084,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2071
2084
|
advanceChar(parser);
|
|
2072
2085
|
return 4718634;
|
|
2073
2086
|
}
|
|
2074
|
-
return
|
|
2087
|
+
return 276824446;
|
|
2075
2088
|
}
|
|
2076
2089
|
if (ch === 46) {
|
|
2077
2090
|
const index = parser.index + 1;
|
|
@@ -2079,7 +2092,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2079
2092
|
ch = source.charCodeAt(index);
|
|
2080
2093
|
if (!(ch >= 48 && ch <= 57)) {
|
|
2081
2094
|
advanceChar(parser);
|
|
2082
|
-
return
|
|
2095
|
+
return 67108991;
|
|
2083
2096
|
}
|
|
2084
2097
|
}
|
|
2085
2098
|
}
|
|
@@ -2187,7 +2200,7 @@ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
|
2187
2200
|
parser.report(119);
|
|
2188
2201
|
}
|
|
2189
2202
|
}
|
|
2190
|
-
if ((t & 20480) === 20480 || t === -
|
|
2203
|
+
if ((t & 20480) === 20480 || t === -2147483527) {
|
|
2191
2204
|
parser.report(102);
|
|
2192
2205
|
}
|
|
2193
2206
|
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
@@ -2208,10 +2221,10 @@ function validateFunctionName(parser, context, t) {
|
|
|
2208
2221
|
if ((t & 537079808) === 537079808) {
|
|
2209
2222
|
parser.report(119);
|
|
2210
2223
|
}
|
|
2211
|
-
if (t === -
|
|
2224
|
+
if (t === -2147483526) {
|
|
2212
2225
|
parser.report(95);
|
|
2213
2226
|
}
|
|
2214
|
-
if (t === -
|
|
2227
|
+
if (t === -2147483527) {
|
|
2215
2228
|
parser.report(95);
|
|
2216
2229
|
}
|
|
2217
2230
|
}
|
|
@@ -2235,7 +2248,7 @@ function isStrictReservedWord(parser, context, t) {
|
|
|
2235
2248
|
parser.report(97, 'yield');
|
|
2236
2249
|
return ((t & 20480) === 20480 ||
|
|
2237
2250
|
(t & 36864) === 36864 ||
|
|
2238
|
-
t == -
|
|
2251
|
+
t == -2147483526);
|
|
2239
2252
|
}
|
|
2240
2253
|
function isPropertyWithPrivateFieldKey(expr) {
|
|
2241
2254
|
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
@@ -4450,7 +4463,7 @@ const decodeMap = {
|
|
|
4450
4463
|
'159': 376,
|
|
4451
4464
|
};
|
|
4452
4465
|
function decodeHTMLStrict(text) {
|
|
4453
|
-
return text.
|
|
4466
|
+
return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
|
|
4454
4467
|
if (key.charAt(1) === '#') {
|
|
4455
4468
|
const secondChar = key.charAt(2);
|
|
4456
4469
|
const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
|
|
@@ -4533,7 +4546,7 @@ function nextJSXToken(parser) {
|
|
|
4533
4546
|
if (parser.options.raw)
|
|
4534
4547
|
parser.tokenRaw = raw;
|
|
4535
4548
|
parser.tokenValue = decodeHTMLStrict(raw);
|
|
4536
|
-
parser.setToken(
|
|
4549
|
+
parser.setToken(138);
|
|
4537
4550
|
}
|
|
4538
4551
|
function rescanJSXIdentifier(parser) {
|
|
4539
4552
|
if ((parser.getToken() & 143360) === 143360) {
|
|
@@ -4994,7 +5007,7 @@ function parseModuleItemList(parser, context, scope) {
|
|
|
4994
5007
|
return statements;
|
|
4995
5008
|
}
|
|
4996
5009
|
function parseModuleItem(parser, context, scope) {
|
|
4997
|
-
if (parser.getToken() ===
|
|
5010
|
+
if (parser.getToken() === 133) {
|
|
4998
5011
|
Object.assign(parser.leadingDecorators, {
|
|
4999
5012
|
start: parser.tokenStart,
|
|
5000
5013
|
decorators: parseDecorators(parser, context, undefined),
|
|
@@ -5021,13 +5034,21 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
5021
5034
|
switch (parser.getToken()) {
|
|
5022
5035
|
case 86104:
|
|
5023
5036
|
return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 0, start);
|
|
5024
|
-
case
|
|
5037
|
+
case 133:
|
|
5025
5038
|
case 86094:
|
|
5026
5039
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5027
5040
|
case 86090:
|
|
5028
5041
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, 0);
|
|
5029
5042
|
case 241737:
|
|
5030
5043
|
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
5044
|
+
case 209013:
|
|
5045
|
+
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels);
|
|
5046
|
+
case 209006:
|
|
5047
|
+
if ((context & 2048 || (context & 2 && context & 8)) &&
|
|
5048
|
+
nextTokenIsUsingOnSameLine(parser)) {
|
|
5049
|
+
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels);
|
|
5050
|
+
}
|
|
5051
|
+
return parseStatement(parser, context, scope, privateScope, origin, labels, 1);
|
|
5031
5052
|
case 20564:
|
|
5032
5053
|
parser.report(103, 'export');
|
|
5033
5054
|
case 86106:
|
|
@@ -5111,15 +5132,18 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
|
|
|
5111
5132
|
default:
|
|
5112
5133
|
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart);
|
|
5113
5134
|
}
|
|
5135
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, allowFuncDecl, expr, token, tokenValue, tokenStart);
|
|
5136
|
+
}
|
|
5137
|
+
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, allowFuncDecl, initialExpression, token, tokenValue, tokenStart) {
|
|
5114
5138
|
if (token & 143360 && parser.getToken() === 21) {
|
|
5115
|
-
return parseLabelledStatement(parser, context, scope, privateScope, origin, labels, tokenValue,
|
|
5139
|
+
return parseLabelledStatement(parser, context, scope, privateScope, origin, labels, tokenValue, initialExpression, token, allowFuncDecl, tokenStart);
|
|
5116
5140
|
}
|
|
5117
|
-
|
|
5118
|
-
|
|
5141
|
+
let expression = parseMemberOrUpdateExpression(parser, context, privateScope, initialExpression, 0, 0, tokenStart);
|
|
5142
|
+
expression = parseAssignmentExpression(parser, context, privateScope, 0, 0, tokenStart, expression);
|
|
5119
5143
|
if (parser.getToken() === 18) {
|
|
5120
|
-
|
|
5144
|
+
expression = parseSequenceExpression(parser, context, privateScope, 0, tokenStart, expression);
|
|
5121
5145
|
}
|
|
5122
|
-
return parseExpressionStatement(parser, context,
|
|
5146
|
+
return parseExpressionStatement(parser, context, expression, tokenStart);
|
|
5123
5147
|
}
|
|
5124
5148
|
function parseBlock(parser, context, scope, privateScope, labels, start = parser.tokenStart, type = 'BlockStatement') {
|
|
5125
5149
|
const body = [];
|
|
@@ -5308,9 +5332,14 @@ function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
|
5308
5332
|
while (parser.getToken() !== 20556 &&
|
|
5309
5333
|
parser.getToken() !== 1074790415 &&
|
|
5310
5334
|
parser.getToken() !== 20561) {
|
|
5311
|
-
|
|
5335
|
+
const statement = parseStatementListItem(parser, context | 4, scope, privateScope, 2, {
|
|
5312
5336
|
$: labels,
|
|
5313
|
-
})
|
|
5337
|
+
});
|
|
5338
|
+
if (statement.type === 'VariableDeclaration' &&
|
|
5339
|
+
(statement.kind === 'using' || statement.kind === 'await using')) {
|
|
5340
|
+
parser.report(30, statement.kind);
|
|
5341
|
+
}
|
|
5342
|
+
consequent.push(statement);
|
|
5314
5343
|
}
|
|
5315
5344
|
cases.push(parser.finishNode({
|
|
5316
5345
|
type: 'SwitchCase',
|
|
@@ -5512,14 +5541,90 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
5512
5541
|
}
|
|
5513
5542
|
return parseExpressionStatement(parser, context, expr, tokenStart);
|
|
5514
5543
|
}
|
|
5515
|
-
function
|
|
5544
|
+
function nextTokenIsUsingOnSameLine(parser) {
|
|
5545
|
+
const { index: parserIndex, source } = parser;
|
|
5546
|
+
let index = parserIndex;
|
|
5547
|
+
while (index < parser.end) {
|
|
5548
|
+
const char = source.charCodeAt(index);
|
|
5549
|
+
if (char === 0x0a || char === 0x0d || char === 0x2028 || char === 0x2029)
|
|
5550
|
+
return false;
|
|
5551
|
+
if (/\s/u.test(source[index])) {
|
|
5552
|
+
index++;
|
|
5553
|
+
continue;
|
|
5554
|
+
}
|
|
5555
|
+
if (char === 0x2f && source.charCodeAt(index + 1) === 0x2a) {
|
|
5556
|
+
index += 2;
|
|
5557
|
+
while (index < parser.end) {
|
|
5558
|
+
const commentChar = source.charCodeAt(index);
|
|
5559
|
+
if (commentChar === 0x0a || commentChar === 0x0d || commentChar === 0x2028 || commentChar === 0x2029) {
|
|
5560
|
+
return false;
|
|
5561
|
+
}
|
|
5562
|
+
if (commentChar === 0x2a && source.charCodeAt(index + 1) === 0x2f) {
|
|
5563
|
+
index += 2;
|
|
5564
|
+
break;
|
|
5565
|
+
}
|
|
5566
|
+
index++;
|
|
5567
|
+
}
|
|
5568
|
+
continue;
|
|
5569
|
+
}
|
|
5570
|
+
break;
|
|
5571
|
+
}
|
|
5572
|
+
if (source.slice(index, index + 5) !== 'using')
|
|
5573
|
+
return false;
|
|
5574
|
+
const following = source.codePointAt(index + 5);
|
|
5575
|
+
return following === undefined || (following !== 0x5c && !isIdentifierPart(following));
|
|
5576
|
+
}
|
|
5577
|
+
function isResourceBindingStart(token) {
|
|
5578
|
+
return (token & 143360) === 143360 && (token & 20480) !== 20480;
|
|
5579
|
+
}
|
|
5580
|
+
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5581
|
+
const { tokenStart, tokenValue } = parser;
|
|
5582
|
+
const token = parser.getToken();
|
|
5583
|
+
const expression = parseIdentifier(parser, context);
|
|
5584
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5585
|
+
if (origin & 4 && context & 8 && (context & 2) === 0) {
|
|
5586
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5587
|
+
}
|
|
5588
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'using', tokenStart, 1);
|
|
5589
|
+
}
|
|
5590
|
+
parser.assignable = 1;
|
|
5591
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, 1, expression, token, tokenValue, tokenStart);
|
|
5592
|
+
}
|
|
5593
|
+
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5516
5594
|
const start = parser.tokenStart;
|
|
5517
|
-
|
|
5518
|
-
|
|
5595
|
+
if (context & 524288)
|
|
5596
|
+
parser.report(177);
|
|
5597
|
+
nextToken(parser, context | 32);
|
|
5598
|
+
let argument;
|
|
5599
|
+
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
5600
|
+
const usingStart = parser.tokenStart;
|
|
5601
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5602
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5603
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'await using', start, 1);
|
|
5604
|
+
}
|
|
5605
|
+
argument = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, usingStart);
|
|
5606
|
+
}
|
|
5607
|
+
else {
|
|
5608
|
+
argument = parseLeftHandSideExpression(parser, context, privateScope, 0, 0, 1);
|
|
5609
|
+
}
|
|
5610
|
+
if (parser.getToken() === 8391735)
|
|
5611
|
+
parser.report(33);
|
|
5612
|
+
parser.assignable = 2;
|
|
5613
|
+
const expression = parser.finishNode({
|
|
5614
|
+
type: 'AwaitExpression',
|
|
5615
|
+
argument,
|
|
5616
|
+
}, start);
|
|
5617
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, 0, expression, 1048576, '', start);
|
|
5618
|
+
}
|
|
5619
|
+
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5620
|
+
const start = declarationStart;
|
|
5621
|
+
if (!keywordConsumed)
|
|
5622
|
+
nextToken(parser, context);
|
|
5623
|
+
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5519
5624
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5520
5625
|
return parser.finishNode({
|
|
5521
5626
|
type: 'VariableDeclaration',
|
|
5522
|
-
kind: kind & 8 ? 'let' : 'const',
|
|
5627
|
+
kind: declarationKind ?? (kind & 8 ? 'let' : 'const'),
|
|
5523
5628
|
declarations,
|
|
5524
5629
|
}, start);
|
|
5525
5630
|
}
|
|
@@ -5534,24 +5639,34 @@ function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
|
5534
5639
|
declarations,
|
|
5535
5640
|
}, start);
|
|
5536
5641
|
}
|
|
5537
|
-
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin) {
|
|
5642
|
+
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5538
5643
|
let bindingCount = 1;
|
|
5539
|
-
const
|
|
5540
|
-
|
|
5541
|
-
];
|
|
5644
|
+
const firstDeclaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5645
|
+
const list = [firstDeclaration];
|
|
5646
|
+
const resourceNames = declarationKind && parser.options.lexical ? new Set([firstDeclaration.id.name]) : undefined;
|
|
5542
5647
|
while (consumeOpt(parser, context, 18)) {
|
|
5543
5648
|
bindingCount++;
|
|
5544
|
-
|
|
5649
|
+
const declaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5650
|
+
if (resourceNames) {
|
|
5651
|
+
const { name } = declaration.id;
|
|
5652
|
+
if (resourceNames.has(name))
|
|
5653
|
+
parser.report(145, name);
|
|
5654
|
+
resourceNames.add(name);
|
|
5655
|
+
}
|
|
5656
|
+
list.push(declaration);
|
|
5545
5657
|
}
|
|
5546
5658
|
if (bindingCount > 1 && origin & 32 && parser.getToken() & 262144) {
|
|
5547
5659
|
parser.report(61, KeywordDescTable[parser.getToken() & 255]);
|
|
5548
5660
|
}
|
|
5549
5661
|
return list;
|
|
5550
5662
|
}
|
|
5551
|
-
function parseVariableDeclaration(parser, context, scope, privateScope, kind, origin) {
|
|
5663
|
+
function parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5552
5664
|
const { tokenStart } = parser;
|
|
5553
5665
|
const token = parser.getToken();
|
|
5554
5666
|
let init = null;
|
|
5667
|
+
if (declarationKind && (token & 2097152) === 2097152) {
|
|
5668
|
+
parser.report(50);
|
|
5669
|
+
}
|
|
5555
5670
|
const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
|
|
5556
5671
|
if (parser.getToken() === 1077936155) {
|
|
5557
5672
|
nextToken(parser, context | 32);
|
|
@@ -5566,7 +5681,7 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
5566
5681
|
}
|
|
5567
5682
|
else if ((kind & 16 || (token & 2097152) > 0) &&
|
|
5568
5683
|
(parser.getToken() & 262144) !== 262144) {
|
|
5569
|
-
parser.report(59, kind & 16 ? 'const' : 'destructuring');
|
|
5684
|
+
parser.report(59, declarationKind ?? (kind & 16 ? 'const' : 'destructuring'));
|
|
5570
5685
|
}
|
|
5571
5686
|
return parser.finishNode({
|
|
5572
5687
|
type: 'VariableDeclarator',
|
|
@@ -5587,7 +5702,10 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5587
5702
|
let init = null;
|
|
5588
5703
|
let isVarDecl = parser.getToken() === 86088 ||
|
|
5589
5704
|
parser.getToken() === 241737 ||
|
|
5590
|
-
parser.getToken() === 86090
|
|
5705
|
+
parser.getToken() === 86090 ||
|
|
5706
|
+
parser.getToken() === 209013;
|
|
5707
|
+
let resourceDeclarationKind;
|
|
5708
|
+
let consumedForOfDelimiter = false;
|
|
5591
5709
|
let right;
|
|
5592
5710
|
const { tokenStart } = parser;
|
|
5593
5711
|
const token = parser.getToken();
|
|
@@ -5614,6 +5732,81 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5614
5732
|
parser.report(115);
|
|
5615
5733
|
}
|
|
5616
5734
|
}
|
|
5735
|
+
else if (token === 209013) {
|
|
5736
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5737
|
+
if ((parser.flags & 1) !== 0 || !isResourceBindingStart(parser.getToken())) {
|
|
5738
|
+
isVarDecl = false;
|
|
5739
|
+
parser.assignable = 1;
|
|
5740
|
+
init = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, tokenStart);
|
|
5741
|
+
}
|
|
5742
|
+
else if (parser.getToken() === 471156) {
|
|
5743
|
+
const ofStart = parser.tokenStart;
|
|
5744
|
+
const ofToken = parser.getToken();
|
|
5745
|
+
const ofValue = parser.tokenValue;
|
|
5746
|
+
const ofIdentifier = parseIdentifier(parser, context);
|
|
5747
|
+
if (parser.getToken() !== 1077936155 &&
|
|
5748
|
+
parser.getToken() !== 8673330 &&
|
|
5749
|
+
parser.getToken() !== 1074790417 &&
|
|
5750
|
+
parser.getToken() !== 18) {
|
|
5751
|
+
isVarDecl = false;
|
|
5752
|
+
consumedForOfDelimiter = true;
|
|
5753
|
+
parser.assignable = 1;
|
|
5754
|
+
init = usingIdentifier;
|
|
5755
|
+
}
|
|
5756
|
+
else {
|
|
5757
|
+
resourceDeclarationKind = 'using';
|
|
5758
|
+
validateBindingIdentifier(parser, context, 16, ofToken, 0);
|
|
5759
|
+
scope?.addBlockName(context, ofValue, 16, 32);
|
|
5760
|
+
let declarationInitializer = null;
|
|
5761
|
+
if (parser.getToken() === 1077936155) {
|
|
5762
|
+
nextToken(parser, context | 32);
|
|
5763
|
+
declarationInitializer = parseExpression(parser, context | 131072, privateScope, 1, 0, parser.tokenStart);
|
|
5764
|
+
if ((parser.getToken() & 262144) === 262144) {
|
|
5765
|
+
throw new ParseError(ofStart, parser.currentLocation, 60, parser.getToken() === 471156 ? 'of' : 'in');
|
|
5766
|
+
}
|
|
5767
|
+
}
|
|
5768
|
+
else if (parser.getToken() !== 8673330) {
|
|
5769
|
+
parser.report(59, resourceDeclarationKind);
|
|
5770
|
+
}
|
|
5771
|
+
const declarations = [
|
|
5772
|
+
parser.finishNode({
|
|
5773
|
+
type: 'VariableDeclarator',
|
|
5774
|
+
id: ofIdentifier,
|
|
5775
|
+
init: declarationInitializer,
|
|
5776
|
+
}, ofStart),
|
|
5777
|
+
];
|
|
5778
|
+
const resourceNames = parser.options.lexical ? new Set([ofValue]) : undefined;
|
|
5779
|
+
while (consumeOpt(parser, context | 131072, 18)) {
|
|
5780
|
+
const declaration = parseVariableDeclaration(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind);
|
|
5781
|
+
if (resourceNames) {
|
|
5782
|
+
const { name } = declaration.id;
|
|
5783
|
+
if (resourceNames.has(name))
|
|
5784
|
+
parser.report(145, name);
|
|
5785
|
+
resourceNames.add(name);
|
|
5786
|
+
}
|
|
5787
|
+
declarations.push(declaration);
|
|
5788
|
+
}
|
|
5789
|
+
if (declarations.length > 1 && parser.getToken() & 262144) {
|
|
5790
|
+
parser.report(61, KeywordDescTable[parser.getToken() & 255]);
|
|
5791
|
+
}
|
|
5792
|
+
init = parser.finishNode({
|
|
5793
|
+
type: 'VariableDeclaration',
|
|
5794
|
+
kind: resourceDeclarationKind,
|
|
5795
|
+
declarations,
|
|
5796
|
+
}, tokenStart);
|
|
5797
|
+
parser.assignable = 1;
|
|
5798
|
+
}
|
|
5799
|
+
}
|
|
5800
|
+
else {
|
|
5801
|
+
resourceDeclarationKind = 'using';
|
|
5802
|
+
init = parser.finishNode({
|
|
5803
|
+
type: 'VariableDeclaration',
|
|
5804
|
+
kind: resourceDeclarationKind,
|
|
5805
|
+
declarations: parseVariableDeclarationList(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind),
|
|
5806
|
+
}, tokenStart);
|
|
5807
|
+
parser.assignable = 1;
|
|
5808
|
+
}
|
|
5809
|
+
}
|
|
5617
5810
|
else {
|
|
5618
5811
|
nextToken(parser, context);
|
|
5619
5812
|
init = parser.finishNode(token === 86088
|
|
@@ -5630,6 +5823,42 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5630
5823
|
parser.assignable = 1;
|
|
5631
5824
|
}
|
|
5632
5825
|
}
|
|
5826
|
+
else if (token === 209006 &&
|
|
5827
|
+
(context & 2048 || (context & 2 && context & 8))) {
|
|
5828
|
+
if (context & 524288)
|
|
5829
|
+
parser.report(177);
|
|
5830
|
+
nextToken(parser, context | 32);
|
|
5831
|
+
let awaitArgument;
|
|
5832
|
+
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
5833
|
+
const usingStart = parser.tokenStart;
|
|
5834
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5835
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5836
|
+
resourceDeclarationKind = 'await using';
|
|
5837
|
+
isVarDecl = true;
|
|
5838
|
+
init = parser.finishNode({
|
|
5839
|
+
type: 'VariableDeclaration',
|
|
5840
|
+
kind: resourceDeclarationKind,
|
|
5841
|
+
declarations: parseVariableDeclarationList(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind),
|
|
5842
|
+
}, tokenStart);
|
|
5843
|
+
parser.assignable = 1;
|
|
5844
|
+
}
|
|
5845
|
+
else {
|
|
5846
|
+
awaitArgument = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, usingStart);
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
else {
|
|
5850
|
+
awaitArgument = parseLeftHandSideExpression(parser, context, privateScope, 0, 0, 1);
|
|
5851
|
+
}
|
|
5852
|
+
if (!isVarDecl) {
|
|
5853
|
+
if (parser.getToken() === 8391735)
|
|
5854
|
+
parser.report(33);
|
|
5855
|
+
parser.assignable = 2;
|
|
5856
|
+
init = parser.finishNode({
|
|
5857
|
+
type: 'AwaitExpression',
|
|
5858
|
+
argument: awaitArgument,
|
|
5859
|
+
}, tokenStart);
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5633
5862
|
else if (token === 1074790417) {
|
|
5634
5863
|
if (forAwait)
|
|
5635
5864
|
parser.report(82);
|
|
@@ -5651,12 +5880,13 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5651
5880
|
else {
|
|
5652
5881
|
init = parseLeftHandSideExpression(parser, context | 131072, privateScope, 1, 0, 1);
|
|
5653
5882
|
}
|
|
5654
|
-
if ((parser.getToken() & 262144) === 262144) {
|
|
5655
|
-
if (parser.getToken() === 471156) {
|
|
5883
|
+
if (consumedForOfDelimiter || (parser.getToken() & 262144) === 262144) {
|
|
5884
|
+
if (consumedForOfDelimiter || parser.getToken() === 471156) {
|
|
5656
5885
|
if (parser.assignable & 2)
|
|
5657
5886
|
parser.report(80, forAwait ? 'await' : 'of');
|
|
5658
5887
|
reinterpretToPattern(parser, init);
|
|
5659
|
-
|
|
5888
|
+
if (!consumedForOfDelimiter)
|
|
5889
|
+
nextToken(parser, context | 32);
|
|
5660
5890
|
right = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5661
5891
|
consume(parser, context | 32, 16);
|
|
5662
5892
|
const body = parseIterationStatementBody(parser, context, scope, privateScope, labels);
|
|
@@ -5668,6 +5898,8 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5668
5898
|
await: forAwait,
|
|
5669
5899
|
}, start);
|
|
5670
5900
|
}
|
|
5901
|
+
if (resourceDeclarationKind)
|
|
5902
|
+
parser.report(30, 'in');
|
|
5671
5903
|
if (parser.assignable & 2)
|
|
5672
5904
|
parser.report(80, 'in');
|
|
5673
5905
|
reinterpretToPattern(parser, init);
|
|
@@ -5865,7 +6097,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
5865
6097
|
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 4, 1, 1, 0, parser.tokenStart);
|
|
5866
6098
|
break;
|
|
5867
6099
|
}
|
|
5868
|
-
case
|
|
6100
|
+
case 133:
|
|
5869
6101
|
case 86094:
|
|
5870
6102
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
|
|
5871
6103
|
break;
|
|
@@ -5988,7 +6220,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
5988
6220
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5989
6221
|
break;
|
|
5990
6222
|
}
|
|
5991
|
-
case
|
|
6223
|
+
case 133:
|
|
5992
6224
|
case 86094:
|
|
5993
6225
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
5994
6226
|
break;
|
|
@@ -6326,7 +6558,7 @@ function parseSuperExpression(parser, context) {
|
|
|
6326
6558
|
const { tokenStart } = parser;
|
|
6327
6559
|
nextToken(parser, context);
|
|
6328
6560
|
switch (parser.getToken()) {
|
|
6329
|
-
case
|
|
6561
|
+
case 67108991:
|
|
6330
6562
|
parser.report(167);
|
|
6331
6563
|
case 67174411: {
|
|
6332
6564
|
if ((context & 512) === 0)
|
|
@@ -6373,10 +6605,13 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6373
6605
|
switch (parser.getToken()) {
|
|
6374
6606
|
case 67108877: {
|
|
6375
6607
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6376
|
-
if (context & 16 && parser.getToken() ===
|
|
6608
|
+
if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
|
|
6377
6609
|
parser.report(173);
|
|
6378
6610
|
}
|
|
6379
|
-
parser.assignable =
|
|
6611
|
+
parser.assignable =
|
|
6612
|
+
(parser.flags & 2048) === 2048
|
|
6613
|
+
? 2
|
|
6614
|
+
: 1;
|
|
6380
6615
|
const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
|
|
6381
6616
|
expr = parser.finishNode({
|
|
6382
6617
|
type: 'MemberExpression',
|
|
@@ -6401,7 +6636,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6401
6636
|
const { tokenStart } = parser;
|
|
6402
6637
|
const property = parseExpressions(parser, context, privateScope, inGroup, 1, tokenStart);
|
|
6403
6638
|
consume(parser, context, 20);
|
|
6404
|
-
parser.assignable = 1;
|
|
6639
|
+
parser.assignable = restoreHasOptionalChaining ? 2 : 1;
|
|
6405
6640
|
expr = parser.finishNode({
|
|
6406
6641
|
type: 'MemberExpression',
|
|
6407
6642
|
object: expr,
|
|
@@ -6442,7 +6677,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6442
6677
|
}
|
|
6443
6678
|
break;
|
|
6444
6679
|
}
|
|
6445
|
-
case
|
|
6680
|
+
case 67108991: {
|
|
6446
6681
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6447
6682
|
parser.flags |= 2048;
|
|
6448
6683
|
parser.assignable = 2;
|
|
@@ -6529,12 +6764,12 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
|
|
|
6529
6764
|
}
|
|
6530
6765
|
function parsePropertyOrPrivatePropertyName(parser, context, privateScope) {
|
|
6531
6766
|
if ((parser.getToken() & 143360) === 0 &&
|
|
6532
|
-
parser.getToken() !== -2147483528 &&
|
|
6533
6767
|
parser.getToken() !== -2147483527 &&
|
|
6534
|
-
parser.getToken() !==
|
|
6768
|
+
parser.getToken() !== -2147483526 &&
|
|
6769
|
+
parser.getToken() !== 131) {
|
|
6535
6770
|
parser.report(160);
|
|
6536
6771
|
}
|
|
6537
|
-
return parser.getToken() ===
|
|
6772
|
+
return parser.getToken() === 131
|
|
6538
6773
|
? parsePrivateIdentifier(parser, context, privateScope, 0)
|
|
6539
6774
|
: parseIdentifier(parser, context);
|
|
6540
6775
|
}
|
|
@@ -6627,7 +6862,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6627
6862
|
return parseThisExpression(parser, context);
|
|
6628
6863
|
case 65540:
|
|
6629
6864
|
return parseRegExpLiteral(parser, context);
|
|
6630
|
-
case
|
|
6865
|
+
case 133:
|
|
6631
6866
|
case 86094:
|
|
6632
6867
|
return parseClassExpression(parser, context, privateScope, inGroup, start);
|
|
6633
6868
|
case 86109:
|
|
@@ -6638,9 +6873,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6638
6873
|
return parseTemplate(parser, context, privateScope);
|
|
6639
6874
|
case 86107:
|
|
6640
6875
|
return parseNewExpression(parser, context, privateScope, inGroup);
|
|
6641
|
-
case
|
|
6876
|
+
case 134283389:
|
|
6642
6877
|
return parseBigIntLiteral(parser, context);
|
|
6643
|
-
case
|
|
6878
|
+
case 131:
|
|
6644
6879
|
return parsePrivateIdentifier(parser, context, privateScope, 0);
|
|
6645
6880
|
case 86106:
|
|
6646
6881
|
return parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start);
|
|
@@ -6669,7 +6904,7 @@ function parseImportMetaExpression(parser, context, meta, start) {
|
|
|
6669
6904
|
parser.report(169);
|
|
6670
6905
|
nextToken(parser, context);
|
|
6671
6906
|
const token = parser.getToken();
|
|
6672
|
-
if (token !==
|
|
6907
|
+
if (token !== 209031 && parser.tokenValue !== 'meta') {
|
|
6673
6908
|
parser.report(174);
|
|
6674
6909
|
}
|
|
6675
6910
|
else if (token & -2147483648) {
|
|
@@ -6717,7 +6952,7 @@ function parseImportAttributes(parser, context) {
|
|
|
6717
6952
|
const value = parseStringLiteral(parser, context);
|
|
6718
6953
|
const keyContent = key.type === 'Literal' ? key.value : key.name;
|
|
6719
6954
|
if (keysContent.has(keyContent)) {
|
|
6720
|
-
parser.report(145,
|
|
6955
|
+
parser.report(145, keyContent);
|
|
6721
6956
|
}
|
|
6722
6957
|
keysContent.add(keyContent);
|
|
6723
6958
|
attributes.push(parser.finishNode({
|
|
@@ -6893,7 +7128,7 @@ function parseIdentifier(parser, context) {
|
|
|
6893
7128
|
}
|
|
6894
7129
|
function parseLiteral(parser, context) {
|
|
6895
7130
|
const { tokenValue, tokenRaw, tokenStart } = parser;
|
|
6896
|
-
if (parser.getToken() ===
|
|
7131
|
+
if (parser.getToken() === 134283389) {
|
|
6897
7132
|
return parseBigIntLiteral(parser, context);
|
|
6898
7133
|
}
|
|
6899
7134
|
const node = {
|
|
@@ -7410,9 +7645,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7410
7645
|
let key = null;
|
|
7411
7646
|
let value;
|
|
7412
7647
|
if (parser.getToken() & 143360 ||
|
|
7413
|
-
parser.getToken() === -
|
|
7414
|
-
parser.getToken() === -
|
|
7415
|
-
if (parser.getToken() === -
|
|
7648
|
+
parser.getToken() === -2147483527 ||
|
|
7649
|
+
parser.getToken() === -2147483526) {
|
|
7650
|
+
if (parser.getToken() === -2147483526)
|
|
7416
7651
|
destructible |= 16;
|
|
7417
7652
|
key = parseIdentifier(parser, context);
|
|
7418
7653
|
if (parser.getToken() === 18 ||
|
|
@@ -7444,7 +7679,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7444
7679
|
else {
|
|
7445
7680
|
destructible |=
|
|
7446
7681
|
(token === 209006 ? 128 : 0) |
|
|
7447
|
-
(token === -
|
|
7682
|
+
(token === -2147483527 ? 16 : 0);
|
|
7448
7683
|
value = parser.cloneIdentifier(key);
|
|
7449
7684
|
}
|
|
7450
7685
|
}
|
|
@@ -7571,7 +7806,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7571
7806
|
}
|
|
7572
7807
|
else if (parser.getToken() & 143360) {
|
|
7573
7808
|
destructible |= 16;
|
|
7574
|
-
if (token === -
|
|
7809
|
+
if (token === -2147483527)
|
|
7575
7810
|
parser.report(95);
|
|
7576
7811
|
if (token === 209005) {
|
|
7577
7812
|
if (parser.flags & 1)
|
|
@@ -8382,7 +8617,7 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
8382
8617
|
const id = parseIdentifier(parser, context | 32);
|
|
8383
8618
|
const { tokenStart } = parser;
|
|
8384
8619
|
if (consumeOpt(parser, context, 67108877)) {
|
|
8385
|
-
if (context & 65536 && parser.getToken() ===
|
|
8620
|
+
if (context & 65536 && parser.getToken() === 209030) {
|
|
8386
8621
|
parser.assignable = 2;
|
|
8387
8622
|
return parseMetaProperty(parser, context, id, start);
|
|
8388
8623
|
}
|
|
@@ -8394,7 +8629,7 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
8394
8629
|
}
|
|
8395
8630
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
8396
8631
|
context = (context | 131072) ^ 131072;
|
|
8397
|
-
if (parser.getToken() ===
|
|
8632
|
+
if (parser.getToken() === 67108991)
|
|
8398
8633
|
parser.report(168);
|
|
8399
8634
|
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
8400
8635
|
parser.assignable = 2;
|
|
@@ -8595,7 +8830,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8595
8830
|
let start;
|
|
8596
8831
|
let decorators;
|
|
8597
8832
|
if (parser.leadingDecorators.decorators.length) {
|
|
8598
|
-
if (parser.getToken() ===
|
|
8833
|
+
if (parser.getToken() === 133) {
|
|
8599
8834
|
parser.report(30, '@');
|
|
8600
8835
|
}
|
|
8601
8836
|
start = parser.leadingDecorators.start;
|
|
@@ -8684,7 +8919,7 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
|
8684
8919
|
function parseDecorators(parser, context, privateScope) {
|
|
8685
8920
|
const list = [];
|
|
8686
8921
|
if (parser.options.next) {
|
|
8687
|
-
while (parser.getToken() ===
|
|
8922
|
+
while (parser.getToken() === 133) {
|
|
8688
8923
|
list.push(parseDecoratorList(parser, context, privateScope));
|
|
8689
8924
|
}
|
|
8690
8925
|
}
|
|
@@ -8737,7 +8972,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8737
8972
|
let kind = isStatic ? 32 : 0;
|
|
8738
8973
|
let key = null;
|
|
8739
8974
|
const token = parser.getToken();
|
|
8740
|
-
if (token & (143360 | 36864) || token === -
|
|
8975
|
+
if (token & (143360 | 36864) || token === -2147483527) {
|
|
8741
8976
|
key = parseIdentifier(parser, context);
|
|
8742
8977
|
switch (token) {
|
|
8743
8978
|
case 36970:
|
|
@@ -8800,7 +9035,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8800
9035
|
kind |= 8;
|
|
8801
9036
|
nextToken(parser, context);
|
|
8802
9037
|
}
|
|
8803
|
-
else if (parser.getToken() ===
|
|
9038
|
+
else if (parser.getToken() === 131) {
|
|
8804
9039
|
kind |= 8192;
|
|
8805
9040
|
key = parsePrivateIdentifier(parser, context | 16, privateScope, 768);
|
|
8806
9041
|
}
|
|
@@ -8810,7 +9045,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8810
9045
|
else if (isStatic && token === 2162700) {
|
|
8811
9046
|
return parseStaticBlock(parser, context | 16, scope, privateScope, start);
|
|
8812
9047
|
}
|
|
8813
|
-
else if (token === -
|
|
9048
|
+
else if (token === -2147483526) {
|
|
8814
9049
|
key = parseIdentifier(parser, context);
|
|
8815
9050
|
if (parser.getToken() !== 67174411)
|
|
8816
9051
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -8820,8 +9055,8 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8820
9055
|
}
|
|
8821
9056
|
if (kind & (8 | 16 | 768 | 1024)) {
|
|
8822
9057
|
if (parser.getToken() & 143360 ||
|
|
8823
|
-
parser.getToken() === -
|
|
8824
|
-
parser.getToken() === -
|
|
9058
|
+
parser.getToken() === -2147483527 ||
|
|
9059
|
+
parser.getToken() === -2147483526) {
|
|
8825
9060
|
key = parseIdentifier(parser, context);
|
|
8826
9061
|
}
|
|
8827
9062
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -8831,7 +9066,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
8831
9066
|
kind |= 2;
|
|
8832
9067
|
key = parseComputedPropertyName(parser, context, privateScope, 0);
|
|
8833
9068
|
}
|
|
8834
|
-
else if (parser.getToken() ===
|
|
9069
|
+
else if (parser.getToken() === 131) {
|
|
8835
9070
|
kind |= 8192;
|
|
8836
9071
|
key = parsePrivateIdentifier(parser, context, privateScope, kind);
|
|
8837
9072
|
}
|
|
@@ -8911,7 +9146,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
8911
9146
|
if (parser.getToken() === 1077936155) {
|
|
8912
9147
|
nextToken(parser, context | 32);
|
|
8913
9148
|
const { tokenStart } = parser;
|
|
8914
|
-
if (parser.getToken() ===
|
|
9149
|
+
if (parser.getToken() === 537079928)
|
|
8915
9150
|
parser.report(119);
|
|
8916
9151
|
const modifierFlags = 1024 |
|
|
8917
9152
|
2048 |
|
|
@@ -8943,7 +9178,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
8943
9178
|
}
|
|
8944
9179
|
function parseBindingPattern(parser, context, scope, privateScope, type, origin) {
|
|
8945
9180
|
if (parser.getToken() & 143360 ||
|
|
8946
|
-
((context & 1) === 0 && parser.getToken() === -
|
|
9181
|
+
((context & 1) === 0 && parser.getToken() === -2147483526))
|
|
8947
9182
|
return parseAndClassifyIdentifier(parser, context, scope, type, origin);
|
|
8948
9183
|
if ((parser.getToken() & 2097152) !== 2097152)
|
|
8949
9184
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -8962,7 +9197,7 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
|
8962
9197
|
if ((token & 537079808) === 537079808) {
|
|
8963
9198
|
parser.report(119);
|
|
8964
9199
|
}
|
|
8965
|
-
else if ((token & 36864) === 36864 || token === -
|
|
9200
|
+
else if ((token & 36864) === 36864 || token === -2147483526) {
|
|
8966
9201
|
parser.report(118);
|
|
8967
9202
|
}
|
|
8968
9203
|
}
|
|
@@ -9083,7 +9318,7 @@ function parseJSXChildrenAndClosingFragment(parser, context, privateScope, inJSX
|
|
|
9083
9318
|
}
|
|
9084
9319
|
}
|
|
9085
9320
|
function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild) {
|
|
9086
|
-
if (parser.getToken() ===
|
|
9321
|
+
if (parser.getToken() === 138)
|
|
9087
9322
|
return parseJSXText(parser, context);
|
|
9088
9323
|
if (parser.getToken() === 2162700)
|
|
9089
9324
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
@@ -9097,7 +9332,7 @@ function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild
|
|
|
9097
9332
|
parser.report(0);
|
|
9098
9333
|
}
|
|
9099
9334
|
function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChild) {
|
|
9100
|
-
if (parser.getToken() ===
|
|
9335
|
+
if (parser.getToken() === 138)
|
|
9101
9336
|
return parseJSXText(parser, context);
|
|
9102
9337
|
if (parser.getToken() === 2162700)
|
|
9103
9338
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|