meriyah 7.2.0 → 7.3.1
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 +27 -0
- package/README.md +1 -3
- package/dist/meriyah.cjs +634 -430
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +634 -430
- package/dist/meriyah.umd.js +634 -430
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/errors.d.ts +74 -70
- package/dist/types/estree.d.ts +2 -0
- package/dist/types/features.d.ts +7 -0
- package/dist/types/options.d.ts +6 -2
- package/dist/types/parser/parser.d.ts +8 -3
- package/dist/types/parser/scope.d.ts +1 -1
- package/dist/types/parser.d.ts +2 -2
- package/dist/types/token.d.ts +3 -3
- package/package.json +1 -1
- package/dist/types/utilities.d.ts +0 -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.3.1";
|
|
4
4
|
var packageJson = {
|
|
5
5
|
version: version$1};
|
|
6
6
|
|
|
@@ -93,7 +93,7 @@ const CharTypes = [
|
|
|
93
93
|
0,
|
|
94
94
|
16384,
|
|
95
95
|
0,
|
|
96
|
-
|
|
96
|
+
16384,
|
|
97
97
|
0,
|
|
98
98
|
0,
|
|
99
99
|
1 | 2 | 64,
|
|
@@ -156,7 +156,7 @@ const CharTypes = [
|
|
|
156
156
|
1 | 2 | 4,
|
|
157
157
|
16384,
|
|
158
158
|
0,
|
|
159
|
-
|
|
159
|
+
16384,
|
|
160
160
|
0,
|
|
161
161
|
0
|
|
162
162
|
];
|
|
@@ -623,7 +623,7 @@ const errorMessages = {
|
|
|
623
623
|
[9]: 'Octal literals are not allowed in strict mode',
|
|
624
624
|
[8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
|
|
625
625
|
[10]: 'Expected number in radix %0',
|
|
626
|
-
[
|
|
626
|
+
[153]: 'Invalid left-hand side assignment to a destructible right-hand side',
|
|
627
627
|
[11]: 'Non-number found after exponent indicator',
|
|
628
628
|
[12]: 'Invalid BigIntLiteral',
|
|
629
629
|
[13]: 'No identifiers allowed directly after numeric literal',
|
|
@@ -647,7 +647,7 @@ const errorMessages = {
|
|
|
647
647
|
[32]: 'Yield expression not allowed in formal parameter',
|
|
648
648
|
[95]: "Unexpected token: 'escaped keyword'",
|
|
649
649
|
[33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
|
|
650
|
-
[
|
|
650
|
+
[125]: 'Async functions can only be declared at the top level or inside a block',
|
|
651
651
|
[34]: 'Unterminated regular expression',
|
|
652
652
|
[35]: 'Unexpected regular expression flag',
|
|
653
653
|
[36]: "Duplicate regular expression flag '%0'",
|
|
@@ -659,7 +659,7 @@ const errorMessages = {
|
|
|
659
659
|
[42]: 'A getter cannot be a generator',
|
|
660
660
|
[43]: 'A setter cannot be a generator',
|
|
661
661
|
[44]: 'A computed property name must be followed by a colon or paren',
|
|
662
|
-
[
|
|
662
|
+
[136]: 'Object literal keys that are strings or numbers must be a method or have a colon',
|
|
663
663
|
[46]: 'Found `* async x(){}` but this should be `async * x(){}`',
|
|
664
664
|
[45]: 'Getters and setters can not be generators',
|
|
665
665
|
[47]: "'%0' can not be generator method",
|
|
@@ -721,73 +721,77 @@ const errorMessages = {
|
|
|
721
721
|
[105]: '%0 source must be string',
|
|
722
722
|
[106]: 'Only a identifier or string can be used to indicate alias',
|
|
723
723
|
[107]: "Only '*' or '{...}' can be imported after default",
|
|
724
|
-
[108]: '
|
|
725
|
-
[109]: "
|
|
726
|
-
[110]: '
|
|
727
|
-
[111]: '
|
|
728
|
-
[112]: '
|
|
729
|
-
[113]:
|
|
730
|
-
[114]: '
|
|
731
|
-
[115]: "The
|
|
732
|
-
[116]: '
|
|
733
|
-
[117]:
|
|
734
|
-
[118]: '
|
|
735
|
-
[119]: '
|
|
736
|
-
[120]: '
|
|
737
|
-
[121]: '
|
|
738
|
-
[122]: '
|
|
739
|
-
[
|
|
740
|
-
[
|
|
741
|
-
[126]: '
|
|
742
|
-
[127]: '
|
|
743
|
-
[
|
|
744
|
-
[
|
|
745
|
-
[
|
|
746
|
-
[
|
|
747
|
-
[132]: '
|
|
748
|
-
[133]: '
|
|
749
|
-
[
|
|
750
|
-
[
|
|
751
|
-
[137]: '
|
|
752
|
-
[138]: "
|
|
753
|
-
[139]: '
|
|
754
|
-
[140]:
|
|
755
|
-
[141]: 'import()
|
|
756
|
-
[142]: '
|
|
757
|
-
[143]: '
|
|
758
|
-
[144]:
|
|
759
|
-
[145]:
|
|
760
|
-
[146]:
|
|
761
|
-
[147]: "
|
|
762
|
-
[
|
|
763
|
-
[
|
|
764
|
-
[
|
|
765
|
-
[
|
|
766
|
-
[
|
|
767
|
-
[
|
|
768
|
-
[
|
|
769
|
-
[156]: '
|
|
770
|
-
[157]:
|
|
771
|
-
[158]:
|
|
772
|
-
[159]: "
|
|
773
|
-
[160]: '
|
|
774
|
-
[161]: '
|
|
775
|
-
[162]: '
|
|
776
|
-
[163]: '
|
|
777
|
-
[164]: '
|
|
778
|
-
[165]: '
|
|
779
|
-
[166]: '
|
|
780
|
-
[167]: '
|
|
781
|
-
[168]: 'Invalid
|
|
782
|
-
[169]: '
|
|
783
|
-
[170]: '
|
|
784
|
-
[171]: '
|
|
785
|
-
[172]: '
|
|
786
|
-
[173]:
|
|
787
|
-
[174]:
|
|
788
|
-
[175]: "'
|
|
789
|
-
[176]:
|
|
790
|
-
[177]: '
|
|
724
|
+
[108]: "'import defer' must be followed by a namespace import",
|
|
725
|
+
[109]: "'import source' must be followed by a default import",
|
|
726
|
+
[110]: 'Trailing decorator may be followed by method',
|
|
727
|
+
[111]: "Decorators can't be used with a constructor",
|
|
728
|
+
[112]: 'Can not use `await` as identifier in module or async func',
|
|
729
|
+
[113]: 'Can not use `await` as identifier in module',
|
|
730
|
+
[114]: 'HTML comments are only allowed with web compatibility (Annex B)',
|
|
731
|
+
[115]: "The identifier 'let' must not be in expression position in strict mode",
|
|
732
|
+
[116]: 'Cannot assign to `eval` and `arguments` in strict mode',
|
|
733
|
+
[117]: "The left-hand side of a for-of loop may not start with 'let'",
|
|
734
|
+
[118]: 'Block body arrows can not be immediately invoked without a group',
|
|
735
|
+
[119]: 'Block body arrows can not be immediately accessed without a group',
|
|
736
|
+
[120]: 'Unexpected strict mode reserved word',
|
|
737
|
+
[121]: 'Unexpected eval or arguments in strict mode',
|
|
738
|
+
[122]: 'Decorators must not be followed by a semicolon',
|
|
739
|
+
[123]: 'Calling delete on expression not allowed in strict mode',
|
|
740
|
+
[124]: 'Pattern can not have a tail',
|
|
741
|
+
[126]: 'Can not have a `yield` expression on the left side of a ternary',
|
|
742
|
+
[127]: 'An arrow function can not have a postfix update operator',
|
|
743
|
+
[128]: 'Invalid object literal key character after generator star',
|
|
744
|
+
[129]: 'Private fields can not be deleted',
|
|
745
|
+
[131]: 'Classes may not have a field called constructor',
|
|
746
|
+
[130]: 'Classes may not have a private element named constructor',
|
|
747
|
+
[132]: 'A class field initializer or static block may not contain arguments',
|
|
748
|
+
[133]: 'Generators can only be declared at the top level or inside a block',
|
|
749
|
+
[134]: 'Async methods are a restricted production and cannot have a newline following it',
|
|
750
|
+
[135]: 'Unexpected character after object literal property name',
|
|
751
|
+
[137]: 'Invalid key token',
|
|
752
|
+
[138]: "Label '%0' has already been declared",
|
|
753
|
+
[139]: 'continue statement must be nested within an iteration statement',
|
|
754
|
+
[140]: "Undefined label '%0'",
|
|
755
|
+
[141]: 'Trailing comma is disallowed inside import(...) arguments',
|
|
756
|
+
[142]: 'Invalid binding in JSON import',
|
|
757
|
+
[143]: 'import() requires exactly one argument',
|
|
758
|
+
[144]: 'Cannot use new with import(...)',
|
|
759
|
+
[145]: '... is not allowed in import()',
|
|
760
|
+
[146]: "Expected '=>'",
|
|
761
|
+
[147]: "Duplicate binding '%0'",
|
|
762
|
+
[148]: 'Duplicate private identifier #%0',
|
|
763
|
+
[149]: "Cannot export a duplicate name '%0'",
|
|
764
|
+
[152]: 'Duplicate %0 for-binding',
|
|
765
|
+
[150]: "Exported binding '%0' needs to refer to a top-level declared variable",
|
|
766
|
+
[151]: 'Unexpected private field',
|
|
767
|
+
[155]: 'Numeric separators are not allowed at the end of numeric literals',
|
|
768
|
+
[154]: 'Only one underscore is allowed as numeric separator',
|
|
769
|
+
[156]: 'JSX value should be either an expression or a quoted JSX text',
|
|
770
|
+
[157]: 'Expected corresponding JSX closing tag for %0',
|
|
771
|
+
[158]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
|
|
772
|
+
[159]: "JSX attributes must only be assigned a non-empty 'expression'",
|
|
773
|
+
[160]: "'%0' has already been declared",
|
|
774
|
+
[161]: "'%0' shadowed a catch clause binding",
|
|
775
|
+
[162]: 'Dot property must be an identifier',
|
|
776
|
+
[163]: 'Encountered invalid input after spread/rest argument',
|
|
777
|
+
[164]: 'Catch without try',
|
|
778
|
+
[165]: 'Finally without try',
|
|
779
|
+
[166]: 'Expected corresponding closing tag for JSX fragment',
|
|
780
|
+
[167]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
|
|
781
|
+
[168]: 'Invalid tagged template on optional chain',
|
|
782
|
+
[169]: 'Invalid optional chain from super property',
|
|
783
|
+
[170]: 'Invalid optional chain from new expression',
|
|
784
|
+
[171]: 'Cannot use "import.meta" outside a module',
|
|
785
|
+
[172]: 'Leading decorators must be attached to a class declaration',
|
|
786
|
+
[173]: 'An export name cannot include a lone surrogate',
|
|
787
|
+
[174]: 'A string literal cannot be used as an exported binding without `from`',
|
|
788
|
+
[175]: "Private fields can't be accessed on super",
|
|
789
|
+
[176]: "The only valid meta property for import is 'import.meta'",
|
|
790
|
+
[177]: "'import.meta' must not contain escaped characters",
|
|
791
|
+
[178]: 'cannot use "await" as identifier inside an async function',
|
|
792
|
+
[179]: 'cannot use "await" in static blocks',
|
|
793
|
+
[180]: "Unexpected token `}`. Did you mean `}` or `{'}'}`?",
|
|
794
|
+
[181]: "Unexpected token `>`. Did you mean `>` or `{'>'}`?",
|
|
791
795
|
};
|
|
792
796
|
class ParseError extends SyntaxError {
|
|
793
797
|
start;
|
|
@@ -811,10 +815,6 @@ class ParseError extends SyntaxError {
|
|
|
811
815
|
}
|
|
812
816
|
const isParseError = (error) => error instanceof ParseError;
|
|
813
817
|
|
|
814
|
-
function getOwnProperty(object, key) {
|
|
815
|
-
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
818
|
const KeywordDescTable = [
|
|
819
819
|
'end of source',
|
|
820
820
|
'identifier', 'number', 'string', 'regular expression',
|
|
@@ -836,75 +836,82 @@ const KeywordDescTable = [
|
|
|
836
836
|
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
837
837
|
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
838
838
|
];
|
|
839
|
-
const descKeywordTable =
|
|
840
|
-
this
|
|
841
|
-
function
|
|
842
|
-
if
|
|
843
|
-
return
|
|
844
|
-
var
|
|
845
|
-
else
|
|
846
|
-
for
|
|
847
|
-
new
|
|
848
|
-
in
|
|
849
|
-
typeof
|
|
850
|
-
while
|
|
851
|
-
case
|
|
852
|
-
break
|
|
853
|
-
try
|
|
854
|
-
catch
|
|
855
|
-
delete
|
|
856
|
-
throw
|
|
857
|
-
switch
|
|
858
|
-
continue
|
|
859
|
-
default
|
|
860
|
-
instanceof
|
|
861
|
-
do
|
|
862
|
-
void
|
|
863
|
-
finally
|
|
864
|
-
async
|
|
865
|
-
await
|
|
866
|
-
class
|
|
867
|
-
const
|
|
868
|
-
constructor
|
|
869
|
-
debugger
|
|
870
|
-
export
|
|
871
|
-
extends
|
|
872
|
-
false
|
|
873
|
-
from
|
|
874
|
-
get
|
|
875
|
-
implements
|
|
876
|
-
import
|
|
877
|
-
interface
|
|
878
|
-
let
|
|
879
|
-
null
|
|
880
|
-
of
|
|
881
|
-
using
|
|
882
|
-
package
|
|
883
|
-
private
|
|
884
|
-
protected
|
|
885
|
-
public
|
|
886
|
-
set
|
|
887
|
-
static
|
|
888
|
-
super
|
|
889
|
-
true
|
|
890
|
-
with
|
|
891
|
-
yield
|
|
892
|
-
enum
|
|
893
|
-
eval
|
|
894
|
-
as
|
|
895
|
-
arguments
|
|
896
|
-
target
|
|
897
|
-
meta
|
|
898
|
-
accessor
|
|
899
|
-
|
|
839
|
+
const descKeywordTable = new Map([
|
|
840
|
+
['this', 86111],
|
|
841
|
+
['function', 86104],
|
|
842
|
+
['if', 20569],
|
|
843
|
+
['return', 20572],
|
|
844
|
+
['var', 86088],
|
|
845
|
+
['else', 20563],
|
|
846
|
+
['for', 20567],
|
|
847
|
+
['new', 86107],
|
|
848
|
+
['in', 8673330],
|
|
849
|
+
['typeof', 16863275],
|
|
850
|
+
['while', 20578],
|
|
851
|
+
['case', 20556],
|
|
852
|
+
['break', 20555],
|
|
853
|
+
['try', 20577],
|
|
854
|
+
['catch', 20557],
|
|
855
|
+
['delete', 16863276],
|
|
856
|
+
['throw', 86112],
|
|
857
|
+
['switch', 86110],
|
|
858
|
+
['continue', 20559],
|
|
859
|
+
['default', 20561],
|
|
860
|
+
['instanceof', 8411187],
|
|
861
|
+
['do', 20562],
|
|
862
|
+
['void', 16863277],
|
|
863
|
+
['finally', 20566],
|
|
864
|
+
['async', 209005],
|
|
865
|
+
['await', 209006],
|
|
866
|
+
['class', 86094],
|
|
867
|
+
['const', 86090],
|
|
868
|
+
['constructor', 12399],
|
|
869
|
+
['debugger', 20560],
|
|
870
|
+
['export', 20564],
|
|
871
|
+
['extends', 20565],
|
|
872
|
+
['false', 86021],
|
|
873
|
+
['from', 209011],
|
|
874
|
+
['get', 209008],
|
|
875
|
+
['implements', 36964],
|
|
876
|
+
['import', 86106],
|
|
877
|
+
['interface', 36965],
|
|
878
|
+
['let', 241737],
|
|
879
|
+
['null', 86023],
|
|
880
|
+
['of', 471156],
|
|
881
|
+
['using', 209013],
|
|
882
|
+
['package', 36966],
|
|
883
|
+
['private', 36967],
|
|
884
|
+
['protected', 36968],
|
|
885
|
+
['public', 36969],
|
|
886
|
+
['set', 209009],
|
|
887
|
+
['static', 36970],
|
|
888
|
+
['super', 86109],
|
|
889
|
+
['true', 86022],
|
|
890
|
+
['with', 20579],
|
|
891
|
+
['yield', 241771],
|
|
892
|
+
['enum', 86134],
|
|
893
|
+
['eval', 537079927],
|
|
894
|
+
['as', 77932],
|
|
895
|
+
['arguments', 537079928],
|
|
896
|
+
['target', 209030],
|
|
897
|
+
['meta', 209031],
|
|
898
|
+
['accessor', 12402],
|
|
899
|
+
]);
|
|
900
|
+
const keywordLengths = [...descKeywordTable.keys()].map((keyword) => keyword.length);
|
|
901
|
+
const minKeywordLength = Math.min(...keywordLengths);
|
|
902
|
+
const maxKeywordLength = Math.max(...keywordLengths);
|
|
900
903
|
|
|
901
904
|
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
902
905
|
while (isIdPart[advanceChar(parser)])
|
|
903
906
|
;
|
|
904
907
|
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
+
if (parser.currentChar === 92 || parser.currentChar > 0x7e) {
|
|
909
|
+
return scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
910
|
+
}
|
|
911
|
+
const length = parser.index - parser.tokenIndex;
|
|
912
|
+
if (length < minKeywordLength || length > maxKeywordLength)
|
|
913
|
+
return 208897;
|
|
914
|
+
return descKeywordTable.get(parser.tokenValue) ?? 208897;
|
|
908
915
|
}
|
|
909
916
|
function scanUnicodeIdentifier(parser, context) {
|
|
910
917
|
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
@@ -946,8 +953,8 @@ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
|
|
|
946
953
|
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
947
954
|
}
|
|
948
955
|
const { length } = parser.tokenValue;
|
|
949
|
-
if (isValidAsKeyword && length >=
|
|
950
|
-
const token =
|
|
956
|
+
if (isValidAsKeyword && length >= minKeywordLength && length <= maxKeywordLength) {
|
|
957
|
+
const token = descKeywordTable.get(parser.tokenValue);
|
|
951
958
|
if (token === void 0)
|
|
952
959
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
953
960
|
if (!hasEscape)
|
|
@@ -1071,7 +1078,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1071
1078
|
while (CharTypes[char] & (64 | 4096)) {
|
|
1072
1079
|
if (char === 95) {
|
|
1073
1080
|
if (!allowSeparator)
|
|
1074
|
-
parser.report(
|
|
1081
|
+
parser.report(154);
|
|
1075
1082
|
allowSeparator = 0;
|
|
1076
1083
|
char = advanceChar(parser);
|
|
1077
1084
|
continue;
|
|
@@ -1082,7 +1089,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1082
1089
|
char = advanceChar(parser);
|
|
1083
1090
|
}
|
|
1084
1091
|
if (digits === 0 || !allowSeparator) {
|
|
1085
|
-
parser.report(digits === 0 ? 21 :
|
|
1092
|
+
parser.report(digits === 0 ? 21 : 155);
|
|
1086
1093
|
}
|
|
1087
1094
|
}
|
|
1088
1095
|
else if ((char | 32) === 111) {
|
|
@@ -1091,7 +1098,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1091
1098
|
while (CharTypes[char] & (32 | 4096)) {
|
|
1092
1099
|
if (char === 95) {
|
|
1093
1100
|
if (!allowSeparator) {
|
|
1094
|
-
parser.report(
|
|
1101
|
+
parser.report(154);
|
|
1095
1102
|
}
|
|
1096
1103
|
allowSeparator = 0;
|
|
1097
1104
|
char = advanceChar(parser);
|
|
@@ -1103,7 +1110,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1103
1110
|
char = advanceChar(parser);
|
|
1104
1111
|
}
|
|
1105
1112
|
if (digits === 0 || !allowSeparator) {
|
|
1106
|
-
parser.report(digits === 0 ? 0 :
|
|
1113
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1107
1114
|
}
|
|
1108
1115
|
}
|
|
1109
1116
|
else if ((char | 32) === 98) {
|
|
@@ -1112,7 +1119,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1112
1119
|
while (CharTypes[char] & (128 | 4096)) {
|
|
1113
1120
|
if (char === 95) {
|
|
1114
1121
|
if (!allowSeparator) {
|
|
1115
|
-
parser.report(
|
|
1122
|
+
parser.report(154);
|
|
1116
1123
|
}
|
|
1117
1124
|
allowSeparator = 0;
|
|
1118
1125
|
char = advanceChar(parser);
|
|
@@ -1124,7 +1131,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1124
1131
|
char = advanceChar(parser);
|
|
1125
1132
|
}
|
|
1126
1133
|
if (digits === 0 || !allowSeparator) {
|
|
1127
|
-
parser.report(digits === 0 ? 0 :
|
|
1134
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1128
1135
|
}
|
|
1129
1136
|
}
|
|
1130
1137
|
else if (CharTypes[char] & 32) {
|
|
@@ -1157,7 +1164,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1157
1164
|
if (char === 95) {
|
|
1158
1165
|
char = advanceChar(parser);
|
|
1159
1166
|
if (char === 95 || kind & 32) {
|
|
1160
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1167
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
|
|
1161
1168
|
}
|
|
1162
1169
|
allowSeparator = 1;
|
|
1163
1170
|
continue;
|
|
@@ -1168,7 +1175,7 @@ function scanNumber(parser, context, kind) {
|
|
|
1168
1175
|
--digit;
|
|
1169
1176
|
}
|
|
1170
1177
|
if (allowSeparator) {
|
|
1171
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1178
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
|
|
1172
1179
|
}
|
|
1173
1180
|
if (digit >= 0 && !isIdentifierStart(char) && char !== 46) {
|
|
1174
1181
|
parser.tokenValue = value;
|
|
@@ -1233,7 +1240,7 @@ function scanDecimalDigitsOrSeparator(parser, char) {
|
|
|
1233
1240
|
const { index } = parser;
|
|
1234
1241
|
char = advanceChar(parser);
|
|
1235
1242
|
if (char === 95) {
|
|
1236
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1243
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
|
|
1237
1244
|
}
|
|
1238
1245
|
allowSeparator = 1;
|
|
1239
1246
|
ret += parser.source.substring(start, index);
|
|
@@ -1244,7 +1251,7 @@ function scanDecimalDigitsOrSeparator(parser, char) {
|
|
|
1244
1251
|
char = advanceChar(parser);
|
|
1245
1252
|
}
|
|
1246
1253
|
if (allowSeparator) {
|
|
1247
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1254
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
|
|
1248
1255
|
}
|
|
1249
1256
|
return ret + parser.source.substring(start, parser.index);
|
|
1250
1257
|
}
|
|
@@ -1965,7 +1972,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
1965
1972
|
advanceChar(parser);
|
|
1966
1973
|
if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
|
|
1967
1974
|
if (!parser.options.webcompat)
|
|
1968
|
-
parser.report(
|
|
1975
|
+
parser.report(114);
|
|
1969
1976
|
advanceChar(parser);
|
|
1970
1977
|
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
1971
1978
|
continue;
|
|
@@ -2194,10 +2201,10 @@ function reinterpretToPattern(parser, node) {
|
|
|
2194
2201
|
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2195
2202
|
if (context & 1) {
|
|
2196
2203
|
if ((t & 36864) === 36864) {
|
|
2197
|
-
parser.report(
|
|
2204
|
+
parser.report(120);
|
|
2198
2205
|
}
|
|
2199
2206
|
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2200
|
-
parser.report(
|
|
2207
|
+
parser.report(121);
|
|
2201
2208
|
}
|
|
2202
2209
|
}
|
|
2203
2210
|
if ((t & 20480) === 20480 || t === -2147483527) {
|
|
@@ -2207,7 +2214,7 @@ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
|
2207
2214
|
parser.report(100);
|
|
2208
2215
|
}
|
|
2209
2216
|
if (context & (2048 | 2) && t === 209006) {
|
|
2210
|
-
parser.report(
|
|
2217
|
+
parser.report(112);
|
|
2211
2218
|
}
|
|
2212
2219
|
if (context & (1024 | 1) && t === 241771) {
|
|
2213
2220
|
parser.report(97, 'yield');
|
|
@@ -2216,10 +2223,10 @@ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
|
2216
2223
|
function validateFunctionName(parser, context, t) {
|
|
2217
2224
|
if (context & 1) {
|
|
2218
2225
|
if ((t & 36864) === 36864) {
|
|
2219
|
-
parser.report(
|
|
2226
|
+
parser.report(120);
|
|
2220
2227
|
}
|
|
2221
2228
|
if ((t & 537079808) === 537079808) {
|
|
2222
|
-
parser.report(
|
|
2229
|
+
parser.report(121);
|
|
2223
2230
|
}
|
|
2224
2231
|
if (t === -2147483526) {
|
|
2225
2232
|
parser.report(95);
|
|
@@ -2232,7 +2239,7 @@ function validateFunctionName(parser, context, t) {
|
|
|
2232
2239
|
parser.report(102);
|
|
2233
2240
|
}
|
|
2234
2241
|
if (context & (2048 | 2) && t === 209006) {
|
|
2235
|
-
parser.report(
|
|
2242
|
+
parser.report(112);
|
|
2236
2243
|
}
|
|
2237
2244
|
if (context & (1024 | 1) && t === 241771) {
|
|
2238
2245
|
parser.report(97, 'yield');
|
|
@@ -2241,7 +2248,10 @@ function validateFunctionName(parser, context, t) {
|
|
|
2241
2248
|
function isStrictReservedWord(parser, context, t) {
|
|
2242
2249
|
if (t === 209006) {
|
|
2243
2250
|
if (context & (2048 | 2))
|
|
2244
|
-
parser.report(
|
|
2251
|
+
parser.report(112);
|
|
2252
|
+
if ((parser.destructible & 128) === 0) {
|
|
2253
|
+
parser.firstAwaitLocation ??= { start: parser.tokenStart, end: parser.currentLocation };
|
|
2254
|
+
}
|
|
2245
2255
|
parser.destructible |= 128;
|
|
2246
2256
|
}
|
|
2247
2257
|
if (t === 241771 && context & 1024)
|
|
@@ -2257,7 +2267,7 @@ function isValidLabel(parser, labels, name, isIterationStatement) {
|
|
|
2257
2267
|
while (labels) {
|
|
2258
2268
|
if (labels['$' + name]) {
|
|
2259
2269
|
if (isIterationStatement)
|
|
2260
|
-
parser.report(
|
|
2270
|
+
parser.report(139);
|
|
2261
2271
|
return 1;
|
|
2262
2272
|
}
|
|
2263
2273
|
if (isIterationStatement && labels.loop)
|
|
@@ -2270,7 +2280,7 @@ function validateAndDeclareLabel(parser, labels, name) {
|
|
|
2270
2280
|
let set = labels;
|
|
2271
2281
|
while (set) {
|
|
2272
2282
|
if (set['$' + name])
|
|
2273
|
-
parser.report(
|
|
2283
|
+
parser.report(138, name);
|
|
2274
2284
|
set = set['$'];
|
|
2275
2285
|
}
|
|
2276
2286
|
labels['$' + name] = 1;
|
|
@@ -2298,14 +2308,14 @@ function isValidIdentifier(context, t) {
|
|
|
2298
2308
|
function classifyIdentifier(parser, context, t) {
|
|
2299
2309
|
if ((t & 537079808) === 537079808) {
|
|
2300
2310
|
if (context & 1)
|
|
2301
|
-
parser.report(
|
|
2311
|
+
parser.report(121);
|
|
2302
2312
|
parser.flags |= 512;
|
|
2303
2313
|
}
|
|
2304
2314
|
if (!isValidIdentifier(context, t))
|
|
2305
2315
|
parser.report(0);
|
|
2306
2316
|
}
|
|
2307
2317
|
|
|
2308
|
-
const entities = {
|
|
2318
|
+
const entities = new Map(Object.entries({
|
|
2309
2319
|
AElig: '\u00C6',
|
|
2310
2320
|
AMP: '\u0026',
|
|
2311
2321
|
Aacute: '\u00C1',
|
|
@@ -4431,8 +4441,8 @@ const entities = {
|
|
|
4431
4441
|
zscr: '\uD835\uDCCF',
|
|
4432
4442
|
zwj: '\u200D',
|
|
4433
4443
|
zwnj: '\u200C',
|
|
4434
|
-
};
|
|
4435
|
-
const decodeMap = {
|
|
4444
|
+
}));
|
|
4445
|
+
const decodeMap = new Map(Object.entries({
|
|
4436
4446
|
'0': 65533,
|
|
4437
4447
|
'128': 8364,
|
|
4438
4448
|
'130': 8218,
|
|
@@ -4461,7 +4471,7 @@ const decodeMap = {
|
|
|
4461
4471
|
'156': 339,
|
|
4462
4472
|
'158': 382,
|
|
4463
4473
|
'159': 376,
|
|
4464
|
-
};
|
|
4474
|
+
}).map(([key, value]) => [Number(key), value]));
|
|
4465
4475
|
function decodeHTMLStrict(text) {
|
|
4466
4476
|
return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
|
|
4467
4477
|
if (key.charAt(1) === '#') {
|
|
@@ -4469,14 +4479,14 @@ function decodeHTMLStrict(text) {
|
|
|
4469
4479
|
const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
|
|
4470
4480
|
return decodeCodePoint(codePoint);
|
|
4471
4481
|
}
|
|
4472
|
-
return
|
|
4482
|
+
return entities.get(key.slice(1, -1)) ?? key;
|
|
4473
4483
|
});
|
|
4474
4484
|
}
|
|
4475
4485
|
function decodeCodePoint(codePoint) {
|
|
4476
4486
|
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
4477
4487
|
return '\uFFFD';
|
|
4478
4488
|
}
|
|
4479
|
-
return String.fromCodePoint(
|
|
4489
|
+
return String.fromCodePoint(decodeMap.get(codePoint) ?? codePoint);
|
|
4480
4490
|
}
|
|
4481
4491
|
|
|
4482
4492
|
function scanJSXAttributeValue(parser, context) {
|
|
@@ -4523,6 +4533,12 @@ function nextJSXToken(parser) {
|
|
|
4523
4533
|
parser.setToken(2162700);
|
|
4524
4534
|
return;
|
|
4525
4535
|
}
|
|
4536
|
+
if (parser.currentChar === 125) {
|
|
4537
|
+
parser.report(180);
|
|
4538
|
+
}
|
|
4539
|
+
if (parser.currentChar === 62) {
|
|
4540
|
+
parser.report(181);
|
|
4541
|
+
}
|
|
4526
4542
|
let state = 0;
|
|
4527
4543
|
while (parser.index < parser.end) {
|
|
4528
4544
|
const type = CharTypes[parser.source.charCodeAt(parser.index)];
|
|
@@ -4561,6 +4577,8 @@ function rescanJSXIdentifier(parser) {
|
|
|
4561
4577
|
return parser.getToken();
|
|
4562
4578
|
}
|
|
4563
4579
|
|
|
4580
|
+
const nextFeatures = 1 | 2 | 4;
|
|
4581
|
+
|
|
4564
4582
|
function normalizeRanges(ranges) {
|
|
4565
4583
|
if (!ranges)
|
|
4566
4584
|
return undefined;
|
|
@@ -4573,17 +4591,27 @@ function normalizeRanges(ranges) {
|
|
|
4573
4591
|
};
|
|
4574
4592
|
}
|
|
4575
4593
|
function normalizeOptions(rawOptions) {
|
|
4576
|
-
|
|
4594
|
+
let { features, next, ranges, module, sourceType, globalReturn, ...restOptions } = {
|
|
4577
4595
|
validateRegex: true,
|
|
4596
|
+
features: 0,
|
|
4578
4597
|
...rawOptions,
|
|
4579
|
-
ranges: normalizeRanges(rawOptions.ranges),
|
|
4580
4598
|
};
|
|
4581
|
-
if (
|
|
4582
|
-
|
|
4599
|
+
if (next) {
|
|
4600
|
+
features |= nextFeatures;
|
|
4583
4601
|
}
|
|
4584
|
-
|
|
4585
|
-
|
|
4602
|
+
ranges = normalizeRanges(ranges);
|
|
4603
|
+
if (module && !sourceType) {
|
|
4604
|
+
sourceType = 'module';
|
|
4586
4605
|
}
|
|
4606
|
+
if (globalReturn && (!sourceType || sourceType === 'script')) {
|
|
4607
|
+
sourceType = 'commonjs';
|
|
4608
|
+
}
|
|
4609
|
+
const options = {
|
|
4610
|
+
...restOptions,
|
|
4611
|
+
ranges,
|
|
4612
|
+
features,
|
|
4613
|
+
sourceType,
|
|
4614
|
+
};
|
|
4587
4615
|
return options;
|
|
4588
4616
|
}
|
|
4589
4617
|
|
|
@@ -4604,7 +4632,7 @@ class PrivateScope {
|
|
|
4604
4632
|
const value = privateIdentifiers.get(name);
|
|
4605
4633
|
if (this.hasPrivateIdentifier(name) &&
|
|
4606
4634
|
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4607
|
-
this.parser.report(
|
|
4635
|
+
this.parser.report(148, name);
|
|
4608
4636
|
}
|
|
4609
4637
|
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4610
4638
|
}
|
|
@@ -4665,17 +4693,17 @@ class Scope {
|
|
|
4665
4693
|
((kind & 128 && value & 68) ||
|
|
4666
4694
|
(value & 128 && kind & 68))) ;
|
|
4667
4695
|
else {
|
|
4668
|
-
parser.report(
|
|
4696
|
+
parser.report(147, name);
|
|
4669
4697
|
}
|
|
4670
4698
|
}
|
|
4671
4699
|
if (currentScope === this) {
|
|
4672
4700
|
if (value && value & 1 && kind & 1) {
|
|
4673
|
-
currentScope.recordScopeError(
|
|
4701
|
+
currentScope.recordScopeError(147, name);
|
|
4674
4702
|
}
|
|
4675
4703
|
}
|
|
4676
4704
|
if (value &&
|
|
4677
4705
|
(value & 256 || (value & 512 && !parser.options.webcompat))) {
|
|
4678
|
-
parser.report(
|
|
4706
|
+
parser.report(147, name);
|
|
4679
4707
|
}
|
|
4680
4708
|
currentScope.variableBindings.set(name, kind);
|
|
4681
4709
|
currentScope = currentScope.parent;
|
|
@@ -4684,12 +4712,12 @@ class Scope {
|
|
|
4684
4712
|
hasVariable(name) {
|
|
4685
4713
|
return this.variableBindings.has(name);
|
|
4686
4714
|
}
|
|
4687
|
-
addBlockName(context, name, kind, origin) {
|
|
4715
|
+
addBlockName(context, name, kind, origin = 0) {
|
|
4688
4716
|
const { parser } = this;
|
|
4689
4717
|
const value = this.variableBindings.get(name);
|
|
4690
4718
|
if (value && (value & 2) === 0) {
|
|
4691
4719
|
if (kind & 1) {
|
|
4692
|
-
this.recordScopeError(
|
|
4720
|
+
this.recordScopeError(147, name);
|
|
4693
4721
|
}
|
|
4694
4722
|
else if (parser.options.webcompat &&
|
|
4695
4723
|
(context & 1) === 0 &&
|
|
@@ -4697,22 +4725,22 @@ class Scope {
|
|
|
4697
4725
|
value === 64 &&
|
|
4698
4726
|
kind === 64) ;
|
|
4699
4727
|
else {
|
|
4700
|
-
parser.report(
|
|
4728
|
+
parser.report(147, name);
|
|
4701
4729
|
}
|
|
4702
4730
|
}
|
|
4703
4731
|
if (this.type & 64 &&
|
|
4704
4732
|
this.parent?.hasVariable(name) &&
|
|
4705
4733
|
(this.parent.variableBindings.get(name) & 2) === 0) {
|
|
4706
|
-
parser.report(
|
|
4734
|
+
parser.report(147, name);
|
|
4707
4735
|
}
|
|
4708
4736
|
if (this.type & 512 && value && (value & 2) === 0) {
|
|
4709
4737
|
if (kind & 1) {
|
|
4710
|
-
this.recordScopeError(
|
|
4738
|
+
this.recordScopeError(147, name);
|
|
4711
4739
|
}
|
|
4712
4740
|
}
|
|
4713
4741
|
if (this.type & 32) {
|
|
4714
4742
|
if (this.parent.variableBindings.get(name) & 768)
|
|
4715
|
-
parser.report(
|
|
4743
|
+
parser.report(161, name);
|
|
4716
4744
|
}
|
|
4717
4745
|
this.variableBindings.set(name, kind);
|
|
4718
4746
|
}
|
|
@@ -4734,7 +4762,7 @@ class Scope {
|
|
|
4734
4762
|
}
|
|
4735
4763
|
function createArrowHeadParsingScope(parser, context, value) {
|
|
4736
4764
|
const scope = parser.createScope().createChildScope(512);
|
|
4737
|
-
scope.addBlockName(context, value, 1
|
|
4765
|
+
scope.addBlockName(context, value, 1);
|
|
4738
4766
|
return scope;
|
|
4739
4767
|
}
|
|
4740
4768
|
|
|
@@ -4744,6 +4772,7 @@ class Parser {
|
|
|
4744
4772
|
options;
|
|
4745
4773
|
token = 1048576;
|
|
4746
4774
|
flags = 0;
|
|
4775
|
+
features = 0;
|
|
4747
4776
|
index = 0;
|
|
4748
4777
|
line = 1;
|
|
4749
4778
|
column = 0;
|
|
@@ -4763,12 +4792,14 @@ class Parser {
|
|
|
4763
4792
|
assignable = 0;
|
|
4764
4793
|
destructible = 0;
|
|
4765
4794
|
strictReservedRange = null;
|
|
4795
|
+
firstAwaitLocation = null;
|
|
4766
4796
|
leadingDecorators = { decorators: [] };
|
|
4767
4797
|
constructor(source, rawOptions = {}) {
|
|
4768
4798
|
this.source = source;
|
|
4769
4799
|
this.end = source.length;
|
|
4770
4800
|
this.currentChar = source.charCodeAt(0);
|
|
4771
4801
|
this.options = normalizeOptions(rawOptions);
|
|
4802
|
+
this.features = this.options.features;
|
|
4772
4803
|
if (Array.isArray(this.options.onComment)) {
|
|
4773
4804
|
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4774
4805
|
}
|
|
@@ -4849,7 +4880,7 @@ class Parser {
|
|
|
4849
4880
|
declareUnboundVariable(name) {
|
|
4850
4881
|
const { exportedNames } = this;
|
|
4851
4882
|
if (exportedNames.has(name)) {
|
|
4852
|
-
this.report(
|
|
4883
|
+
this.report(149, name);
|
|
4853
4884
|
}
|
|
4854
4885
|
exportedNames.add(name);
|
|
4855
4886
|
}
|
|
@@ -4872,29 +4903,10 @@ class Parser {
|
|
|
4872
4903
|
return undefined;
|
|
4873
4904
|
}
|
|
4874
4905
|
cloneIdentifier(original) {
|
|
4875
|
-
return
|
|
4906
|
+
return structuredClone(original);
|
|
4876
4907
|
}
|
|
4877
4908
|
cloneStringLiteral(original) {
|
|
4878
|
-
return
|
|
4879
|
-
}
|
|
4880
|
-
cloneLocationInformation(node, original) {
|
|
4881
|
-
const { ranges } = this.options;
|
|
4882
|
-
if (ranges) {
|
|
4883
|
-
if (ranges.start)
|
|
4884
|
-
node.start = original.start;
|
|
4885
|
-
if (ranges.end)
|
|
4886
|
-
node.end = original.end;
|
|
4887
|
-
if (ranges.range)
|
|
4888
|
-
node.range = [...original.range];
|
|
4889
|
-
}
|
|
4890
|
-
if (this.options.loc) {
|
|
4891
|
-
node.loc = {
|
|
4892
|
-
...original.loc,
|
|
4893
|
-
start: { ...original.loc.start },
|
|
4894
|
-
end: { ...original.loc.end },
|
|
4895
|
-
};
|
|
4896
|
-
}
|
|
4897
|
-
return node;
|
|
4909
|
+
return structuredClone(original);
|
|
4898
4910
|
}
|
|
4899
4911
|
}
|
|
4900
4912
|
function pushComment(comments, options) {
|
|
@@ -4957,7 +4969,7 @@ function parseSource(source, rawOptions = {}, context = 0) {
|
|
|
4957
4969
|
if (scope) {
|
|
4958
4970
|
for (const name of parser.exportedBindings) {
|
|
4959
4971
|
if (!scope.hasVariable(name))
|
|
4960
|
-
parser.report(
|
|
4972
|
+
parser.report(150, name);
|
|
4961
4973
|
}
|
|
4962
4974
|
}
|
|
4963
4975
|
}
|
|
@@ -4989,7 +5001,7 @@ function parseStatementList(parser, context, scope) {
|
|
|
4989
5001
|
statements.push(parseDirective(parser, context, expr, token, tokenStart));
|
|
4990
5002
|
}
|
|
4991
5003
|
while (parser.getToken() !== 1048576) {
|
|
4992
|
-
statements.push(parseStatementListItem(parser, context, scope, undefined,
|
|
5004
|
+
statements.push(parseStatementListItem(parser, context, scope, undefined, {}, 4));
|
|
4993
5005
|
}
|
|
4994
5006
|
return statements;
|
|
4995
5007
|
}
|
|
@@ -5019,36 +5031,42 @@ function parseModuleItem(parser, context, scope) {
|
|
|
5019
5031
|
moduleItem = parseExportDeclaration(parser, context, scope);
|
|
5020
5032
|
break;
|
|
5021
5033
|
case 86106:
|
|
5034
|
+
if (parser.leadingDecorators.decorators.length) {
|
|
5035
|
+
parser.report(172);
|
|
5036
|
+
}
|
|
5022
5037
|
moduleItem = parseImportDeclaration(parser, context, scope);
|
|
5023
5038
|
break;
|
|
5024
5039
|
default:
|
|
5025
|
-
moduleItem = parseStatementListItem(parser, context, scope, undefined,
|
|
5026
|
-
}
|
|
5027
|
-
if (parser.leadingDecorators?.decorators.length) {
|
|
5028
|
-
parser.report(170);
|
|
5040
|
+
moduleItem = parseStatementListItem(parser, context, scope, undefined, {}, 4);
|
|
5029
5041
|
}
|
|
5030
5042
|
return moduleItem;
|
|
5031
5043
|
}
|
|
5032
|
-
function parseStatementListItem(parser, context, scope, privateScope,
|
|
5044
|
+
function parseStatementListItem(parser, context, scope, privateScope, labels, origin = 2) {
|
|
5033
5045
|
const start = parser.tokenStart;
|
|
5046
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
5047
|
+
parser.report(172);
|
|
5048
|
+
}
|
|
5034
5049
|
switch (parser.getToken()) {
|
|
5035
5050
|
case 86104:
|
|
5036
|
-
return parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
5051
|
+
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 0, start, origin);
|
|
5037
5052
|
case 133:
|
|
5053
|
+
if (!(parser.features & 1)) {
|
|
5054
|
+
parser.report(30, '@');
|
|
5055
|
+
}
|
|
5038
5056
|
case 86094:
|
|
5039
5057
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5040
5058
|
case 86090:
|
|
5041
|
-
return parseLexicalDeclaration(parser, context, scope, privateScope, 16
|
|
5059
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
|
|
5042
5060
|
case 241737:
|
|
5043
5061
|
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
5044
5062
|
case 209013:
|
|
5045
|
-
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5063
|
+
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
5046
5064
|
case 209006:
|
|
5047
5065
|
if ((context & 2048 || (context & 2 && context & 8)) &&
|
|
5048
5066
|
nextTokenIsUsingOnSameLine(parser)) {
|
|
5049
|
-
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5067
|
+
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
5050
5068
|
}
|
|
5051
|
-
return parseStatement(parser, context, scope, privateScope,
|
|
5069
|
+
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
5052
5070
|
case 20564:
|
|
5053
5071
|
parser.report(103, 'export');
|
|
5054
5072
|
case 86106:
|
|
@@ -5062,15 +5080,15 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
5062
5080
|
parser.report(103, 'import');
|
|
5063
5081
|
}
|
|
5064
5082
|
case 209005:
|
|
5065
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5083
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
|
|
5066
5084
|
default:
|
|
5067
|
-
return parseStatement(parser, context, scope, privateScope,
|
|
5085
|
+
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
5068
5086
|
}
|
|
5069
5087
|
}
|
|
5070
|
-
function parseStatement(parser, context, scope, privateScope,
|
|
5088
|
+
function parseStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin = 0) {
|
|
5071
5089
|
switch (parser.getToken()) {
|
|
5072
5090
|
case 86088:
|
|
5073
|
-
return parseVariableStatement(parser, context, scope, privateScope
|
|
5091
|
+
return parseVariableStatement(parser, context, scope, privateScope);
|
|
5074
5092
|
case 20572:
|
|
5075
5093
|
return parseReturnStatement(parser, context, privateScope);
|
|
5076
5094
|
case 20569:
|
|
@@ -5100,11 +5118,11 @@ function parseStatement(parser, context, scope, privateScope, origin, labels, al
|
|
|
5100
5118
|
case 20560:
|
|
5101
5119
|
return parseDebuggerStatement(parser, context);
|
|
5102
5120
|
case 209005:
|
|
5103
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5121
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
|
|
5104
5122
|
case 20557:
|
|
5105
|
-
parser.report(
|
|
5123
|
+
parser.report(164);
|
|
5106
5124
|
case 20566:
|
|
5107
|
-
parser.report(
|
|
5125
|
+
parser.report(165);
|
|
5108
5126
|
case 86104:
|
|
5109
5127
|
parser.report(context & 1
|
|
5110
5128
|
? 76
|
|
@@ -5114,10 +5132,10 @@ function parseStatement(parser, context, scope, privateScope, origin, labels, al
|
|
|
5114
5132
|
case 86094:
|
|
5115
5133
|
parser.report(79);
|
|
5116
5134
|
default:
|
|
5117
|
-
return parseExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5135
|
+
return parseExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin);
|
|
5118
5136
|
}
|
|
5119
5137
|
}
|
|
5120
|
-
function parseExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5138
|
+
function parseExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
5121
5139
|
const { tokenValue, tokenStart } = parser;
|
|
5122
5140
|
const token = parser.getToken();
|
|
5123
5141
|
let expr;
|
|
@@ -5132,11 +5150,11 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
|
|
|
5132
5150
|
default:
|
|
5133
5151
|
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart);
|
|
5134
5152
|
}
|
|
5135
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5153
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
|
|
5136
5154
|
}
|
|
5137
|
-
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5155
|
+
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, initialExpression, token, tokenValue, tokenStart, origin) {
|
|
5138
5156
|
if (token & 143360 && parser.getToken() === 21) {
|
|
5139
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5157
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, initialExpression, token, allowFuncDecl, tokenStart, origin);
|
|
5140
5158
|
}
|
|
5141
5159
|
let expression = parseMemberOrUpdateExpression(parser, context, privateScope, initialExpression, 0, 0, tokenStart);
|
|
5142
5160
|
expression = parseAssignmentExpression(parser, context, privateScope, 0, 0, tokenStart, expression);
|
|
@@ -5149,7 +5167,7 @@ function parseBlock(parser, context, scope, privateScope, labels, start = parser
|
|
|
5149
5167
|
const body = [];
|
|
5150
5168
|
consume(parser, context | 32, 2162700);
|
|
5151
5169
|
while (parser.getToken() !== 1074790415) {
|
|
5152
|
-
body.push(parseStatementListItem(parser, context, scope, privateScope,
|
|
5170
|
+
body.push(parseStatementListItem(parser, context, scope, privateScope, { $: labels }));
|
|
5153
5171
|
}
|
|
5154
5172
|
consume(parser, context | 32, 1074790415);
|
|
5155
5173
|
return parser.finishNode({
|
|
@@ -5178,7 +5196,7 @@ function parseExpressionStatement(parser, context, expression, start) {
|
|
|
5178
5196
|
expression,
|
|
5179
5197
|
}, start);
|
|
5180
5198
|
}
|
|
5181
|
-
function parseLabelledStatement(parser, context, scope, privateScope,
|
|
5199
|
+
function parseLabelledStatement(parser, context, scope, privateScope, labels, value, expr, token, allowFuncDecl, start, origin) {
|
|
5182
5200
|
validateBindingIdentifier(parser, context, 0, token, 1);
|
|
5183
5201
|
validateAndDeclareLabel(parser, labels, value);
|
|
5184
5202
|
nextToken(parser, context | 32);
|
|
@@ -5186,27 +5204,27 @@ function parseLabelledStatement(parser, context, scope, privateScope, origin, la
|
|
|
5186
5204
|
(context & 1) === 0 &&
|
|
5187
5205
|
parser.options.webcompat &&
|
|
5188
5206
|
parser.getToken() === 86104
|
|
5189
|
-
? parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope,
|
|
5190
|
-
: parseStatement(parser, context, scope, privateScope,
|
|
5207
|
+
? parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0, parser.tokenStart, origin)
|
|
5208
|
+
: parseStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin);
|
|
5191
5209
|
return parser.finishNode({
|
|
5192
5210
|
type: 'LabeledStatement',
|
|
5193
5211
|
label: expr,
|
|
5194
5212
|
body,
|
|
5195
5213
|
}, start);
|
|
5196
5214
|
}
|
|
5197
|
-
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5215
|
+
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
5198
5216
|
const { tokenValue, tokenStart: start } = parser;
|
|
5199
5217
|
const token = parser.getToken();
|
|
5200
5218
|
let expr = parseIdentifier(parser, context);
|
|
5201
5219
|
if (parser.getToken() === 21) {
|
|
5202
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5220
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, start, origin);
|
|
5203
5221
|
}
|
|
5204
5222
|
const asyncNewLine = parser.flags & 1;
|
|
5205
5223
|
if (!asyncNewLine) {
|
|
5206
5224
|
if (parser.getToken() === 86104) {
|
|
5207
5225
|
if (!allowFuncDecl)
|
|
5208
|
-
parser.report(
|
|
5209
|
-
return parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
5226
|
+
parser.report(125);
|
|
5227
|
+
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
|
|
5210
5228
|
}
|
|
5211
5229
|
if (isValidIdentifier(context, parser.getToken())) {
|
|
5212
5230
|
expr = parseAsyncArrowAfterIdent(parser, context, privateScope, 1, start);
|
|
@@ -5216,7 +5234,7 @@ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, priva
|
|
|
5216
5234
|
}
|
|
5217
5235
|
}
|
|
5218
5236
|
if (parser.getToken() === 67174411) {
|
|
5219
|
-
expr = parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, 1, 1,
|
|
5237
|
+
expr = parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, 1, 1, asyncNewLine, start);
|
|
5220
5238
|
}
|
|
5221
5239
|
else {
|
|
5222
5240
|
if (parser.getToken() === 10) {
|
|
@@ -5302,8 +5320,8 @@ function parseConsequentOrAlternative(parser, context, scope, privateScope, labe
|
|
|
5302
5320
|
return context & 1 ||
|
|
5303
5321
|
!parser.options.webcompat ||
|
|
5304
5322
|
parser.getToken() !== 86104
|
|
5305
|
-
? parseStatement(parser, context, scope, privateScope,
|
|
5306
|
-
: parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0,
|
|
5323
|
+
? parseStatement(parser, context, scope, privateScope, { $: labels }, 0)
|
|
5324
|
+
: parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0, tokenStart);
|
|
5307
5325
|
}
|
|
5308
5326
|
function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
5309
5327
|
const start = parser.tokenStart;
|
|
@@ -5332,7 +5350,7 @@ function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
|
5332
5350
|
while (parser.getToken() !== 20556 &&
|
|
5333
5351
|
parser.getToken() !== 1074790415 &&
|
|
5334
5352
|
parser.getToken() !== 20561) {
|
|
5335
|
-
const statement = parseStatementListItem(parser, context | 4, scope, privateScope,
|
|
5353
|
+
const statement = parseStatementListItem(parser, context | 4, scope, privateScope, {
|
|
5336
5354
|
$: labels,
|
|
5337
5355
|
});
|
|
5338
5356
|
if (statement.type === 'VariableDeclaration' &&
|
|
@@ -5368,7 +5386,7 @@ function parseWhileStatement(parser, context, scope, privateScope, labels) {
|
|
|
5368
5386
|
}, start);
|
|
5369
5387
|
}
|
|
5370
5388
|
function parseIterationStatementBody(parser, context, scope, privateScope, labels) {
|
|
5371
|
-
return parseStatement(parser, ((context | 131072) ^ 131072) | 128, scope, privateScope,
|
|
5389
|
+
return parseStatement(parser, ((context | 131072) ^ 131072) | 128, scope, privateScope, { loop: 1, $: labels }, 0);
|
|
5372
5390
|
}
|
|
5373
5391
|
function parseContinueStatement(parser, context, labels) {
|
|
5374
5392
|
if ((context & 128) === 0)
|
|
@@ -5380,7 +5398,7 @@ function parseContinueStatement(parser, context, labels) {
|
|
|
5380
5398
|
const { tokenValue } = parser;
|
|
5381
5399
|
label = parseIdentifier(parser, context | 32);
|
|
5382
5400
|
if (!isValidLabel(parser, labels, tokenValue, 1))
|
|
5383
|
-
parser.report(
|
|
5401
|
+
parser.report(140, tokenValue);
|
|
5384
5402
|
}
|
|
5385
5403
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5386
5404
|
return parser.finishNode({
|
|
@@ -5396,7 +5414,7 @@ function parseBreakStatement(parser, context, labels) {
|
|
|
5396
5414
|
const { tokenValue } = parser;
|
|
5397
5415
|
label = parseIdentifier(parser, context | 32);
|
|
5398
5416
|
if (!isValidLabel(parser, labels, tokenValue, 0))
|
|
5399
|
-
parser.report(
|
|
5417
|
+
parser.report(140, tokenValue);
|
|
5400
5418
|
}
|
|
5401
5419
|
else if ((context & (4 | 128)) === 0) {
|
|
5402
5420
|
parser.report(69);
|
|
@@ -5415,7 +5433,7 @@ function parseWithStatement(parser, context, scope, privateScope, labels) {
|
|
|
5415
5433
|
consume(parser, context | 32, 67174411);
|
|
5416
5434
|
const object = parseExpressions(parser, context, privateScope, 0, 1, parser.tokenStart);
|
|
5417
5435
|
consume(parser, context | 32, 16);
|
|
5418
|
-
const body = parseStatement(parser, context, scope, privateScope,
|
|
5436
|
+
const body = parseStatement(parser, context, scope, privateScope, labels, 0, 2);
|
|
5419
5437
|
return parser.finishNode({
|
|
5420
5438
|
type: 'WithStatement',
|
|
5421
5439
|
object,
|
|
@@ -5462,7 +5480,7 @@ function parseCatchBlock(parser, context, scope, privateScope, labels, start) {
|
|
|
5462
5480
|
scope = scope?.createChildScope(4);
|
|
5463
5481
|
param = parseBindingPattern(parser, context, scope, privateScope, (parser.getToken() & 2097152) === 2097152
|
|
5464
5482
|
? 256
|
|
5465
|
-
: 512
|
|
5483
|
+
: 512);
|
|
5466
5484
|
if (parser.getToken() === 18) {
|
|
5467
5485
|
parser.report(86);
|
|
5468
5486
|
}
|
|
@@ -5511,7 +5529,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
5511
5529
|
let expr = parseIdentifier(parser, context);
|
|
5512
5530
|
if (parser.getToken() & (143360 | 2097152) &&
|
|
5513
5531
|
(parser.getToken() & 20480) !== 20480) {
|
|
5514
|
-
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 8
|
|
5532
|
+
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 8);
|
|
5515
5533
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5516
5534
|
return parser.finishNode({
|
|
5517
5535
|
type: 'VariableDeclaration',
|
|
@@ -5523,7 +5541,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
5523
5541
|
if (context & 1)
|
|
5524
5542
|
parser.report(85);
|
|
5525
5543
|
if (parser.getToken() === 21) {
|
|
5526
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5544
|
+
return parseLabelledStatement(parser, context, scope, privateScope, {}, tokenValue, expr, token, 0, tokenStart, origin);
|
|
5527
5545
|
}
|
|
5528
5546
|
if (parser.getToken() === 10) {
|
|
5529
5547
|
let scope = void 0;
|
|
@@ -5577,23 +5595,26 @@ function nextTokenIsUsingOnSameLine(parser) {
|
|
|
5577
5595
|
function isResourceBindingStart(token) {
|
|
5578
5596
|
return (token & 143360) === 143360 && (token & 20480) !== 20480;
|
|
5579
5597
|
}
|
|
5580
|
-
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5598
|
+
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin) {
|
|
5581
5599
|
const { tokenStart, tokenValue } = parser;
|
|
5582
5600
|
const token = parser.getToken();
|
|
5583
5601
|
const expression = parseIdentifier(parser, context);
|
|
5584
5602
|
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5585
|
-
if (origin & 4 &&
|
|
5603
|
+
if (origin & 4 &&
|
|
5604
|
+
context & 8 &&
|
|
5605
|
+
(context & 2) === 0 &&
|
|
5606
|
+
(context & 4096) === 0) {
|
|
5586
5607
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5587
5608
|
}
|
|
5588
5609
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'using', tokenStart, 1);
|
|
5589
5610
|
}
|
|
5590
5611
|
parser.assignable = 1;
|
|
5591
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5612
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, 1, expression, token, tokenValue, tokenStart, origin);
|
|
5592
5613
|
}
|
|
5593
|
-
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5614
|
+
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin) {
|
|
5594
5615
|
const start = parser.tokenStart;
|
|
5595
5616
|
if (context & 524288)
|
|
5596
|
-
parser.report(
|
|
5617
|
+
parser.report(179);
|
|
5597
5618
|
nextToken(parser, context | 32);
|
|
5598
5619
|
let argument;
|
|
5599
5620
|
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
@@ -5614,9 +5635,9 @@ function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope,
|
|
|
5614
5635
|
type: 'AwaitExpression',
|
|
5615
5636
|
argument,
|
|
5616
5637
|
}, start);
|
|
5617
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5638
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, 0, expression, 1048576, '', start, origin);
|
|
5618
5639
|
}
|
|
5619
|
-
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5640
|
+
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin = 0, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5620
5641
|
const start = declarationStart;
|
|
5621
5642
|
if (!keywordConsumed)
|
|
5622
5643
|
nextToken(parser, context);
|
|
@@ -5628,7 +5649,7 @@ function parseLexicalDeclaration(parser, context, scope, privateScope, kind, ori
|
|
|
5628
5649
|
declarations,
|
|
5629
5650
|
}, start);
|
|
5630
5651
|
}
|
|
5631
|
-
function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
5652
|
+
function parseVariableStatement(parser, context, scope, privateScope, origin = 0) {
|
|
5632
5653
|
const start = parser.tokenStart;
|
|
5633
5654
|
nextToken(parser, context);
|
|
5634
5655
|
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 4, origin);
|
|
@@ -5639,7 +5660,7 @@ function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
|
5639
5660
|
declarations,
|
|
5640
5661
|
}, start);
|
|
5641
5662
|
}
|
|
5642
|
-
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5663
|
+
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin = 0, declarationKind) {
|
|
5643
5664
|
let bindingCount = 1;
|
|
5644
5665
|
const firstDeclaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5645
5666
|
const list = [firstDeclaration];
|
|
@@ -5650,7 +5671,7 @@ function parseVariableDeclarationList(parser, context, scope, privateScope, kind
|
|
|
5650
5671
|
if (resourceNames) {
|
|
5651
5672
|
const { name } = declaration.id;
|
|
5652
5673
|
if (resourceNames.has(name))
|
|
5653
|
-
parser.report(
|
|
5674
|
+
parser.report(147, name);
|
|
5654
5675
|
resourceNames.add(name);
|
|
5655
5676
|
}
|
|
5656
5677
|
list.push(declaration);
|
|
@@ -5670,11 +5691,14 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
5670
5691
|
const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
|
|
5671
5692
|
if (parser.getToken() === 1077936155) {
|
|
5672
5693
|
nextToken(parser, context | 32);
|
|
5673
|
-
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5694
|
+
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart, origin);
|
|
5674
5695
|
if (origin & 32) {
|
|
5675
5696
|
if (parser.getToken() === 471156 ||
|
|
5676
5697
|
(parser.getToken() === 8673330 &&
|
|
5677
|
-
(token & 2097152 ||
|
|
5698
|
+
(token & 2097152 ||
|
|
5699
|
+
(kind & 4) === 0 ||
|
|
5700
|
+
context & 1 ||
|
|
5701
|
+
!parser.options.webcompat))) {
|
|
5678
5702
|
throw new ParseError(tokenStart, parser.currentLocation, 60, parser.getToken() === 471156 ? 'of' : 'in');
|
|
5679
5703
|
}
|
|
5680
5704
|
}
|
|
@@ -5729,7 +5753,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5729
5753
|
parser.assignable = 1;
|
|
5730
5754
|
init = parseMemberOrUpdateExpression(parser, context, privateScope, init, 0, 0, tokenStart);
|
|
5731
5755
|
if (parser.getToken() === 471156)
|
|
5732
|
-
parser.report(
|
|
5756
|
+
parser.report(117);
|
|
5733
5757
|
}
|
|
5734
5758
|
}
|
|
5735
5759
|
else if (token === 209013) {
|
|
@@ -5781,7 +5805,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5781
5805
|
if (resourceNames) {
|
|
5782
5806
|
const { name } = declaration.id;
|
|
5783
5807
|
if (resourceNames.has(name))
|
|
5784
|
-
parser.report(
|
|
5808
|
+
parser.report(147, name);
|
|
5785
5809
|
resourceNames.add(name);
|
|
5786
5810
|
}
|
|
5787
5811
|
declarations.push(declaration);
|
|
@@ -5826,7 +5850,7 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5826
5850
|
else if (token === 209006 &&
|
|
5827
5851
|
(context & 2048 || (context & 2 && context & 8))) {
|
|
5828
5852
|
if (context & 524288)
|
|
5829
|
-
parser.report(
|
|
5853
|
+
parser.report(179);
|
|
5830
5854
|
nextToken(parser, context | 32);
|
|
5831
5855
|
let awaitArgument;
|
|
5832
5856
|
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
@@ -5944,16 +5968,18 @@ function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
|
5944
5968
|
}
|
|
5945
5969
|
function parseRestrictedIdentifier(parser, context, scope) {
|
|
5946
5970
|
if (!isValidIdentifier(context, parser.getToken()))
|
|
5947
|
-
parser.report(
|
|
5971
|
+
parser.report(120);
|
|
5948
5972
|
if ((parser.getToken() & 537079808) === 537079808)
|
|
5949
|
-
parser.report(
|
|
5950
|
-
scope?.addBlockName(context, parser.tokenValue, 8
|
|
5973
|
+
parser.report(121);
|
|
5974
|
+
scope?.addBlockName(context, parser.tokenValue, 8);
|
|
5951
5975
|
return parseIdentifier(parser, context);
|
|
5952
5976
|
}
|
|
5953
5977
|
function parseImportDeclaration(parser, context, scope) {
|
|
5954
5978
|
const start = parser.tokenStart;
|
|
5955
5979
|
nextToken(parser, context);
|
|
5956
5980
|
let source;
|
|
5981
|
+
let sourceParsed = false;
|
|
5982
|
+
let phase = null;
|
|
5957
5983
|
const { tokenStart } = parser;
|
|
5958
5984
|
let specifiers = [];
|
|
5959
5985
|
if (parser.getToken() === 134283267) {
|
|
@@ -5961,14 +5987,93 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
5961
5987
|
}
|
|
5962
5988
|
else {
|
|
5963
5989
|
if (parser.getToken() & 143360) {
|
|
5964
|
-
const
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5990
|
+
const token = parser.getToken();
|
|
5991
|
+
const { tokenValue } = parser;
|
|
5992
|
+
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && tokenValue == 'defer';
|
|
5993
|
+
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && tokenValue == 'source';
|
|
5994
|
+
if (isPhaseDefer || isPhaseSource) {
|
|
5995
|
+
const phaseOrLocal = parseIdentifier(parser, context);
|
|
5996
|
+
if (tokenValue === 'defer') {
|
|
5997
|
+
if (parser.getToken() === 8391476) {
|
|
5998
|
+
phase = 'defer';
|
|
5999
|
+
specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
|
|
6000
|
+
}
|
|
6001
|
+
else if (parser.getToken() === 209011 || parser.getToken() === 18) {
|
|
6002
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6003
|
+
specifiers = [
|
|
6004
|
+
parser.finishNode({
|
|
6005
|
+
type: 'ImportDefaultSpecifier',
|
|
6006
|
+
local: phaseOrLocal,
|
|
6007
|
+
}, tokenStart),
|
|
6008
|
+
];
|
|
6009
|
+
}
|
|
6010
|
+
else {
|
|
6011
|
+
parser.report(108);
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
else if (parser.getToken() === 209011) {
|
|
6015
|
+
const fromToken = parser.getToken();
|
|
6016
|
+
const fromStart = parser.tokenStart;
|
|
6017
|
+
const fromLocal = parseIdentifier(parser, context);
|
|
6018
|
+
if (parser.getToken() === 209011) {
|
|
6019
|
+
validateBindingIdentifier(parser, context, 16, fromToken, 0);
|
|
6020
|
+
scope?.addBlockName(context, fromLocal.name, 8);
|
|
6021
|
+
phase = 'source';
|
|
6022
|
+
specifiers = [
|
|
6023
|
+
parser.finishNode({
|
|
6024
|
+
type: 'ImportDefaultSpecifier',
|
|
6025
|
+
local: fromLocal,
|
|
6026
|
+
}, fromStart),
|
|
6027
|
+
];
|
|
6028
|
+
}
|
|
6029
|
+
else {
|
|
6030
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6031
|
+
specifiers = [
|
|
6032
|
+
parser.finishNode({
|
|
6033
|
+
type: 'ImportDefaultSpecifier',
|
|
6034
|
+
local: phaseOrLocal,
|
|
6035
|
+
}, tokenStart),
|
|
6036
|
+
];
|
|
6037
|
+
if (parser.getToken() !== 134283267)
|
|
6038
|
+
parser.report(105, 'Import');
|
|
6039
|
+
source = parseLiteral(parser, context);
|
|
6040
|
+
sourceParsed = true;
|
|
6041
|
+
}
|
|
6042
|
+
}
|
|
6043
|
+
else if (parser.getToken() & 143360) {
|
|
6044
|
+
phase = 'source';
|
|
6045
|
+
const localStart = parser.tokenStart;
|
|
6046
|
+
const local = parseRestrictedIdentifier(parser, context, scope);
|
|
6047
|
+
specifiers = [
|
|
6048
|
+
parser.finishNode({
|
|
6049
|
+
type: 'ImportDefaultSpecifier',
|
|
6050
|
+
local,
|
|
6051
|
+
}, localStart),
|
|
6052
|
+
];
|
|
6053
|
+
}
|
|
6054
|
+
else if (parser.getToken() === 18) {
|
|
6055
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6056
|
+
specifiers = [
|
|
6057
|
+
parser.finishNode({
|
|
6058
|
+
type: 'ImportDefaultSpecifier',
|
|
6059
|
+
local: phaseOrLocal,
|
|
6060
|
+
}, tokenStart),
|
|
6061
|
+
];
|
|
6062
|
+
}
|
|
6063
|
+
else {
|
|
6064
|
+
parser.report(109);
|
|
6065
|
+
}
|
|
6066
|
+
}
|
|
6067
|
+
else {
|
|
6068
|
+
const local = parseRestrictedIdentifier(parser, context, scope);
|
|
6069
|
+
specifiers = [
|
|
6070
|
+
parser.finishNode({
|
|
6071
|
+
type: 'ImportDefaultSpecifier',
|
|
6072
|
+
local,
|
|
6073
|
+
}, tokenStart),
|
|
6074
|
+
];
|
|
6075
|
+
}
|
|
6076
|
+
if (phase === null && !sourceParsed && consumeOpt(parser, context, 18)) {
|
|
5972
6077
|
switch (parser.getToken()) {
|
|
5973
6078
|
case 8391476:
|
|
5974
6079
|
specifiers.push(parseImportNamespaceSpecifier(parser, context, scope));
|
|
@@ -5997,7 +6102,8 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
5997
6102
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5998
6103
|
}
|
|
5999
6104
|
}
|
|
6000
|
-
|
|
6105
|
+
if (!sourceParsed)
|
|
6106
|
+
source = parseModuleSpecifier(parser, context);
|
|
6001
6107
|
}
|
|
6002
6108
|
const attributes = parseImportAttributes(parser, context);
|
|
6003
6109
|
const node = {
|
|
@@ -6005,6 +6111,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
6005
6111
|
specifiers,
|
|
6006
6112
|
source,
|
|
6007
6113
|
attributes,
|
|
6114
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6008
6115
|
};
|
|
6009
6116
|
matchOrInsertSemicolon(parser, context | 32);
|
|
6010
6117
|
return parser.finishNode(node, start);
|
|
@@ -6052,7 +6159,7 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
|
|
|
6052
6159
|
else {
|
|
6053
6160
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
6054
6161
|
}
|
|
6055
|
-
scope?.addBlockName(context, tokenValue, 8
|
|
6162
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6056
6163
|
specifiers.push(parser.finishNode({
|
|
6057
6164
|
type: 'ImportSpecifier',
|
|
6058
6165
|
local,
|
|
@@ -6087,17 +6194,24 @@ function parseImportCallDeclaration(parser, context, privateScope, start) {
|
|
|
6087
6194
|
function parseExportDeclaration(parser, context, scope) {
|
|
6088
6195
|
const start = parser.leadingDecorators.decorators.length ? parser.leadingDecorators.start : parser.tokenStart;
|
|
6089
6196
|
nextToken(parser, context | 32);
|
|
6197
|
+
const isDefaultExport = consumeOpt(parser, context | 32, 20561);
|
|
6198
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
6199
|
+
parser.report(172);
|
|
6200
|
+
}
|
|
6090
6201
|
const specifiers = [];
|
|
6091
6202
|
let declaration = null;
|
|
6092
6203
|
let source = null;
|
|
6093
6204
|
let attributes = [];
|
|
6094
|
-
if (
|
|
6205
|
+
if (isDefaultExport) {
|
|
6095
6206
|
switch (parser.getToken()) {
|
|
6096
6207
|
case 86104: {
|
|
6097
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6208
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 0, parser.tokenStart, 4);
|
|
6098
6209
|
break;
|
|
6099
6210
|
}
|
|
6100
6211
|
case 133:
|
|
6212
|
+
if (!(parser.features & 1)) {
|
|
6213
|
+
parser.report(30, '@');
|
|
6214
|
+
}
|
|
6101
6215
|
case 86094:
|
|
6102
6216
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
|
|
6103
6217
|
break;
|
|
@@ -6107,11 +6221,11 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6107
6221
|
const { flags } = parser;
|
|
6108
6222
|
if ((flags & 1) === 0) {
|
|
6109
6223
|
if (parser.getToken() === 86104) {
|
|
6110
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6224
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
|
|
6111
6225
|
}
|
|
6112
6226
|
else {
|
|
6113
6227
|
if (parser.getToken() === 67174411) {
|
|
6114
|
-
declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1,
|
|
6228
|
+
declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
|
|
6115
6229
|
declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
|
|
6116
6230
|
declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
|
|
6117
6231
|
}
|
|
@@ -6210,7 +6324,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6210
6324
|
}
|
|
6211
6325
|
else {
|
|
6212
6326
|
if (hasLiteralLocal) {
|
|
6213
|
-
parser.report(
|
|
6327
|
+
parser.report(174);
|
|
6214
6328
|
}
|
|
6215
6329
|
if (scope) {
|
|
6216
6330
|
tmpExportedNames.forEach((n) => parser.declareUnboundVariable(n));
|
|
@@ -6221,11 +6335,14 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6221
6335
|
break;
|
|
6222
6336
|
}
|
|
6223
6337
|
case 133:
|
|
6338
|
+
if (!(parser.features & 1)) {
|
|
6339
|
+
parser.report(30, '@');
|
|
6340
|
+
}
|
|
6224
6341
|
case 86094:
|
|
6225
6342
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
6226
6343
|
break;
|
|
6227
6344
|
case 86104:
|
|
6228
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6345
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 2, 0, parser.tokenStart, 4);
|
|
6229
6346
|
break;
|
|
6230
6347
|
case 241737:
|
|
6231
6348
|
declaration = parseLexicalDeclaration(parser, context, scope, undefined, 8, 64);
|
|
@@ -6240,7 +6357,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6240
6357
|
const { tokenStart } = parser;
|
|
6241
6358
|
nextToken(parser, context);
|
|
6242
6359
|
if ((parser.flags & 1) === 0 && parser.getToken() === 86104) {
|
|
6243
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6360
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 2, 1, tokenStart, 4);
|
|
6244
6361
|
break;
|
|
6245
6362
|
}
|
|
6246
6363
|
}
|
|
@@ -6256,8 +6373,8 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6256
6373
|
};
|
|
6257
6374
|
return parser.finishNode(node, start);
|
|
6258
6375
|
}
|
|
6259
|
-
function parseExpression(parser, context, privateScope, canAssign, inGroup, start) {
|
|
6260
|
-
let expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, canAssign, inGroup, 1, start);
|
|
6376
|
+
function parseExpression(parser, context, privateScope, canAssign, inGroup, start, origin = 0) {
|
|
6377
|
+
let expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, canAssign, inGroup, 1, start, origin);
|
|
6261
6378
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6262
6379
|
return parseAssignmentExpression(parser, context, privateScope, inGroup, 0, start, expr);
|
|
6263
6380
|
}
|
|
@@ -6353,7 +6470,7 @@ function parseBinaryExpression(parser, context, privateScope, inGroup, start, mi
|
|
|
6353
6470
|
t = parser.getToken();
|
|
6354
6471
|
precedence = t & 3840;
|
|
6355
6472
|
if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) {
|
|
6356
|
-
parser.report(
|
|
6473
|
+
parser.report(167);
|
|
6357
6474
|
}
|
|
6358
6475
|
if (precedence + ((t === 8391735) << 8) - ((bit === t) << 12) <= minPrecedence)
|
|
6359
6476
|
break;
|
|
@@ -6380,10 +6497,10 @@ function parseUnaryExpression(parser, context, privateScope, isLHS, inGroup) {
|
|
|
6380
6497
|
parser.report(33);
|
|
6381
6498
|
if (context & 1 && unaryOperator === 16863276) {
|
|
6382
6499
|
if (arg.type === 'Identifier') {
|
|
6383
|
-
parser.report(
|
|
6500
|
+
parser.report(123);
|
|
6384
6501
|
}
|
|
6385
6502
|
else if (isPropertyWithPrivateFieldKey(arg)) {
|
|
6386
|
-
parser.report(
|
|
6503
|
+
parser.report(129);
|
|
6387
6504
|
}
|
|
6388
6505
|
}
|
|
6389
6506
|
parser.assignable = 2;
|
|
@@ -6412,7 +6529,7 @@ function parseAsyncExpression(parser, context, privateScope, inGroup, isLHS, can
|
|
|
6412
6529
|
}
|
|
6413
6530
|
}
|
|
6414
6531
|
if (!inNew && parser.getToken() === 67174411) {
|
|
6415
|
-
return parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, canAssign, 1,
|
|
6532
|
+
return parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, canAssign, 1, flags, start);
|
|
6416
6533
|
}
|
|
6417
6534
|
if (parser.getToken() === 10) {
|
|
6418
6535
|
classifyIdentifier(parser, context, token);
|
|
@@ -6436,7 +6553,7 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
|
|
|
6436
6553
|
if (!canAssign)
|
|
6437
6554
|
parser.report(26);
|
|
6438
6555
|
if (parser.getToken() === 22)
|
|
6439
|
-
parser.report(
|
|
6556
|
+
parser.report(126);
|
|
6440
6557
|
let argument = null;
|
|
6441
6558
|
let delegate = false;
|
|
6442
6559
|
if ((parser.flags & 1) === 0) {
|
|
@@ -6460,20 +6577,24 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
|
|
|
6460
6577
|
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
6461
6578
|
}
|
|
6462
6579
|
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
|
|
6463
|
-
if (inGroup)
|
|
6580
|
+
if (inGroup) {
|
|
6581
|
+
if ((parser.destructible & 128) === 0) {
|
|
6582
|
+
parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
|
|
6583
|
+
}
|
|
6464
6584
|
parser.destructible |= 128;
|
|
6585
|
+
}
|
|
6465
6586
|
if (context & 524288)
|
|
6466
|
-
parser.report(
|
|
6587
|
+
parser.report(179);
|
|
6467
6588
|
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope);
|
|
6468
6589
|
const isIdentifier = possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
|
|
6469
6590
|
(parser.getToken() & 65536) === 0;
|
|
6470
6591
|
if (isIdentifier) {
|
|
6471
6592
|
if (context & 2048)
|
|
6472
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6593
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 178);
|
|
6473
6594
|
if (context & 2)
|
|
6474
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6595
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
|
|
6475
6596
|
if (context & 8192 && context & 2048)
|
|
6476
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6597
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
|
|
6477
6598
|
return possibleIdentifierOrArrowFunc;
|
|
6478
6599
|
}
|
|
6479
6600
|
if (context & 8192) {
|
|
@@ -6495,8 +6616,9 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
|
|
|
6495
6616
|
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 98);
|
|
6496
6617
|
return possibleIdentifierOrArrowFunc;
|
|
6497
6618
|
}
|
|
6498
|
-
function parseFunctionBody(parser, context, scope, privateScope,
|
|
6619
|
+
function parseFunctionBody(parser, context, scope, privateScope, funcNameToken, functionScope, origin = 0) {
|
|
6499
6620
|
const { tokenStart } = parser;
|
|
6621
|
+
parser.flags &= -4161;
|
|
6500
6622
|
consume(parser, context | 32, 2162700);
|
|
6501
6623
|
const body = [];
|
|
6502
6624
|
if (parser.getToken() !== 1074790415) {
|
|
@@ -6522,19 +6644,19 @@ function parseFunctionBody(parser, context, scope, privateScope, origin, funcNam
|
|
|
6522
6644
|
if (context & 1) {
|
|
6523
6645
|
if (funcNameToken) {
|
|
6524
6646
|
if ((funcNameToken & 537079808) === 537079808) {
|
|
6525
|
-
parser.report(
|
|
6647
|
+
parser.report(121);
|
|
6526
6648
|
}
|
|
6527
6649
|
if ((funcNameToken & 36864) === 36864) {
|
|
6528
6650
|
parser.report(40);
|
|
6529
6651
|
}
|
|
6530
6652
|
}
|
|
6531
6653
|
if (parser.flags & 512)
|
|
6532
|
-
parser.report(
|
|
6654
|
+
parser.report(121);
|
|
6533
6655
|
if (parser.flags & 256) {
|
|
6534
6656
|
if (parser.strictReservedRange) {
|
|
6535
|
-
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1],
|
|
6657
|
+
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 120);
|
|
6536
6658
|
}
|
|
6537
|
-
parser.report(
|
|
6659
|
+
parser.report(120);
|
|
6538
6660
|
}
|
|
6539
6661
|
}
|
|
6540
6662
|
}
|
|
@@ -6543,7 +6665,7 @@ function parseFunctionBody(parser, context, scope, privateScope, origin, funcNam
|
|
|
6543
6665
|
(512 | 256 | 64 | 4096);
|
|
6544
6666
|
parser.destructible = (parser.destructible | 256) ^ 256;
|
|
6545
6667
|
while (parser.getToken() !== 1074790415) {
|
|
6546
|
-
body.push(parseStatementListItem(parser, context, scope, privateScope,
|
|
6668
|
+
body.push(parseStatementListItem(parser, context, scope, privateScope, {}, 4));
|
|
6547
6669
|
}
|
|
6548
6670
|
consume(parser, origin & (16 | 8) ? context | 32 : context, 1074790415);
|
|
6549
6671
|
parser.flags &= -4289;
|
|
@@ -6559,7 +6681,7 @@ function parseSuperExpression(parser, context) {
|
|
|
6559
6681
|
nextToken(parser, context);
|
|
6560
6682
|
switch (parser.getToken()) {
|
|
6561
6683
|
case 67108991:
|
|
6562
|
-
parser.report(
|
|
6684
|
+
parser.report(169);
|
|
6563
6685
|
case 67174411: {
|
|
6564
6686
|
if ((context & 512) === 0)
|
|
6565
6687
|
parser.report(28);
|
|
@@ -6606,7 +6728,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6606
6728
|
case 67108877: {
|
|
6607
6729
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6608
6730
|
if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
|
|
6609
|
-
parser.report(
|
|
6731
|
+
parser.report(175);
|
|
6610
6732
|
}
|
|
6611
6733
|
parser.assignable =
|
|
6612
6734
|
(parser.flags & 2048) === 2048
|
|
@@ -6686,7 +6808,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6686
6808
|
}
|
|
6687
6809
|
default:
|
|
6688
6810
|
if ((parser.flags & 2048) === 2048) {
|
|
6689
|
-
parser.report(
|
|
6811
|
+
parser.report(168);
|
|
6690
6812
|
}
|
|
6691
6813
|
parser.assignable = 2;
|
|
6692
6814
|
expr = parser.finishNode({
|
|
@@ -6767,7 +6889,7 @@ function parsePropertyOrPrivatePropertyName(parser, context, privateScope) {
|
|
|
6767
6889
|
parser.getToken() !== -2147483527 &&
|
|
6768
6890
|
parser.getToken() !== -2147483526 &&
|
|
6769
6891
|
parser.getToken() !== 131) {
|
|
6770
|
-
parser.report(
|
|
6892
|
+
parser.report(162);
|
|
6771
6893
|
}
|
|
6772
6894
|
return parser.getToken() === 131
|
|
6773
6895
|
? parsePrivateIdentifier(parser, context, privateScope, 0)
|
|
@@ -6792,7 +6914,7 @@ function parseUpdateExpressionPrefixed(parser, context, privateScope, inNew, isL
|
|
|
6792
6914
|
prefix: true,
|
|
6793
6915
|
}, start);
|
|
6794
6916
|
}
|
|
6795
|
-
function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canAssign, inGroup, isLHS, start) {
|
|
6917
|
+
function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canAssign, inGroup, isLHS, start, origin = 0) {
|
|
6796
6918
|
if ((parser.getToken() & 143360) === 143360) {
|
|
6797
6919
|
switch (parser.getToken()) {
|
|
6798
6920
|
case 209006:
|
|
@@ -6812,16 +6934,16 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6812
6934
|
if ((token & 36864) === 36864) {
|
|
6813
6935
|
parser.flags |= 256;
|
|
6814
6936
|
}
|
|
6815
|
-
return parseArrowFromIdentifier(parser, context, privateScope, tokenValue, expr, inNew, canAssign, 0, start);
|
|
6937
|
+
return parseArrowFromIdentifier(parser, context, privateScope, tokenValue, expr, inNew, canAssign, 0, start, origin);
|
|
6816
6938
|
}
|
|
6817
6939
|
if (context & 16 &&
|
|
6818
6940
|
!(context & 32768) &&
|
|
6819
6941
|
!(context & 8192) &&
|
|
6820
6942
|
parser.tokenValue === 'arguments')
|
|
6821
|
-
parser.report(
|
|
6943
|
+
parser.report(132);
|
|
6822
6944
|
if ((token & 255) === (241737 & 255)) {
|
|
6823
6945
|
if (context & 1)
|
|
6824
|
-
parser.report(
|
|
6946
|
+
parser.report(115);
|
|
6825
6947
|
if (kind & (8 | 16))
|
|
6826
6948
|
parser.report(100);
|
|
6827
6949
|
}
|
|
@@ -6853,7 +6975,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6853
6975
|
case 69271571:
|
|
6854
6976
|
return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
|
|
6855
6977
|
case 67174411:
|
|
6856
|
-
return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1,
|
|
6978
|
+
return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1, start, origin);
|
|
6857
6979
|
case 86021:
|
|
6858
6980
|
case 86022:
|
|
6859
6981
|
case 86023:
|
|
@@ -6863,6 +6985,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6863
6985
|
case 65540:
|
|
6864
6986
|
return parseRegExpLiteral(parser, context);
|
|
6865
6987
|
case 133:
|
|
6988
|
+
if (!(parser.features & 1)) {
|
|
6989
|
+
parser.report(30, '@');
|
|
6990
|
+
}
|
|
6866
6991
|
case 86094:
|
|
6867
6992
|
return parseClassExpression(parser, context, privateScope, inGroup, start);
|
|
6868
6993
|
case 86109:
|
|
@@ -6891,24 +7016,37 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6891
7016
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6892
7017
|
let expr = parseIdentifier(parser, context);
|
|
6893
7018
|
if (parser.getToken() === 67108877) {
|
|
6894
|
-
return parseImportMetaExpression(parser, context, expr, start);
|
|
7019
|
+
return parseImportMetaExpression(parser, context, expr, start, privateScope, inGroup, inNew);
|
|
6895
7020
|
}
|
|
6896
7021
|
if (inNew)
|
|
6897
|
-
parser.report(
|
|
7022
|
+
parser.report(144);
|
|
6898
7023
|
expr = parseImportExpression(parser, context, privateScope, inGroup, start);
|
|
6899
7024
|
parser.assignable = 2;
|
|
6900
7025
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6901
7026
|
}
|
|
6902
|
-
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6903
|
-
|
|
6904
|
-
|
|
7027
|
+
function parseImportMetaExpression(parser, context, meta, start, privateScope, inGroup = 0, inNew = 0) {
|
|
7028
|
+
const propertyStart = parser.tokenStart;
|
|
7029
|
+
const propertyEnd = parser.currentLocation;
|
|
6905
7030
|
nextToken(parser, context);
|
|
6906
7031
|
const token = parser.getToken();
|
|
7032
|
+
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && parser.tokenValue === 'defer';
|
|
7033
|
+
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && parser.tokenValue === 'source';
|
|
7034
|
+
if (isPhaseDefer || isPhaseSource) {
|
|
7035
|
+
if (inNew)
|
|
7036
|
+
parser.report(144);
|
|
7037
|
+
nextToken(parser, context);
|
|
7038
|
+
const expression = parseImportExpression(parser, context, privateScope, inGroup, start, parser.tokenValue);
|
|
7039
|
+
parser.assignable = 2;
|
|
7040
|
+
return expression;
|
|
7041
|
+
}
|
|
7042
|
+
if ((context & 2) === 0) {
|
|
7043
|
+
throw new ParseError(propertyStart, propertyEnd, 171);
|
|
7044
|
+
}
|
|
6907
7045
|
if (token !== 209031 && parser.tokenValue !== 'meta') {
|
|
6908
|
-
parser.report(
|
|
7046
|
+
parser.report(176);
|
|
6909
7047
|
}
|
|
6910
7048
|
else if (token & -2147483648) {
|
|
6911
|
-
parser.report(
|
|
7049
|
+
parser.report(177);
|
|
6912
7050
|
}
|
|
6913
7051
|
parser.assignable = 2;
|
|
6914
7052
|
return parser.finishNode({
|
|
@@ -6917,10 +7055,10 @@ function parseImportMetaExpression(parser, context, meta, start) {
|
|
|
6917
7055
|
property: parseIdentifier(parser, context),
|
|
6918
7056
|
}, start);
|
|
6919
7057
|
}
|
|
6920
|
-
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
7058
|
+
function parseImportExpression(parser, context, privateScope, inGroup, start, phase = null) {
|
|
6921
7059
|
consume(parser, context | 32, 67174411);
|
|
6922
7060
|
if (parser.getToken() === 14)
|
|
6923
|
-
parser.report(
|
|
7061
|
+
parser.report(145);
|
|
6924
7062
|
const source = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
|
|
6925
7063
|
let options = null;
|
|
6926
7064
|
if (parser.getToken() === 18) {
|
|
@@ -6935,6 +7073,7 @@ function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
|
6935
7073
|
type: 'ImportExpression',
|
|
6936
7074
|
source,
|
|
6937
7075
|
options,
|
|
7076
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6938
7077
|
};
|
|
6939
7078
|
consume(parser, context, 16);
|
|
6940
7079
|
return parser.finishNode(node, start);
|
|
@@ -6952,7 +7091,7 @@ function parseImportAttributes(parser, context) {
|
|
|
6952
7091
|
const value = parseStringLiteral(parser, context);
|
|
6953
7092
|
const keyContent = key.type === 'Literal' ? key.value : key.name;
|
|
6954
7093
|
if (keysContent.has(keyContent)) {
|
|
6955
|
-
parser.report(
|
|
7094
|
+
parser.report(147, keyContent);
|
|
6956
7095
|
}
|
|
6957
7096
|
keysContent.add(keyContent);
|
|
6958
7097
|
attributes.push(parser.finishNode({
|
|
@@ -6990,7 +7129,7 @@ function parseModuleExportName(parser, context) {
|
|
|
6990
7129
|
if (parser.getToken() === 134283267) {
|
|
6991
7130
|
const value = parser.tokenValue;
|
|
6992
7131
|
if (!value.isWellFormed()) {
|
|
6993
|
-
parser.report(
|
|
7132
|
+
parser.report(173);
|
|
6994
7133
|
}
|
|
6995
7134
|
return parseLiteral(parser, context);
|
|
6996
7135
|
}
|
|
@@ -7165,7 +7304,7 @@ function parseThisExpression(parser, context) {
|
|
|
7165
7304
|
type: 'ThisExpression',
|
|
7166
7305
|
}, tokenStart);
|
|
7167
7306
|
}
|
|
7168
|
-
function parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
7307
|
+
function parseFunctionDeclaration(parser, context, scope, privateScope, allowGen, flags, isAsync, start, origin = 0) {
|
|
7169
7308
|
nextToken(parser, context | 32);
|
|
7170
7309
|
const isGenerator = allowGen ? optionalBit(parser, context, 8391476) : 0;
|
|
7171
7310
|
let id = null;
|
|
@@ -7219,7 +7358,7 @@ function parseFunctionDeclaration(parser, context, scope, privateScope, origin,
|
|
|
7219
7358
|
functionScope = functionScope?.createChildScope(256);
|
|
7220
7359
|
const params = parseFormalParametersOrFormalList(parser, (context | 8192) & -524289, functionScope, privateScope, 0, 1);
|
|
7221
7360
|
const modifierFlags = 8 | 4 | 128 | 524288;
|
|
7222
|
-
const body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 32768 | 4096, functionScope?.createChildScope(64), privateScope,
|
|
7361
|
+
const body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 32768 | 4096, functionScope?.createChildScope(64), privateScope, funcNameToken, functionScope, 8);
|
|
7223
7362
|
return parser.finishNode({
|
|
7224
7363
|
type: 'FunctionDeclaration',
|
|
7225
7364
|
id,
|
|
@@ -7258,7 +7397,7 @@ function parseFunctionExpression(parser, context, privateScope, isAsync, inGroup
|
|
|
7258
7397
|
const params = parseFormalParametersOrFormalList(parser, (context | 8192) & -524289, scope, privateScope, inGroup, 1);
|
|
7259
7398
|
const body = parseFunctionBody(parser, (context & -131229) |
|
|
7260
7399
|
32768 |
|
|
7261
|
-
4096, scope?.createChildScope(64), privateScope,
|
|
7400
|
+
4096, scope?.createChildScope(64), privateScope, funcNameToken, scope);
|
|
7262
7401
|
parser.assignable = 2;
|
|
7263
7402
|
return parser.finishNode({
|
|
7264
7403
|
type: 'FunctionExpression',
|
|
@@ -7270,7 +7409,7 @@ function parseFunctionExpression(parser, context, privateScope, isAsync, inGroup
|
|
|
7270
7409
|
}, start);
|
|
7271
7410
|
}
|
|
7272
7411
|
function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGroup) {
|
|
7273
|
-
const expr = parseArrayExpressionOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2
|
|
7412
|
+
const expr = parseArrayExpressionOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2);
|
|
7274
7413
|
if (parser.destructible & 64) {
|
|
7275
7414
|
parser.report(63);
|
|
7276
7415
|
}
|
|
@@ -7279,7 +7418,7 @@ function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGro
|
|
|
7279
7418
|
}
|
|
7280
7419
|
return expr;
|
|
7281
7420
|
}
|
|
7282
|
-
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin) {
|
|
7421
|
+
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
7283
7422
|
const { tokenStart: start } = parser;
|
|
7284
7423
|
nextToken(parser, context | 32);
|
|
7285
7424
|
const elements = [];
|
|
@@ -7388,7 +7527,7 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
7388
7527
|
}
|
|
7389
7528
|
}
|
|
7390
7529
|
else if (token === 14) {
|
|
7391
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 20, kind,
|
|
7530
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 20, kind, 0, inGroup, isPattern, origin);
|
|
7392
7531
|
destructible |= parser.destructible;
|
|
7393
7532
|
if (parser.getToken() !== 18 && parser.getToken() !== 20)
|
|
7394
7533
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -7458,7 +7597,7 @@ function parseArrayOrObjectAssignmentPattern(parser, context, privateScope, dest
|
|
|
7458
7597
|
right,
|
|
7459
7598
|
}, start);
|
|
7460
7599
|
}
|
|
7461
|
-
function parseSpreadOrRestElement(parser, context, scope, privateScope, closingToken, kind,
|
|
7600
|
+
function parseSpreadOrRestElement(parser, context, scope, privateScope, closingToken, kind, isAsync, inGroup, isPattern, origin = 0) {
|
|
7462
7601
|
const { tokenStart: start } = parser;
|
|
7463
7602
|
nextToken(parser, context | 32);
|
|
7464
7603
|
let argument = null;
|
|
@@ -7551,7 +7690,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7551
7690
|
}
|
|
7552
7691
|
parser.destructible = destructible;
|
|
7553
7692
|
if (parser.getToken() !== closingToken && parser.getToken() !== 18)
|
|
7554
|
-
parser.report(
|
|
7693
|
+
parser.report(163);
|
|
7555
7694
|
return parser.finishNode({
|
|
7556
7695
|
type: isPattern ? 'RestElement' : 'SpreadElement',
|
|
7557
7696
|
argument: argument,
|
|
@@ -7607,7 +7746,7 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
|
|
|
7607
7746
|
scope = scope?.createChildScope(64);
|
|
7608
7747
|
const body = parseFunctionBody(parser, (context & -655373) |
|
|
7609
7748
|
32768 |
|
|
7610
|
-
4096, scope, privateScope,
|
|
7749
|
+
4096, scope, privateScope, void 0, scope?.parent);
|
|
7611
7750
|
return parser.finishNode({
|
|
7612
7751
|
type: 'FunctionExpression',
|
|
7613
7752
|
params,
|
|
@@ -7618,7 +7757,7 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
|
|
|
7618
7757
|
}, start);
|
|
7619
7758
|
}
|
|
7620
7759
|
function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGroup) {
|
|
7621
|
-
const expr = parseObjectLiteralOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2
|
|
7760
|
+
const expr = parseObjectLiteralOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2);
|
|
7622
7761
|
if (parser.destructible & 64) {
|
|
7623
7762
|
parser.report(63);
|
|
7624
7763
|
}
|
|
@@ -7627,7 +7766,7 @@ function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGr
|
|
|
7627
7766
|
}
|
|
7628
7767
|
return expr;
|
|
7629
7768
|
}
|
|
7630
|
-
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin) {
|
|
7769
|
+
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
7631
7770
|
const { tokenStart: start } = parser;
|
|
7632
7771
|
nextToken(parser, context);
|
|
7633
7772
|
const properties = [];
|
|
@@ -7638,7 +7777,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7638
7777
|
const { tokenValue, tokenStart } = parser;
|
|
7639
7778
|
const token = parser.getToken();
|
|
7640
7779
|
if (token === 14) {
|
|
7641
|
-
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind,
|
|
7780
|
+
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind, 0, inGroup, isPattern, origin));
|
|
7642
7781
|
}
|
|
7643
7782
|
else {
|
|
7644
7783
|
let state = 0;
|
|
@@ -7810,7 +7949,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7810
7949
|
parser.report(95);
|
|
7811
7950
|
if (token === 209005) {
|
|
7812
7951
|
if (parser.flags & 1)
|
|
7813
|
-
parser.report(
|
|
7952
|
+
parser.report(134);
|
|
7814
7953
|
state |= 16 | 1;
|
|
7815
7954
|
}
|
|
7816
7955
|
else if (token === 209008) {
|
|
@@ -7874,7 +8013,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7874
8013
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7875
8014
|
}
|
|
7876
8015
|
else {
|
|
7877
|
-
parser.report(
|
|
8016
|
+
parser.report(135);
|
|
7878
8017
|
}
|
|
7879
8018
|
}
|
|
7880
8019
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -7978,7 +8117,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7978
8117
|
destructible = 16;
|
|
7979
8118
|
}
|
|
7980
8119
|
else {
|
|
7981
|
-
parser.report(
|
|
8120
|
+
parser.report(136);
|
|
7982
8121
|
}
|
|
7983
8122
|
}
|
|
7984
8123
|
else if (parser.getToken() === 69271571) {
|
|
@@ -8125,7 +8264,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
8125
8264
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
8126
8265
|
}
|
|
8127
8266
|
else {
|
|
8128
|
-
parser.report(
|
|
8267
|
+
parser.report(128);
|
|
8129
8268
|
}
|
|
8130
8269
|
}
|
|
8131
8270
|
else {
|
|
@@ -8166,6 +8305,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
8166
8305
|
const params = [];
|
|
8167
8306
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8168
8307
|
parser.strictReservedRange = null;
|
|
8308
|
+
parser.firstAwaitLocation = null;
|
|
8169
8309
|
if (parser.getToken() === 16) {
|
|
8170
8310
|
if (kind & 512) {
|
|
8171
8311
|
parser.report(37, 'Setter', 'one', '');
|
|
@@ -8195,17 +8335,17 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
8195
8335
|
parser.flags |= 512;
|
|
8196
8336
|
}
|
|
8197
8337
|
}
|
|
8198
|
-
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1
|
|
8338
|
+
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
|
|
8199
8339
|
}
|
|
8200
8340
|
else {
|
|
8201
8341
|
if (parser.getToken() === 2162700) {
|
|
8202
|
-
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type
|
|
8342
|
+
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type);
|
|
8203
8343
|
}
|
|
8204
8344
|
else if (parser.getToken() === 69271571) {
|
|
8205
|
-
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type
|
|
8345
|
+
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type);
|
|
8206
8346
|
}
|
|
8207
8347
|
else if (parser.getToken() === 14) {
|
|
8208
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, type, 0,
|
|
8348
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, type, 0, inGroup, 1);
|
|
8209
8349
|
}
|
|
8210
8350
|
isNonSimpleParameterList = 1;
|
|
8211
8351
|
if (parser.destructible & (32 | 16))
|
|
@@ -8244,17 +8384,20 @@ function parseComputedPropertyName(parser, context, privateScope, inGroup) {
|
|
|
8244
8384
|
consume(parser, context, 20);
|
|
8245
8385
|
return key;
|
|
8246
8386
|
}
|
|
8247
|
-
function parseParenthesizedExpression(parser, context, privateScope, canAssign, kind,
|
|
8387
|
+
function parseParenthesizedExpression(parser, context, privateScope, canAssign, kind, start, origin) {
|
|
8248
8388
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8249
8389
|
const parenthesesStart = parser.tokenStart;
|
|
8250
8390
|
nextToken(parser, context | 32 | 262144);
|
|
8251
8391
|
const scope = parser.createScopeIfLexical()?.createChildScope(512);
|
|
8252
8392
|
context = (context | 131072) ^ 131072;
|
|
8253
8393
|
if (consumeOpt(parser, context, 16)) {
|
|
8254
|
-
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 0, start);
|
|
8394
|
+
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 0, start, origin);
|
|
8255
8395
|
}
|
|
8256
8396
|
let destructible = 0;
|
|
8397
|
+
const previousAwaitYield = parser.destructible & (256 | 128);
|
|
8257
8398
|
parser.destructible &= -385;
|
|
8399
|
+
const previousFirstAwaitLocation = parser.firstAwaitLocation;
|
|
8400
|
+
parser.firstAwaitLocation = null;
|
|
8258
8401
|
let expr;
|
|
8259
8402
|
let expressions = [];
|
|
8260
8403
|
let isSequence = 0;
|
|
@@ -8266,14 +8409,14 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8266
8409
|
const { tokenStart } = parser;
|
|
8267
8410
|
const token = parser.getToken();
|
|
8268
8411
|
if (token & 143360) {
|
|
8269
|
-
scope?.addBlockName(context, parser.tokenValue, 1
|
|
8412
|
+
scope?.addBlockName(context, parser.tokenValue, 1);
|
|
8270
8413
|
if ((token & 537079808) === 537079808) {
|
|
8271
8414
|
isNonSimpleParameterList = 1;
|
|
8272
8415
|
}
|
|
8273
8416
|
else if ((token & 36864) === 36864) {
|
|
8274
8417
|
hasStrictReserved = 1;
|
|
8275
8418
|
}
|
|
8276
|
-
expr = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, 1, 1, tokenStart);
|
|
8419
|
+
expr = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, 1, 1, tokenStart, 0);
|
|
8277
8420
|
if (parser.getToken() === 16 || parser.getToken() === 18) {
|
|
8278
8421
|
if (parser.assignable & 2) {
|
|
8279
8422
|
destructible |= 16;
|
|
@@ -8296,14 +8439,14 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8296
8439
|
else if ((token & 2097152) === 2097152) {
|
|
8297
8440
|
expr =
|
|
8298
8441
|
token === 2162700
|
|
8299
|
-
? parseObjectLiteralOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind
|
|
8300
|
-
: parseArrayExpressionOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind
|
|
8442
|
+
? parseObjectLiteralOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind)
|
|
8443
|
+
: parseArrayExpressionOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind);
|
|
8301
8444
|
destructible |= parser.destructible;
|
|
8302
8445
|
isNonSimpleParameterList = 1;
|
|
8303
8446
|
parser.assignable = 2;
|
|
8304
8447
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8305
8448
|
if (destructible & 8)
|
|
8306
|
-
parser.report(
|
|
8449
|
+
parser.report(124);
|
|
8307
8450
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8308
8451
|
destructible |= 16;
|
|
8309
8452
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
@@ -8312,7 +8455,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8312
8455
|
}
|
|
8313
8456
|
}
|
|
8314
8457
|
else if (token === 14) {
|
|
8315
|
-
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind,
|
|
8458
|
+
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0, 1, 0);
|
|
8316
8459
|
if (parser.destructible & 16)
|
|
8317
8460
|
parser.report(74);
|
|
8318
8461
|
isNonSimpleParameterList = 1;
|
|
@@ -8345,7 +8488,10 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8345
8488
|
}, tokenAfterParenthesesStart);
|
|
8346
8489
|
}
|
|
8347
8490
|
consume(parser, context, 16);
|
|
8348
|
-
parser.destructible = destructible;
|
|
8491
|
+
parser.destructible = destructible | previousAwaitYield;
|
|
8492
|
+
if (previousFirstAwaitLocation) {
|
|
8493
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8494
|
+
}
|
|
8349
8495
|
return parser.options.preserveParens
|
|
8350
8496
|
? parser.finishNode({
|
|
8351
8497
|
type: 'ParenthesizedExpression',
|
|
@@ -8376,7 +8522,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8376
8522
|
}
|
|
8377
8523
|
consume(parser, context, 16);
|
|
8378
8524
|
if (destructible & 16 && destructible & 8)
|
|
8379
|
-
parser.report(
|
|
8525
|
+
parser.report(153);
|
|
8380
8526
|
destructible |=
|
|
8381
8527
|
parser.destructible & 256
|
|
8382
8528
|
? 256
|
|
@@ -8386,8 +8532,12 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8386
8532
|
if (parser.getToken() === 10) {
|
|
8387
8533
|
if (destructible & (32 | 16))
|
|
8388
8534
|
parser.report(49);
|
|
8389
|
-
if (context & (2048 | 2) && destructible & 128)
|
|
8535
|
+
if (context & (2048 | 2) && destructible & 128) {
|
|
8536
|
+
const loc = parser.firstAwaitLocation;
|
|
8537
|
+
if (loc)
|
|
8538
|
+
throw new ParseError(loc.start, loc.end, 31);
|
|
8390
8539
|
parser.report(31);
|
|
8540
|
+
}
|
|
8391
8541
|
if (context & (1 | 1024) && destructible & 256) {
|
|
8392
8542
|
parser.report(32);
|
|
8393
8543
|
}
|
|
@@ -8395,15 +8545,19 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8395
8545
|
parser.flags |= 128;
|
|
8396
8546
|
if (hasStrictReserved)
|
|
8397
8547
|
parser.flags |= 256;
|
|
8398
|
-
return parseParenthesizedArrow(parser, context, scope, privateScope, isSequence ? expressions : [expr], canAssign, 0, start);
|
|
8548
|
+
return parseParenthesizedArrow(parser, context, scope, privateScope, isSequence ? expressions : [expr], canAssign, 0, start, origin);
|
|
8399
8549
|
}
|
|
8400
8550
|
if (destructible & 64) {
|
|
8401
8551
|
parser.report(63);
|
|
8402
8552
|
}
|
|
8403
8553
|
if (destructible & 8) {
|
|
8404
|
-
parser.report(
|
|
8554
|
+
parser.report(146);
|
|
8555
|
+
}
|
|
8556
|
+
parser.destructible =
|
|
8557
|
+
((parser.destructible | 256) ^ 256) | destructible | previousAwaitYield;
|
|
8558
|
+
if (previousFirstAwaitLocation) {
|
|
8559
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8405
8560
|
}
|
|
8406
|
-
parser.destructible = ((parser.destructible | 256) ^ 256) | destructible;
|
|
8407
8561
|
return parser.options.preserveParens
|
|
8408
8562
|
? parser.finishNode({
|
|
8409
8563
|
type: 'ParenthesizedExpression',
|
|
@@ -8434,23 +8588,23 @@ function parseIdentifierOrArrow(parser, context, privateScope) {
|
|
|
8434
8588
|
}
|
|
8435
8589
|
return expr;
|
|
8436
8590
|
}
|
|
8437
|
-
function parseArrowFromIdentifier(parser, context, privateScope, value, expr, inNew, canAssign, isAsync, start) {
|
|
8591
|
+
function parseArrowFromIdentifier(parser, context, privateScope, value, expr, inNew, canAssign, isAsync, start, origin = 0) {
|
|
8438
8592
|
if (!canAssign)
|
|
8439
8593
|
parser.report(57);
|
|
8440
8594
|
if (inNew)
|
|
8441
8595
|
parser.report(51);
|
|
8442
8596
|
parser.flags &= -129;
|
|
8443
8597
|
const scope = parser.options.lexical ? createArrowHeadParsingScope(parser, context, value) : void 0;
|
|
8444
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start);
|
|
8598
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start, origin);
|
|
8445
8599
|
}
|
|
8446
|
-
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start) {
|
|
8600
|
+
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start, origin = 0) {
|
|
8447
8601
|
if (!canAssign)
|
|
8448
8602
|
parser.report(57);
|
|
8449
8603
|
for (let i = 0; i < params.length; ++i)
|
|
8450
8604
|
reinterpretToPattern(parser, params[i]);
|
|
8451
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start);
|
|
8605
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start, origin);
|
|
8452
8606
|
}
|
|
8453
|
-
function parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start) {
|
|
8607
|
+
function parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start, origin = 0) {
|
|
8454
8608
|
if (parser.flags & 1)
|
|
8455
8609
|
parser.report(48);
|
|
8456
8610
|
consume(parser, context | 32, 10);
|
|
@@ -8468,29 +8622,32 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
8468
8622
|
else {
|
|
8469
8623
|
scope = scope?.createChildScope(64);
|
|
8470
8624
|
const modifierFlags = 4 | 131072 | 8;
|
|
8471
|
-
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope,
|
|
8625
|
+
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
|
|
8472
8626
|
switch (parser.getToken()) {
|
|
8473
8627
|
case 69271571:
|
|
8474
8628
|
if ((parser.flags & 1) === 0) {
|
|
8475
|
-
parser.report(
|
|
8629
|
+
parser.report(118);
|
|
8476
8630
|
}
|
|
8477
8631
|
parser.flags |= 8192;
|
|
8478
8632
|
break;
|
|
8479
8633
|
case 67108877:
|
|
8480
8634
|
case 67174409:
|
|
8481
8635
|
case 22:
|
|
8482
|
-
parser.report(
|
|
8636
|
+
parser.report(119);
|
|
8483
8637
|
case 67174411:
|
|
8484
8638
|
if ((parser.flags & 1) === 0) {
|
|
8485
|
-
parser.report(
|
|
8639
|
+
parser.report(118);
|
|
8486
8640
|
}
|
|
8487
8641
|
parser.flags |= 1024;
|
|
8488
8642
|
break;
|
|
8489
8643
|
}
|
|
8490
|
-
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0)
|
|
8491
|
-
|
|
8644
|
+
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0) {
|
|
8645
|
+
if (parser.getToken() !== 8673330 || origin !== 32) {
|
|
8646
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
8647
|
+
}
|
|
8648
|
+
}
|
|
8492
8649
|
if ((parser.getToken() & 33619968) === 33619968)
|
|
8493
|
-
parser.report(
|
|
8650
|
+
parser.report(127);
|
|
8494
8651
|
}
|
|
8495
8652
|
parser.assignable = 2;
|
|
8496
8653
|
return parser.finishNode({
|
|
@@ -8506,6 +8663,7 @@ function parseFormalParametersOrFormalList(parser, context, scope, privateScope,
|
|
|
8506
8663
|
consume(parser, context, 67174411);
|
|
8507
8664
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8508
8665
|
parser.strictReservedRange = null;
|
|
8666
|
+
parser.firstAwaitLocation = null;
|
|
8509
8667
|
const params = [];
|
|
8510
8668
|
if (consumeOpt(parser, context, 16))
|
|
8511
8669
|
return params;
|
|
@@ -8525,17 +8683,17 @@ function parseFormalParametersOrFormalList(parser, context, scope, privateScope,
|
|
|
8525
8683
|
parser.flags |= 512;
|
|
8526
8684
|
}
|
|
8527
8685
|
}
|
|
8528
|
-
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1
|
|
8686
|
+
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
|
|
8529
8687
|
}
|
|
8530
8688
|
else {
|
|
8531
8689
|
if (token === 2162700) {
|
|
8532
|
-
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind
|
|
8690
|
+
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind);
|
|
8533
8691
|
}
|
|
8534
8692
|
else if (token === 69271571) {
|
|
8535
|
-
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind
|
|
8693
|
+
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind);
|
|
8536
8694
|
}
|
|
8537
8695
|
else if (token === 14) {
|
|
8538
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0,
|
|
8696
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0, inGroup, 1);
|
|
8539
8697
|
}
|
|
8540
8698
|
else {
|
|
8541
8699
|
parser.report(30, KeywordDescTable[token & 255]);
|
|
@@ -8630,7 +8788,7 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
8630
8788
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
8631
8789
|
context = (context | 131072) ^ 131072;
|
|
8632
8790
|
if (parser.getToken() === 67108991)
|
|
8633
|
-
parser.report(
|
|
8791
|
+
parser.report(170);
|
|
8634
8792
|
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
8635
8793
|
parser.assignable = 2;
|
|
8636
8794
|
return parser.finishNode({
|
|
@@ -8659,9 +8817,11 @@ function parseAsyncArrowAfterIdent(parser, context, privateScope, canAssign, sta
|
|
|
8659
8817
|
}
|
|
8660
8818
|
return parseArrowFromIdentifier(parser, (context & -524289) | 2048, privateScope, parser.tokenValue, parseIdentifier(parser, context), 0, canAssign, 1, start);
|
|
8661
8819
|
}
|
|
8662
|
-
function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee, canAssign, kind,
|
|
8820
|
+
function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee, canAssign, kind, flags, start) {
|
|
8663
8821
|
nextToken(parser, context | 32);
|
|
8664
8822
|
const scope = parser.createScopeIfLexical()?.createChildScope(512);
|
|
8823
|
+
const previousFirstAwaitLocation = parser.firstAwaitLocation;
|
|
8824
|
+
parser.firstAwaitLocation = null;
|
|
8665
8825
|
context = (context | 131072) ^ 131072;
|
|
8666
8826
|
if (consumeOpt(parser, context, 16)) {
|
|
8667
8827
|
if (parser.getToken() === 10) {
|
|
@@ -8675,6 +8835,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8675
8835
|
else {
|
|
8676
8836
|
parser.assignable = 2;
|
|
8677
8837
|
}
|
|
8838
|
+
if (previousFirstAwaitLocation)
|
|
8839
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8678
8840
|
return parser.finishNode({
|
|
8679
8841
|
type: 'CallExpression',
|
|
8680
8842
|
callee,
|
|
@@ -8693,7 +8855,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8693
8855
|
const { tokenStart } = parser;
|
|
8694
8856
|
const token = parser.getToken();
|
|
8695
8857
|
if (token & 143360) {
|
|
8696
|
-
scope?.addBlockName(context, parser.tokenValue, kind
|
|
8858
|
+
scope?.addBlockName(context, parser.tokenValue, kind);
|
|
8697
8859
|
if ((token & 537079808) === 537079808) {
|
|
8698
8860
|
parser.flags |= 512;
|
|
8699
8861
|
}
|
|
@@ -8723,13 +8885,13 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8723
8885
|
else if (token & 2097152) {
|
|
8724
8886
|
expr =
|
|
8725
8887
|
token === 2162700
|
|
8726
|
-
? parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind
|
|
8727
|
-
: parseArrayExpressionOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind
|
|
8888
|
+
? parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind)
|
|
8889
|
+
: parseArrayExpressionOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind);
|
|
8728
8890
|
destructible |= parser.destructible;
|
|
8729
8891
|
isNonSimpleParameterList = 1;
|
|
8730
8892
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8731
8893
|
if (destructible & 8)
|
|
8732
|
-
parser.report(
|
|
8894
|
+
parser.report(124);
|
|
8733
8895
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8734
8896
|
destructible |= 16;
|
|
8735
8897
|
if ((parser.getToken() & 8388608) === 8388608) {
|
|
@@ -8741,7 +8903,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8741
8903
|
}
|
|
8742
8904
|
}
|
|
8743
8905
|
else if (token === 14) {
|
|
8744
|
-
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind,
|
|
8906
|
+
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 1, 1, 0);
|
|
8745
8907
|
destructible |=
|
|
8746
8908
|
(parser.getToken() === 16 ? 0 : 16) | parser.destructible;
|
|
8747
8909
|
isNonSimpleParameterList = 1;
|
|
@@ -8762,6 +8924,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8762
8924
|
else {
|
|
8763
8925
|
parser.assignable = 2;
|
|
8764
8926
|
}
|
|
8927
|
+
if (previousFirstAwaitLocation)
|
|
8928
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8765
8929
|
return parser.finishNode({
|
|
8766
8930
|
type: 'CallExpression',
|
|
8767
8931
|
callee,
|
|
@@ -8785,8 +8949,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8785
8949
|
parser.report(27);
|
|
8786
8950
|
if (parser.flags & 1 || flags & 1)
|
|
8787
8951
|
parser.report(48);
|
|
8788
|
-
if (destructible & 128)
|
|
8952
|
+
if (destructible & 128) {
|
|
8953
|
+
const loc = parser.firstAwaitLocation;
|
|
8954
|
+
if (loc)
|
|
8955
|
+
throw new ParseError(loc.start, loc.end, 31);
|
|
8789
8956
|
parser.report(31);
|
|
8957
|
+
}
|
|
8790
8958
|
if (context & (1 | 1024) && destructible & 256)
|
|
8791
8959
|
parser.report(32);
|
|
8792
8960
|
if (isNonSimpleParameterList)
|
|
@@ -8805,6 +8973,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8805
8973
|
else {
|
|
8806
8974
|
parser.assignable = 2;
|
|
8807
8975
|
}
|
|
8976
|
+
if (previousFirstAwaitLocation)
|
|
8977
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8808
8978
|
return parser.finishNode({
|
|
8809
8979
|
type: 'CallExpression',
|
|
8810
8980
|
callee,
|
|
@@ -8830,9 +9000,6 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8830
9000
|
let start;
|
|
8831
9001
|
let decorators;
|
|
8832
9002
|
if (parser.leadingDecorators.decorators.length) {
|
|
8833
|
-
if (parser.getToken() === 133) {
|
|
8834
|
-
parser.report(30, '@');
|
|
8835
|
-
}
|
|
8836
9003
|
start = parser.leadingDecorators.start;
|
|
8837
9004
|
decorators = [...parser.leadingDecorators.decorators];
|
|
8838
9005
|
parser.leadingDecorators.decorators.length = 0;
|
|
@@ -8842,19 +9009,19 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8842
9009
|
decorators = parseDecorators(parser, context, privateScope);
|
|
8843
9010
|
}
|
|
8844
9011
|
context = (context | 16384 | 1) ^ 16384;
|
|
8845
|
-
|
|
9012
|
+
consume(parser, context, 86094);
|
|
8846
9013
|
let id = null;
|
|
8847
9014
|
let superClass = null;
|
|
8848
9015
|
const { tokenValue } = parser;
|
|
8849
9016
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8850
9017
|
if (isStrictReservedWord(parser, context, parser.getToken())) {
|
|
8851
|
-
parser.report(
|
|
9018
|
+
parser.report(120);
|
|
8852
9019
|
}
|
|
8853
9020
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8854
|
-
parser.report(
|
|
9021
|
+
parser.report(121);
|
|
8855
9022
|
}
|
|
8856
9023
|
if (scope) {
|
|
8857
|
-
scope.addBlockName(context, tokenValue, 32
|
|
9024
|
+
scope.addBlockName(context, tokenValue, 32);
|
|
8858
9025
|
if (flags) {
|
|
8859
9026
|
if (flags & 2) {
|
|
8860
9027
|
parser.declareUnboundVariable(tokenValue);
|
|
@@ -8875,13 +9042,13 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8875
9042
|
else {
|
|
8876
9043
|
inheritedContext = (inheritedContext | 512) ^ 512;
|
|
8877
9044
|
}
|
|
8878
|
-
const body = parseClassBody(parser, inheritedContext, context, scope, privateScope, 2,
|
|
9045
|
+
const body = parseClassBody(parser, inheritedContext, context, scope, privateScope, 2, 0, 8);
|
|
8879
9046
|
return parser.finishNode({
|
|
8880
9047
|
type: 'ClassDeclaration',
|
|
8881
9048
|
id,
|
|
8882
9049
|
superClass,
|
|
8883
9050
|
body,
|
|
8884
|
-
...(parser.
|
|
9051
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8885
9052
|
}, start);
|
|
8886
9053
|
}
|
|
8887
9054
|
function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
@@ -8889,12 +9056,12 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
|
8889
9056
|
let superClass = null;
|
|
8890
9057
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8891
9058
|
context = (context | 1 | 16384) ^ 16384;
|
|
8892
|
-
|
|
9059
|
+
consume(parser, context, 86094);
|
|
8893
9060
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8894
9061
|
if (isStrictReservedWord(parser, context, parser.getToken()))
|
|
8895
|
-
parser.report(
|
|
9062
|
+
parser.report(120);
|
|
8896
9063
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8897
|
-
parser.report(
|
|
9064
|
+
parser.report(121);
|
|
8898
9065
|
}
|
|
8899
9066
|
id = parseIdentifier(parser, context);
|
|
8900
9067
|
}
|
|
@@ -8906,37 +9073,74 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
|
8906
9073
|
else {
|
|
8907
9074
|
inheritedContext = (inheritedContext | 512) ^ 512;
|
|
8908
9075
|
}
|
|
8909
|
-
const body = parseClassBody(parser, inheritedContext, context, void 0, privateScope, 2,
|
|
9076
|
+
const body = parseClassBody(parser, inheritedContext, context, void 0, privateScope, 2, inGroup);
|
|
8910
9077
|
parser.assignable = 2;
|
|
8911
9078
|
return parser.finishNode({
|
|
8912
9079
|
type: 'ClassExpression',
|
|
8913
9080
|
id,
|
|
8914
9081
|
superClass,
|
|
8915
9082
|
body,
|
|
8916
|
-
...(parser.
|
|
9083
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8917
9084
|
}, start);
|
|
8918
9085
|
}
|
|
8919
9086
|
function parseDecorators(parser, context, privateScope) {
|
|
8920
9087
|
const list = [];
|
|
8921
|
-
if (parser.
|
|
9088
|
+
if (parser.features & 1) {
|
|
8922
9089
|
while (parser.getToken() === 133) {
|
|
8923
|
-
list.push(
|
|
9090
|
+
list.push(parseDecorator(parser, context, privateScope));
|
|
8924
9091
|
}
|
|
8925
9092
|
}
|
|
8926
9093
|
return list;
|
|
8927
9094
|
}
|
|
8928
|
-
function
|
|
9095
|
+
function parseDecorator(parser, context, privateScope) {
|
|
8929
9096
|
const start = parser.tokenStart;
|
|
8930
9097
|
nextToken(parser, context | 32);
|
|
8931
9098
|
const expressionStart = parser.tokenStart;
|
|
8932
|
-
let expression
|
|
8933
|
-
|
|
9099
|
+
let expression;
|
|
9100
|
+
if (parser.getToken() === 67174411) {
|
|
9101
|
+
expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
|
|
9102
|
+
}
|
|
9103
|
+
else {
|
|
9104
|
+
const token = parser.getToken();
|
|
9105
|
+
if (((token & 143360) !== 143360 && !isValidIdentifier(context, token)) ||
|
|
9106
|
+
(context & 1 && (token & 36864) === 36864)) {
|
|
9107
|
+
parser.report(30, KeywordDescTable[token & 255]);
|
|
9108
|
+
}
|
|
9109
|
+
if (token === 209006 && context & (2048 | 2)) {
|
|
9110
|
+
parser.report(112);
|
|
9111
|
+
}
|
|
9112
|
+
if (token === 241771 && context & 1024) {
|
|
9113
|
+
parser.report(97, 'yield');
|
|
9114
|
+
}
|
|
9115
|
+
let memberExpression = parseIdentifier(parser, context | 64);
|
|
9116
|
+
while (parser.getToken() === 67108877) {
|
|
9117
|
+
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
9118
|
+
const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
|
|
9119
|
+
memberExpression = parser.finishNode({
|
|
9120
|
+
type: 'MemberExpression',
|
|
9121
|
+
object: memberExpression,
|
|
9122
|
+
computed: false,
|
|
9123
|
+
property,
|
|
9124
|
+
optional: false,
|
|
9125
|
+
}, expressionStart);
|
|
9126
|
+
}
|
|
9127
|
+
expression = memberExpression;
|
|
9128
|
+
if (parser.getToken() === 67174411) {
|
|
9129
|
+
const args = parseArguments(parser, context, privateScope, 0);
|
|
9130
|
+
expression = parser.finishNode({
|
|
9131
|
+
type: 'CallExpression',
|
|
9132
|
+
callee: memberExpression,
|
|
9133
|
+
arguments: args,
|
|
9134
|
+
optional: false,
|
|
9135
|
+
}, expressionStart);
|
|
9136
|
+
}
|
|
9137
|
+
}
|
|
8934
9138
|
return parser.finishNode({
|
|
8935
9139
|
type: 'Decorator',
|
|
8936
9140
|
expression,
|
|
8937
9141
|
}, start);
|
|
8938
9142
|
}
|
|
8939
|
-
function parseClassBody(parser, context, inheritedContext, scope, parentScope, kind,
|
|
9143
|
+
function parseClassBody(parser, context, inheritedContext, scope, parentScope, kind, inGroup, origin = 0) {
|
|
8940
9144
|
const { tokenStart } = parser;
|
|
8941
9145
|
const privateScope = parser.createPrivateScopeIfLexical(parentScope);
|
|
8942
9146
|
consume(parser, context | 32, 2162700);
|
|
@@ -8949,13 +9153,13 @@ function parseClassBody(parser, context, inheritedContext, scope, parentScope, k
|
|
|
8949
9153
|
const decoratorStart = parser.tokenStart;
|
|
8950
9154
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8951
9155
|
if (decorators.length > 0 && parser.tokenValue === 'constructor') {
|
|
8952
|
-
parser.report(
|
|
9156
|
+
parser.report(111);
|
|
8953
9157
|
}
|
|
8954
9158
|
if (parser.getToken() === 1074790415)
|
|
8955
|
-
parser.report(
|
|
9159
|
+
parser.report(110);
|
|
8956
9160
|
if (consumeOpt(parser, context, 1074790417)) {
|
|
8957
9161
|
if (decorators.length > 0)
|
|
8958
|
-
parser.report(
|
|
9162
|
+
parser.report(122);
|
|
8959
9163
|
continue;
|
|
8960
9164
|
}
|
|
8961
9165
|
body.push(parseClassElementList(parser, context, scope, privateScope, inheritedContext, kind, decorators, 0, inGroup, decorators.length > 0 ? decoratorStart : parser.tokenStart));
|
|
@@ -9018,7 +9222,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
9018
9222
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
9019
9223
|
return parsePropertyDefinition(parser, context, privateScope, key, kind, decorators, start);
|
|
9020
9224
|
}
|
|
9021
|
-
if (parser.
|
|
9225
|
+
if (parser.features & 1)
|
|
9022
9226
|
kind |= 1024;
|
|
9023
9227
|
}
|
|
9024
9228
|
break;
|
|
@@ -9071,12 +9275,12 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
9071
9275
|
key = parsePrivateIdentifier(parser, context, privateScope, kind);
|
|
9072
9276
|
}
|
|
9073
9277
|
else
|
|
9074
|
-
parser.report(
|
|
9278
|
+
parser.report(137);
|
|
9075
9279
|
}
|
|
9076
9280
|
if ((kind & 2) === 0) {
|
|
9077
9281
|
if (parser.tokenValue === 'constructor') {
|
|
9078
9282
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
9079
|
-
parser.report(
|
|
9283
|
+
parser.report(131);
|
|
9080
9284
|
}
|
|
9081
9285
|
else if ((kind & 32) === 0 && parser.getToken() === 67174411) {
|
|
9082
9286
|
if (kind & (768 | 16 | 128 | 8)) {
|
|
@@ -9114,7 +9318,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
9114
9318
|
computed: (kind & 2) > 0,
|
|
9115
9319
|
key,
|
|
9116
9320
|
value,
|
|
9117
|
-
...(parser.
|
|
9321
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
9118
9322
|
}, start);
|
|
9119
9323
|
}
|
|
9120
9324
|
function parsePrivateIdentifier(parser, context, privateScope, kind) {
|
|
@@ -9122,7 +9326,7 @@ function parsePrivateIdentifier(parser, context, privateScope, kind) {
|
|
|
9122
9326
|
nextToken(parser, context);
|
|
9123
9327
|
const { tokenValue } = parser;
|
|
9124
9328
|
if (tokenValue === 'constructor')
|
|
9125
|
-
parser.report(
|
|
9329
|
+
parser.report(130);
|
|
9126
9330
|
if (parser.options.lexical) {
|
|
9127
9331
|
if (!privateScope)
|
|
9128
9332
|
parser.report(4, tokenValue);
|
|
@@ -9147,7 +9351,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
9147
9351
|
nextToken(parser, context | 32);
|
|
9148
9352
|
const { tokenStart } = parser;
|
|
9149
9353
|
if (parser.getToken() === 537079928)
|
|
9150
|
-
parser.report(
|
|
9354
|
+
parser.report(121);
|
|
9151
9355
|
const modifierFlags = 1024 |
|
|
9152
9356
|
2048 |
|
|
9153
9357
|
8192 |
|
|
@@ -9173,32 +9377,32 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
9173
9377
|
value,
|
|
9174
9378
|
static: (state & 32) > 0,
|
|
9175
9379
|
computed: (state & 2) > 0,
|
|
9176
|
-
...(parser.
|
|
9380
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
9177
9381
|
}, start);
|
|
9178
9382
|
}
|
|
9179
|
-
function parseBindingPattern(parser, context, scope, privateScope,
|
|
9383
|
+
function parseBindingPattern(parser, context, scope, privateScope, kind, origin = 0) {
|
|
9180
9384
|
if (parser.getToken() & 143360 ||
|
|
9181
9385
|
((context & 1) === 0 && parser.getToken() === -2147483526))
|
|
9182
|
-
return parseAndClassifyIdentifier(parser, context, scope,
|
|
9386
|
+
return parseAndClassifyIdentifier(parser, context, scope, kind, origin);
|
|
9183
9387
|
if ((parser.getToken() & 2097152) !== 2097152)
|
|
9184
9388
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
9185
9389
|
const left = parser.getToken() === 69271571
|
|
9186
|
-
? parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, 0, 1,
|
|
9187
|
-
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, 0, 1,
|
|
9390
|
+
? parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, 0, 1, kind, origin)
|
|
9391
|
+
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, 0, 1, kind, origin);
|
|
9188
9392
|
if (parser.destructible & 16)
|
|
9189
9393
|
parser.report(50);
|
|
9190
9394
|
if (parser.destructible & 32)
|
|
9191
9395
|
parser.report(50);
|
|
9192
9396
|
return left;
|
|
9193
9397
|
}
|
|
9194
|
-
function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
9398
|
+
function parseAndClassifyIdentifier(parser, context, scope, kind, origin = 0) {
|
|
9195
9399
|
const token = parser.getToken();
|
|
9196
9400
|
if (context & 1) {
|
|
9197
9401
|
if ((token & 537079808) === 537079808) {
|
|
9198
|
-
parser.report(
|
|
9402
|
+
parser.report(121);
|
|
9199
9403
|
}
|
|
9200
9404
|
else if ((token & 36864) === 36864 || token === -2147483526) {
|
|
9201
|
-
parser.report(
|
|
9405
|
+
parser.report(120);
|
|
9202
9406
|
}
|
|
9203
9407
|
}
|
|
9204
9408
|
if ((token & 20480) === 20480) {
|
|
@@ -9208,7 +9412,7 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
|
9208
9412
|
if (context & 1024)
|
|
9209
9413
|
parser.report(32);
|
|
9210
9414
|
if (context & 2)
|
|
9211
|
-
parser.report(
|
|
9415
|
+
parser.report(113);
|
|
9212
9416
|
}
|
|
9213
9417
|
if ((token & 255) === (241737 & 255)) {
|
|
9214
9418
|
if (kind & (8 | 16))
|
|
@@ -9216,9 +9420,9 @@ function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
|
9216
9420
|
}
|
|
9217
9421
|
if (token === 209006) {
|
|
9218
9422
|
if (context & 2048)
|
|
9219
|
-
parser.report(
|
|
9423
|
+
parser.report(178);
|
|
9220
9424
|
if (context & 2)
|
|
9221
|
-
parser.report(
|
|
9425
|
+
parser.report(112);
|
|
9222
9426
|
}
|
|
9223
9427
|
const { tokenValue, tokenStart: start } = parser;
|
|
9224
9428
|
nextToken(parser, context);
|
|
@@ -9250,7 +9454,7 @@ function parseJSXRootElementOrFragment(parser, context, privateScope, inJSXChild
|
|
|
9250
9454
|
[children, closingElement] = parseJSXChildrenAndClosingElement(parser, context, privateScope, inJSXChild);
|
|
9251
9455
|
const close = isEqualTagName(closingElement.name);
|
|
9252
9456
|
if (isEqualTagName(openingElement.name) !== close)
|
|
9253
|
-
parser.report(
|
|
9457
|
+
parser.report(157, close);
|
|
9254
9458
|
}
|
|
9255
9459
|
return parser.finishNode({
|
|
9256
9460
|
type: 'JSXElement',
|
|
@@ -9319,7 +9523,7 @@ function parseJSXChildrenAndClosingFragment(parser, context, privateScope, inJSX
|
|
|
9319
9523
|
}
|
|
9320
9524
|
function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild) {
|
|
9321
9525
|
if (parser.getToken() === 138)
|
|
9322
|
-
return parseJSXText(parser
|
|
9526
|
+
return parseJSXText(parser);
|
|
9323
9527
|
if (parser.getToken() === 2162700)
|
|
9324
9528
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
9325
9529
|
if (parser.getToken() === 8456256) {
|
|
@@ -9333,7 +9537,7 @@ function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild
|
|
|
9333
9537
|
}
|
|
9334
9538
|
function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChild) {
|
|
9335
9539
|
if (parser.getToken() === 138)
|
|
9336
|
-
return parseJSXText(parser
|
|
9540
|
+
return parseJSXText(parser);
|
|
9337
9541
|
if (parser.getToken() === 2162700)
|
|
9338
9542
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
9339
9543
|
if (parser.getToken() === 8456256) {
|
|
@@ -9345,9 +9549,9 @@ function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChil
|
|
|
9345
9549
|
}
|
|
9346
9550
|
parser.report(0);
|
|
9347
9551
|
}
|
|
9348
|
-
function parseJSXText(parser
|
|
9552
|
+
function parseJSXText(parser) {
|
|
9349
9553
|
const start = parser.tokenStart;
|
|
9350
|
-
|
|
9554
|
+
nextJSXToken(parser);
|
|
9351
9555
|
const node = {
|
|
9352
9556
|
type: 'JSXText',
|
|
9353
9557
|
value: parser.tokenValue,
|
|
@@ -9445,7 +9649,7 @@ function parseJsxAttribute(parser, context, privateScope) {
|
|
|
9445
9649
|
value = parseJSXExpressionContainer(parser, context, privateScope, 0, 1);
|
|
9446
9650
|
break;
|
|
9447
9651
|
default:
|
|
9448
|
-
parser.report(
|
|
9652
|
+
parser.report(156);
|
|
9449
9653
|
}
|
|
9450
9654
|
}
|
|
9451
9655
|
return parser.finishNode({
|
|
@@ -9472,7 +9676,7 @@ function parseJSXExpressionContainer(parser, context, privateScope, inJSXChild,
|
|
|
9472
9676
|
let expression;
|
|
9473
9677
|
if (parser.getToken() === 1074790415) {
|
|
9474
9678
|
if (isAttr)
|
|
9475
|
-
parser.report(
|
|
9679
|
+
parser.report(159);
|
|
9476
9680
|
expression = parseJSXEmptyExpression(parser, {
|
|
9477
9681
|
index: parser.startIndex,
|
|
9478
9682
|
line: parser.startLine,
|