meriyah 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +1 -3
- package/dist/meriyah.cjs +460 -309
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +460 -309
- package/dist/meriyah.umd.js +460 -309
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/errors.d.ts +72 -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 +4 -3
- 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.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.meriyah = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version$1 = "7.
|
|
7
|
+
var version$1 = "7.3.0";
|
|
8
8
|
var packageJson = {
|
|
9
9
|
version: version$1};
|
|
10
10
|
|
|
@@ -627,7 +627,7 @@
|
|
|
627
627
|
[9]: 'Octal literals are not allowed in strict mode',
|
|
628
628
|
[8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
|
|
629
629
|
[10]: 'Expected number in radix %0',
|
|
630
|
-
[
|
|
630
|
+
[153]: 'Invalid left-hand side assignment to a destructible right-hand side',
|
|
631
631
|
[11]: 'Non-number found after exponent indicator',
|
|
632
632
|
[12]: 'Invalid BigIntLiteral',
|
|
633
633
|
[13]: 'No identifiers allowed directly after numeric literal',
|
|
@@ -651,7 +651,7 @@
|
|
|
651
651
|
[32]: 'Yield expression not allowed in formal parameter',
|
|
652
652
|
[95]: "Unexpected token: 'escaped keyword'",
|
|
653
653
|
[33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
|
|
654
|
-
[
|
|
654
|
+
[125]: 'Async functions can only be declared at the top level or inside a block',
|
|
655
655
|
[34]: 'Unterminated regular expression',
|
|
656
656
|
[35]: 'Unexpected regular expression flag',
|
|
657
657
|
[36]: "Duplicate regular expression flag '%0'",
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
[42]: 'A getter cannot be a generator',
|
|
664
664
|
[43]: 'A setter cannot be a generator',
|
|
665
665
|
[44]: 'A computed property name must be followed by a colon or paren',
|
|
666
|
-
[
|
|
666
|
+
[136]: 'Object literal keys that are strings or numbers must be a method or have a colon',
|
|
667
667
|
[46]: 'Found `* async x(){}` but this should be `async * x(){}`',
|
|
668
668
|
[45]: 'Getters and setters can not be generators',
|
|
669
669
|
[47]: "'%0' can not be generator method",
|
|
@@ -725,73 +725,75 @@
|
|
|
725
725
|
[105]: '%0 source must be string',
|
|
726
726
|
[106]: 'Only a identifier or string can be used to indicate alias',
|
|
727
727
|
[107]: "Only '*' or '{...}' can be imported after default",
|
|
728
|
-
[108]: '
|
|
729
|
-
[109]: "
|
|
730
|
-
[110]: '
|
|
731
|
-
[111]: '
|
|
732
|
-
[112]: '
|
|
733
|
-
[113]:
|
|
734
|
-
[114]: '
|
|
735
|
-
[115]: "The
|
|
736
|
-
[116]: '
|
|
737
|
-
[117]:
|
|
738
|
-
[118]: '
|
|
739
|
-
[119]: '
|
|
740
|
-
[120]: '
|
|
741
|
-
[121]: '
|
|
742
|
-
[122]: '
|
|
743
|
-
[
|
|
744
|
-
[
|
|
745
|
-
[126]: '
|
|
746
|
-
[127]: '
|
|
747
|
-
[
|
|
748
|
-
[
|
|
749
|
-
[
|
|
750
|
-
[
|
|
751
|
-
[132]: '
|
|
752
|
-
[133]: '
|
|
753
|
-
[
|
|
754
|
-
[
|
|
755
|
-
[137]: '
|
|
756
|
-
[138]: "
|
|
757
|
-
[139]: '
|
|
758
|
-
[140]:
|
|
759
|
-
[141]: 'import()
|
|
760
|
-
[142]: '
|
|
761
|
-
[143]: '
|
|
762
|
-
[144]:
|
|
763
|
-
[145]:
|
|
764
|
-
[146]:
|
|
765
|
-
[147]: "
|
|
766
|
-
[
|
|
767
|
-
[
|
|
768
|
-
[
|
|
769
|
-
[
|
|
770
|
-
[
|
|
771
|
-
[
|
|
772
|
-
[
|
|
773
|
-
[156]: '
|
|
774
|
-
[157]:
|
|
775
|
-
[158]:
|
|
776
|
-
[159]: "
|
|
777
|
-
[160]: '
|
|
778
|
-
[161]: '
|
|
779
|
-
[162]: '
|
|
780
|
-
[163]: '
|
|
781
|
-
[164]: '
|
|
782
|
-
[165]: '
|
|
783
|
-
[166]: '
|
|
784
|
-
[167]: '
|
|
785
|
-
[168]: 'Invalid
|
|
786
|
-
[169]: '
|
|
787
|
-
[170]: '
|
|
788
|
-
[171]: '
|
|
789
|
-
[172]: '
|
|
790
|
-
[173]:
|
|
791
|
-
[174]:
|
|
792
|
-
[175]: "'
|
|
793
|
-
[176]:
|
|
794
|
-
[177]: '
|
|
728
|
+
[108]: "'import defer' must be followed by a namespace import",
|
|
729
|
+
[109]: "'import source' must be followed by a default import",
|
|
730
|
+
[110]: 'Trailing decorator may be followed by method',
|
|
731
|
+
[111]: "Decorators can't be used with a constructor",
|
|
732
|
+
[112]: 'Can not use `await` as identifier in module or async func',
|
|
733
|
+
[113]: 'Can not use `await` as identifier in module',
|
|
734
|
+
[114]: 'HTML comments are only allowed with web compatibility (Annex B)',
|
|
735
|
+
[115]: "The identifier 'let' must not be in expression position in strict mode",
|
|
736
|
+
[116]: 'Cannot assign to `eval` and `arguments` in strict mode',
|
|
737
|
+
[117]: "The left-hand side of a for-of loop may not start with 'let'",
|
|
738
|
+
[118]: 'Block body arrows can not be immediately invoked without a group',
|
|
739
|
+
[119]: 'Block body arrows can not be immediately accessed without a group',
|
|
740
|
+
[120]: 'Unexpected strict mode reserved word',
|
|
741
|
+
[121]: 'Unexpected eval or arguments in strict mode',
|
|
742
|
+
[122]: 'Decorators must not be followed by a semicolon',
|
|
743
|
+
[123]: 'Calling delete on expression not allowed in strict mode',
|
|
744
|
+
[124]: 'Pattern can not have a tail',
|
|
745
|
+
[126]: 'Can not have a `yield` expression on the left side of a ternary',
|
|
746
|
+
[127]: 'An arrow function can not have a postfix update operator',
|
|
747
|
+
[128]: 'Invalid object literal key character after generator star',
|
|
748
|
+
[129]: 'Private fields can not be deleted',
|
|
749
|
+
[131]: 'Classes may not have a field called constructor',
|
|
750
|
+
[130]: 'Classes may not have a private element named constructor',
|
|
751
|
+
[132]: 'A class field initializer or static block may not contain arguments',
|
|
752
|
+
[133]: 'Generators can only be declared at the top level or inside a block',
|
|
753
|
+
[134]: 'Async methods are a restricted production and cannot have a newline following it',
|
|
754
|
+
[135]: 'Unexpected character after object literal property name',
|
|
755
|
+
[137]: 'Invalid key token',
|
|
756
|
+
[138]: "Label '%0' has already been declared",
|
|
757
|
+
[139]: 'continue statement must be nested within an iteration statement',
|
|
758
|
+
[140]: "Undefined label '%0'",
|
|
759
|
+
[141]: 'Trailing comma is disallowed inside import(...) arguments',
|
|
760
|
+
[142]: 'Invalid binding in JSON import',
|
|
761
|
+
[143]: 'import() requires exactly one argument',
|
|
762
|
+
[144]: 'Cannot use new with import(...)',
|
|
763
|
+
[145]: '... is not allowed in import()',
|
|
764
|
+
[146]: "Expected '=>'",
|
|
765
|
+
[147]: "Duplicate binding '%0'",
|
|
766
|
+
[148]: 'Duplicate private identifier #%0',
|
|
767
|
+
[149]: "Cannot export a duplicate name '%0'",
|
|
768
|
+
[152]: 'Duplicate %0 for-binding',
|
|
769
|
+
[150]: "Exported binding '%0' needs to refer to a top-level declared variable",
|
|
770
|
+
[151]: 'Unexpected private field',
|
|
771
|
+
[155]: 'Numeric separators are not allowed at the end of numeric literals',
|
|
772
|
+
[154]: 'Only one underscore is allowed as numeric separator',
|
|
773
|
+
[156]: 'JSX value should be either an expression or a quoted JSX text',
|
|
774
|
+
[157]: 'Expected corresponding JSX closing tag for %0',
|
|
775
|
+
[158]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
|
|
776
|
+
[159]: "JSX attributes must only be assigned a non-empty 'expression'",
|
|
777
|
+
[160]: "'%0' has already been declared",
|
|
778
|
+
[161]: "'%0' shadowed a catch clause binding",
|
|
779
|
+
[162]: 'Dot property must be an identifier',
|
|
780
|
+
[163]: 'Encountered invalid input after spread/rest argument',
|
|
781
|
+
[164]: 'Catch without try',
|
|
782
|
+
[165]: 'Finally without try',
|
|
783
|
+
[166]: 'Expected corresponding closing tag for JSX fragment',
|
|
784
|
+
[167]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
|
|
785
|
+
[168]: 'Invalid tagged template on optional chain',
|
|
786
|
+
[169]: 'Invalid optional chain from super property',
|
|
787
|
+
[170]: 'Invalid optional chain from new expression',
|
|
788
|
+
[171]: 'Cannot use "import.meta" outside a module',
|
|
789
|
+
[172]: 'Leading decorators must be attached to a class declaration',
|
|
790
|
+
[173]: 'An export name cannot include a lone surrogate',
|
|
791
|
+
[174]: 'A string literal cannot be used as an exported binding without `from`',
|
|
792
|
+
[175]: "Private fields can't be accessed on super",
|
|
793
|
+
[176]: "The only valid meta property for import is 'import.meta'",
|
|
794
|
+
[177]: "'import.meta' must not contain escaped characters",
|
|
795
|
+
[178]: 'cannot use "await" as identifier inside an async function',
|
|
796
|
+
[179]: 'cannot use "await" in static blocks',
|
|
795
797
|
};
|
|
796
798
|
class ParseError extends SyntaxError {
|
|
797
799
|
start;
|
|
@@ -815,10 +817,6 @@
|
|
|
815
817
|
}
|
|
816
818
|
const isParseError = (error) => error instanceof ParseError;
|
|
817
819
|
|
|
818
|
-
function getOwnProperty(object, key) {
|
|
819
|
-
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
820
|
const KeywordDescTable = [
|
|
823
821
|
'end of source',
|
|
824
822
|
'identifier', 'number', 'string', 'regular expression',
|
|
@@ -840,75 +838,82 @@
|
|
|
840
838
|
'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
|
|
841
839
|
'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
|
|
842
840
|
];
|
|
843
|
-
const descKeywordTable =
|
|
844
|
-
this
|
|
845
|
-
function
|
|
846
|
-
if
|
|
847
|
-
return
|
|
848
|
-
var
|
|
849
|
-
else
|
|
850
|
-
for
|
|
851
|
-
new
|
|
852
|
-
in
|
|
853
|
-
typeof
|
|
854
|
-
while
|
|
855
|
-
case
|
|
856
|
-
break
|
|
857
|
-
try
|
|
858
|
-
catch
|
|
859
|
-
delete
|
|
860
|
-
throw
|
|
861
|
-
switch
|
|
862
|
-
continue
|
|
863
|
-
default
|
|
864
|
-
instanceof
|
|
865
|
-
do
|
|
866
|
-
void
|
|
867
|
-
finally
|
|
868
|
-
async
|
|
869
|
-
await
|
|
870
|
-
class
|
|
871
|
-
const
|
|
872
|
-
constructor
|
|
873
|
-
debugger
|
|
874
|
-
export
|
|
875
|
-
extends
|
|
876
|
-
false
|
|
877
|
-
from
|
|
878
|
-
get
|
|
879
|
-
implements
|
|
880
|
-
import
|
|
881
|
-
interface
|
|
882
|
-
let
|
|
883
|
-
null
|
|
884
|
-
of
|
|
885
|
-
using
|
|
886
|
-
package
|
|
887
|
-
private
|
|
888
|
-
protected
|
|
889
|
-
public
|
|
890
|
-
set
|
|
891
|
-
static
|
|
892
|
-
super
|
|
893
|
-
true
|
|
894
|
-
with
|
|
895
|
-
yield
|
|
896
|
-
enum
|
|
897
|
-
eval
|
|
898
|
-
as
|
|
899
|
-
arguments
|
|
900
|
-
target
|
|
901
|
-
meta
|
|
902
|
-
accessor
|
|
903
|
-
|
|
841
|
+
const descKeywordTable = new Map([
|
|
842
|
+
['this', 86111],
|
|
843
|
+
['function', 86104],
|
|
844
|
+
['if', 20569],
|
|
845
|
+
['return', 20572],
|
|
846
|
+
['var', 86088],
|
|
847
|
+
['else', 20563],
|
|
848
|
+
['for', 20567],
|
|
849
|
+
['new', 86107],
|
|
850
|
+
['in', 8673330],
|
|
851
|
+
['typeof', 16863275],
|
|
852
|
+
['while', 20578],
|
|
853
|
+
['case', 20556],
|
|
854
|
+
['break', 20555],
|
|
855
|
+
['try', 20577],
|
|
856
|
+
['catch', 20557],
|
|
857
|
+
['delete', 16863276],
|
|
858
|
+
['throw', 86112],
|
|
859
|
+
['switch', 86110],
|
|
860
|
+
['continue', 20559],
|
|
861
|
+
['default', 20561],
|
|
862
|
+
['instanceof', 8411187],
|
|
863
|
+
['do', 20562],
|
|
864
|
+
['void', 16863277],
|
|
865
|
+
['finally', 20566],
|
|
866
|
+
['async', 209005],
|
|
867
|
+
['await', 209006],
|
|
868
|
+
['class', 86094],
|
|
869
|
+
['const', 86090],
|
|
870
|
+
['constructor', 12399],
|
|
871
|
+
['debugger', 20560],
|
|
872
|
+
['export', 20564],
|
|
873
|
+
['extends', 20565],
|
|
874
|
+
['false', 86021],
|
|
875
|
+
['from', 209011],
|
|
876
|
+
['get', 209008],
|
|
877
|
+
['implements', 36964],
|
|
878
|
+
['import', 86106],
|
|
879
|
+
['interface', 36965],
|
|
880
|
+
['let', 241737],
|
|
881
|
+
['null', 86023],
|
|
882
|
+
['of', 471156],
|
|
883
|
+
['using', 209013],
|
|
884
|
+
['package', 36966],
|
|
885
|
+
['private', 36967],
|
|
886
|
+
['protected', 36968],
|
|
887
|
+
['public', 36969],
|
|
888
|
+
['set', 209009],
|
|
889
|
+
['static', 36970],
|
|
890
|
+
['super', 86109],
|
|
891
|
+
['true', 86022],
|
|
892
|
+
['with', 20579],
|
|
893
|
+
['yield', 241771],
|
|
894
|
+
['enum', 86134],
|
|
895
|
+
['eval', 537079927],
|
|
896
|
+
['as', 77932],
|
|
897
|
+
['arguments', 537079928],
|
|
898
|
+
['target', 209030],
|
|
899
|
+
['meta', 209031],
|
|
900
|
+
['accessor', 12402],
|
|
901
|
+
]);
|
|
902
|
+
const keywordLengths = [...descKeywordTable.keys()].map((keyword) => keyword.length);
|
|
903
|
+
const minKeywordLength = Math.min(...keywordLengths);
|
|
904
|
+
const maxKeywordLength = Math.max(...keywordLengths);
|
|
904
905
|
|
|
905
906
|
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
906
907
|
while (isIdPart[advanceChar(parser)])
|
|
907
908
|
;
|
|
908
909
|
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
910
|
+
if (parser.currentChar === 92 || parser.currentChar > 0x7e) {
|
|
911
|
+
return scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
|
|
912
|
+
}
|
|
913
|
+
const length = parser.index - parser.tokenIndex;
|
|
914
|
+
if (length < minKeywordLength || length > maxKeywordLength)
|
|
915
|
+
return 208897;
|
|
916
|
+
return descKeywordTable.get(parser.tokenValue) ?? 208897;
|
|
912
917
|
}
|
|
913
918
|
function scanUnicodeIdentifier(parser, context) {
|
|
914
919
|
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
@@ -950,8 +955,8 @@
|
|
|
950
955
|
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
951
956
|
}
|
|
952
957
|
const { length } = parser.tokenValue;
|
|
953
|
-
if (isValidAsKeyword && length >=
|
|
954
|
-
const token =
|
|
958
|
+
if (isValidAsKeyword && length >= minKeywordLength && length <= maxKeywordLength) {
|
|
959
|
+
const token = descKeywordTable.get(parser.tokenValue);
|
|
955
960
|
if (token === void 0)
|
|
956
961
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
957
962
|
if (!hasEscape)
|
|
@@ -1075,7 +1080,7 @@
|
|
|
1075
1080
|
while (CharTypes[char] & (64 | 4096)) {
|
|
1076
1081
|
if (char === 95) {
|
|
1077
1082
|
if (!allowSeparator)
|
|
1078
|
-
parser.report(
|
|
1083
|
+
parser.report(154);
|
|
1079
1084
|
allowSeparator = 0;
|
|
1080
1085
|
char = advanceChar(parser);
|
|
1081
1086
|
continue;
|
|
@@ -1086,7 +1091,7 @@
|
|
|
1086
1091
|
char = advanceChar(parser);
|
|
1087
1092
|
}
|
|
1088
1093
|
if (digits === 0 || !allowSeparator) {
|
|
1089
|
-
parser.report(digits === 0 ? 21 :
|
|
1094
|
+
parser.report(digits === 0 ? 21 : 155);
|
|
1090
1095
|
}
|
|
1091
1096
|
}
|
|
1092
1097
|
else if ((char | 32) === 111) {
|
|
@@ -1095,7 +1100,7 @@
|
|
|
1095
1100
|
while (CharTypes[char] & (32 | 4096)) {
|
|
1096
1101
|
if (char === 95) {
|
|
1097
1102
|
if (!allowSeparator) {
|
|
1098
|
-
parser.report(
|
|
1103
|
+
parser.report(154);
|
|
1099
1104
|
}
|
|
1100
1105
|
allowSeparator = 0;
|
|
1101
1106
|
char = advanceChar(parser);
|
|
@@ -1107,7 +1112,7 @@
|
|
|
1107
1112
|
char = advanceChar(parser);
|
|
1108
1113
|
}
|
|
1109
1114
|
if (digits === 0 || !allowSeparator) {
|
|
1110
|
-
parser.report(digits === 0 ? 0 :
|
|
1115
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1111
1116
|
}
|
|
1112
1117
|
}
|
|
1113
1118
|
else if ((char | 32) === 98) {
|
|
@@ -1116,7 +1121,7 @@
|
|
|
1116
1121
|
while (CharTypes[char] & (128 | 4096)) {
|
|
1117
1122
|
if (char === 95) {
|
|
1118
1123
|
if (!allowSeparator) {
|
|
1119
|
-
parser.report(
|
|
1124
|
+
parser.report(154);
|
|
1120
1125
|
}
|
|
1121
1126
|
allowSeparator = 0;
|
|
1122
1127
|
char = advanceChar(parser);
|
|
@@ -1128,7 +1133,7 @@
|
|
|
1128
1133
|
char = advanceChar(parser);
|
|
1129
1134
|
}
|
|
1130
1135
|
if (digits === 0 || !allowSeparator) {
|
|
1131
|
-
parser.report(digits === 0 ? 0 :
|
|
1136
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1132
1137
|
}
|
|
1133
1138
|
}
|
|
1134
1139
|
else if (CharTypes[char] & 32) {
|
|
@@ -1161,7 +1166,7 @@
|
|
|
1161
1166
|
if (char === 95) {
|
|
1162
1167
|
char = advanceChar(parser);
|
|
1163
1168
|
if (char === 95 || kind & 32) {
|
|
1164
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1169
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
|
|
1165
1170
|
}
|
|
1166
1171
|
allowSeparator = 1;
|
|
1167
1172
|
continue;
|
|
@@ -1172,7 +1177,7 @@
|
|
|
1172
1177
|
--digit;
|
|
1173
1178
|
}
|
|
1174
1179
|
if (allowSeparator) {
|
|
1175
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1180
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
|
|
1176
1181
|
}
|
|
1177
1182
|
if (digit >= 0 && !isIdentifierStart(char) && char !== 46) {
|
|
1178
1183
|
parser.tokenValue = value;
|
|
@@ -1237,7 +1242,7 @@
|
|
|
1237
1242
|
const { index } = parser;
|
|
1238
1243
|
char = advanceChar(parser);
|
|
1239
1244
|
if (char === 95) {
|
|
1240
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1245
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 154);
|
|
1241
1246
|
}
|
|
1242
1247
|
allowSeparator = 1;
|
|
1243
1248
|
ret += parser.source.substring(start, index);
|
|
@@ -1248,7 +1253,7 @@
|
|
|
1248
1253
|
char = advanceChar(parser);
|
|
1249
1254
|
}
|
|
1250
1255
|
if (allowSeparator) {
|
|
1251
|
-
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column },
|
|
1256
|
+
throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 155);
|
|
1252
1257
|
}
|
|
1253
1258
|
return ret + parser.source.substring(start, parser.index);
|
|
1254
1259
|
}
|
|
@@ -1969,7 +1974,7 @@
|
|
|
1969
1974
|
advanceChar(parser);
|
|
1970
1975
|
if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
|
|
1971
1976
|
if (!parser.options.webcompat)
|
|
1972
|
-
parser.report(
|
|
1977
|
+
parser.report(114);
|
|
1973
1978
|
advanceChar(parser);
|
|
1974
1979
|
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
1975
1980
|
continue;
|
|
@@ -2198,10 +2203,10 @@
|
|
|
2198
2203
|
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2199
2204
|
if (context & 1) {
|
|
2200
2205
|
if ((t & 36864) === 36864) {
|
|
2201
|
-
parser.report(
|
|
2206
|
+
parser.report(120);
|
|
2202
2207
|
}
|
|
2203
2208
|
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2204
|
-
parser.report(
|
|
2209
|
+
parser.report(121);
|
|
2205
2210
|
}
|
|
2206
2211
|
}
|
|
2207
2212
|
if ((t & 20480) === 20480 || t === -2147483527) {
|
|
@@ -2211,7 +2216,7 @@
|
|
|
2211
2216
|
parser.report(100);
|
|
2212
2217
|
}
|
|
2213
2218
|
if (context & (2048 | 2) && t === 209006) {
|
|
2214
|
-
parser.report(
|
|
2219
|
+
parser.report(112);
|
|
2215
2220
|
}
|
|
2216
2221
|
if (context & (1024 | 1) && t === 241771) {
|
|
2217
2222
|
parser.report(97, 'yield');
|
|
@@ -2220,10 +2225,10 @@
|
|
|
2220
2225
|
function validateFunctionName(parser, context, t) {
|
|
2221
2226
|
if (context & 1) {
|
|
2222
2227
|
if ((t & 36864) === 36864) {
|
|
2223
|
-
parser.report(
|
|
2228
|
+
parser.report(120);
|
|
2224
2229
|
}
|
|
2225
2230
|
if ((t & 537079808) === 537079808) {
|
|
2226
|
-
parser.report(
|
|
2231
|
+
parser.report(121);
|
|
2227
2232
|
}
|
|
2228
2233
|
if (t === -2147483526) {
|
|
2229
2234
|
parser.report(95);
|
|
@@ -2236,7 +2241,7 @@
|
|
|
2236
2241
|
parser.report(102);
|
|
2237
2242
|
}
|
|
2238
2243
|
if (context & (2048 | 2) && t === 209006) {
|
|
2239
|
-
parser.report(
|
|
2244
|
+
parser.report(112);
|
|
2240
2245
|
}
|
|
2241
2246
|
if (context & (1024 | 1) && t === 241771) {
|
|
2242
2247
|
parser.report(97, 'yield');
|
|
@@ -2245,7 +2250,7 @@
|
|
|
2245
2250
|
function isStrictReservedWord(parser, context, t) {
|
|
2246
2251
|
if (t === 209006) {
|
|
2247
2252
|
if (context & (2048 | 2))
|
|
2248
|
-
parser.report(
|
|
2253
|
+
parser.report(112);
|
|
2249
2254
|
parser.destructible |= 128;
|
|
2250
2255
|
}
|
|
2251
2256
|
if (t === 241771 && context & 1024)
|
|
@@ -2261,7 +2266,7 @@
|
|
|
2261
2266
|
while (labels) {
|
|
2262
2267
|
if (labels['$' + name]) {
|
|
2263
2268
|
if (isIterationStatement)
|
|
2264
|
-
parser.report(
|
|
2269
|
+
parser.report(139);
|
|
2265
2270
|
return 1;
|
|
2266
2271
|
}
|
|
2267
2272
|
if (isIterationStatement && labels.loop)
|
|
@@ -2274,7 +2279,7 @@
|
|
|
2274
2279
|
let set = labels;
|
|
2275
2280
|
while (set) {
|
|
2276
2281
|
if (set['$' + name])
|
|
2277
|
-
parser.report(
|
|
2282
|
+
parser.report(138, name);
|
|
2278
2283
|
set = set['$'];
|
|
2279
2284
|
}
|
|
2280
2285
|
labels['$' + name] = 1;
|
|
@@ -2302,14 +2307,14 @@
|
|
|
2302
2307
|
function classifyIdentifier(parser, context, t) {
|
|
2303
2308
|
if ((t & 537079808) === 537079808) {
|
|
2304
2309
|
if (context & 1)
|
|
2305
|
-
parser.report(
|
|
2310
|
+
parser.report(121);
|
|
2306
2311
|
parser.flags |= 512;
|
|
2307
2312
|
}
|
|
2308
2313
|
if (!isValidIdentifier(context, t))
|
|
2309
2314
|
parser.report(0);
|
|
2310
2315
|
}
|
|
2311
2316
|
|
|
2312
|
-
const entities = {
|
|
2317
|
+
const entities = new Map(Object.entries({
|
|
2313
2318
|
AElig: '\u00C6',
|
|
2314
2319
|
AMP: '\u0026',
|
|
2315
2320
|
Aacute: '\u00C1',
|
|
@@ -4435,8 +4440,8 @@
|
|
|
4435
4440
|
zscr: '\uD835\uDCCF',
|
|
4436
4441
|
zwj: '\u200D',
|
|
4437
4442
|
zwnj: '\u200C',
|
|
4438
|
-
};
|
|
4439
|
-
const decodeMap = {
|
|
4443
|
+
}));
|
|
4444
|
+
const decodeMap = new Map(Object.entries({
|
|
4440
4445
|
'0': 65533,
|
|
4441
4446
|
'128': 8364,
|
|
4442
4447
|
'130': 8218,
|
|
@@ -4465,7 +4470,7 @@
|
|
|
4465
4470
|
'156': 339,
|
|
4466
4471
|
'158': 382,
|
|
4467
4472
|
'159': 376,
|
|
4468
|
-
};
|
|
4473
|
+
}).map(([key, value]) => [Number(key), value]));
|
|
4469
4474
|
function decodeHTMLStrict(text) {
|
|
4470
4475
|
return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
|
|
4471
4476
|
if (key.charAt(1) === '#') {
|
|
@@ -4473,14 +4478,14 @@
|
|
|
4473
4478
|
const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
|
|
4474
4479
|
return decodeCodePoint(codePoint);
|
|
4475
4480
|
}
|
|
4476
|
-
return
|
|
4481
|
+
return entities.get(key.slice(1, -1)) ?? key;
|
|
4477
4482
|
});
|
|
4478
4483
|
}
|
|
4479
4484
|
function decodeCodePoint(codePoint) {
|
|
4480
4485
|
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
4481
4486
|
return '\uFFFD';
|
|
4482
4487
|
}
|
|
4483
|
-
return String.fromCodePoint(
|
|
4488
|
+
return String.fromCodePoint(decodeMap.get(codePoint) ?? codePoint);
|
|
4484
4489
|
}
|
|
4485
4490
|
|
|
4486
4491
|
function scanJSXAttributeValue(parser, context) {
|
|
@@ -4565,6 +4570,8 @@
|
|
|
4565
4570
|
return parser.getToken();
|
|
4566
4571
|
}
|
|
4567
4572
|
|
|
4573
|
+
const nextFeatures = 1 | 2 | 4;
|
|
4574
|
+
|
|
4568
4575
|
function normalizeRanges(ranges) {
|
|
4569
4576
|
if (!ranges)
|
|
4570
4577
|
return undefined;
|
|
@@ -4577,17 +4584,27 @@
|
|
|
4577
4584
|
};
|
|
4578
4585
|
}
|
|
4579
4586
|
function normalizeOptions(rawOptions) {
|
|
4580
|
-
|
|
4587
|
+
let { features, next, ranges, module, sourceType, globalReturn, ...restOptions } = {
|
|
4581
4588
|
validateRegex: true,
|
|
4589
|
+
features: 0,
|
|
4582
4590
|
...rawOptions,
|
|
4583
|
-
ranges: normalizeRanges(rawOptions.ranges),
|
|
4584
4591
|
};
|
|
4585
|
-
if (
|
|
4586
|
-
|
|
4592
|
+
if (next) {
|
|
4593
|
+
features |= nextFeatures;
|
|
4594
|
+
}
|
|
4595
|
+
ranges = normalizeRanges(ranges);
|
|
4596
|
+
if (module && !sourceType) {
|
|
4597
|
+
sourceType = 'module';
|
|
4587
4598
|
}
|
|
4588
|
-
if (
|
|
4589
|
-
|
|
4599
|
+
if (globalReturn && (!sourceType || sourceType === 'script')) {
|
|
4600
|
+
sourceType = 'commonjs';
|
|
4590
4601
|
}
|
|
4602
|
+
const options = {
|
|
4603
|
+
...restOptions,
|
|
4604
|
+
ranges,
|
|
4605
|
+
features,
|
|
4606
|
+
sourceType,
|
|
4607
|
+
};
|
|
4591
4608
|
return options;
|
|
4592
4609
|
}
|
|
4593
4610
|
|
|
@@ -4608,7 +4625,7 @@
|
|
|
4608
4625
|
const value = privateIdentifiers.get(name);
|
|
4609
4626
|
if (this.hasPrivateIdentifier(name) &&
|
|
4610
4627
|
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4611
|
-
this.parser.report(
|
|
4628
|
+
this.parser.report(148, name);
|
|
4612
4629
|
}
|
|
4613
4630
|
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4614
4631
|
}
|
|
@@ -4669,17 +4686,17 @@
|
|
|
4669
4686
|
((kind & 128 && value & 68) ||
|
|
4670
4687
|
(value & 128 && kind & 68))) ;
|
|
4671
4688
|
else {
|
|
4672
|
-
parser.report(
|
|
4689
|
+
parser.report(147, name);
|
|
4673
4690
|
}
|
|
4674
4691
|
}
|
|
4675
4692
|
if (currentScope === this) {
|
|
4676
4693
|
if (value && value & 1 && kind & 1) {
|
|
4677
|
-
currentScope.recordScopeError(
|
|
4694
|
+
currentScope.recordScopeError(147, name);
|
|
4678
4695
|
}
|
|
4679
4696
|
}
|
|
4680
4697
|
if (value &&
|
|
4681
4698
|
(value & 256 || (value & 512 && !parser.options.webcompat))) {
|
|
4682
|
-
parser.report(
|
|
4699
|
+
parser.report(147, name);
|
|
4683
4700
|
}
|
|
4684
4701
|
currentScope.variableBindings.set(name, kind);
|
|
4685
4702
|
currentScope = currentScope.parent;
|
|
@@ -4693,7 +4710,7 @@
|
|
|
4693
4710
|
const value = this.variableBindings.get(name);
|
|
4694
4711
|
if (value && (value & 2) === 0) {
|
|
4695
4712
|
if (kind & 1) {
|
|
4696
|
-
this.recordScopeError(
|
|
4713
|
+
this.recordScopeError(147, name);
|
|
4697
4714
|
}
|
|
4698
4715
|
else if (parser.options.webcompat &&
|
|
4699
4716
|
(context & 1) === 0 &&
|
|
@@ -4701,22 +4718,22 @@
|
|
|
4701
4718
|
value === 64 &&
|
|
4702
4719
|
kind === 64) ;
|
|
4703
4720
|
else {
|
|
4704
|
-
parser.report(
|
|
4721
|
+
parser.report(147, name);
|
|
4705
4722
|
}
|
|
4706
4723
|
}
|
|
4707
4724
|
if (this.type & 64 &&
|
|
4708
4725
|
this.parent?.hasVariable(name) &&
|
|
4709
4726
|
(this.parent.variableBindings.get(name) & 2) === 0) {
|
|
4710
|
-
parser.report(
|
|
4727
|
+
parser.report(147, name);
|
|
4711
4728
|
}
|
|
4712
4729
|
if (this.type & 512 && value && (value & 2) === 0) {
|
|
4713
4730
|
if (kind & 1) {
|
|
4714
|
-
this.recordScopeError(
|
|
4731
|
+
this.recordScopeError(147, name);
|
|
4715
4732
|
}
|
|
4716
4733
|
}
|
|
4717
4734
|
if (this.type & 32) {
|
|
4718
4735
|
if (this.parent.variableBindings.get(name) & 768)
|
|
4719
|
-
parser.report(
|
|
4736
|
+
parser.report(161, name);
|
|
4720
4737
|
}
|
|
4721
4738
|
this.variableBindings.set(name, kind);
|
|
4722
4739
|
}
|
|
@@ -4748,6 +4765,7 @@
|
|
|
4748
4765
|
options;
|
|
4749
4766
|
token = 1048576;
|
|
4750
4767
|
flags = 0;
|
|
4768
|
+
features = 0;
|
|
4751
4769
|
index = 0;
|
|
4752
4770
|
line = 1;
|
|
4753
4771
|
column = 0;
|
|
@@ -4773,6 +4791,7 @@
|
|
|
4773
4791
|
this.end = source.length;
|
|
4774
4792
|
this.currentChar = source.charCodeAt(0);
|
|
4775
4793
|
this.options = normalizeOptions(rawOptions);
|
|
4794
|
+
this.features = this.options.features;
|
|
4776
4795
|
if (Array.isArray(this.options.onComment)) {
|
|
4777
4796
|
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4778
4797
|
}
|
|
@@ -4853,7 +4872,7 @@
|
|
|
4853
4872
|
declareUnboundVariable(name) {
|
|
4854
4873
|
const { exportedNames } = this;
|
|
4855
4874
|
if (exportedNames.has(name)) {
|
|
4856
|
-
this.report(
|
|
4875
|
+
this.report(149, name);
|
|
4857
4876
|
}
|
|
4858
4877
|
exportedNames.add(name);
|
|
4859
4878
|
}
|
|
@@ -4876,29 +4895,10 @@
|
|
|
4876
4895
|
return undefined;
|
|
4877
4896
|
}
|
|
4878
4897
|
cloneIdentifier(original) {
|
|
4879
|
-
return
|
|
4898
|
+
return structuredClone(original);
|
|
4880
4899
|
}
|
|
4881
4900
|
cloneStringLiteral(original) {
|
|
4882
|
-
return
|
|
4883
|
-
}
|
|
4884
|
-
cloneLocationInformation(node, original) {
|
|
4885
|
-
const { ranges } = this.options;
|
|
4886
|
-
if (ranges) {
|
|
4887
|
-
if (ranges.start)
|
|
4888
|
-
node.start = original.start;
|
|
4889
|
-
if (ranges.end)
|
|
4890
|
-
node.end = original.end;
|
|
4891
|
-
if (ranges.range)
|
|
4892
|
-
node.range = [...original.range];
|
|
4893
|
-
}
|
|
4894
|
-
if (this.options.loc) {
|
|
4895
|
-
node.loc = {
|
|
4896
|
-
...original.loc,
|
|
4897
|
-
start: { ...original.loc.start },
|
|
4898
|
-
end: { ...original.loc.end },
|
|
4899
|
-
};
|
|
4900
|
-
}
|
|
4901
|
-
return node;
|
|
4901
|
+
return structuredClone(original);
|
|
4902
4902
|
}
|
|
4903
4903
|
}
|
|
4904
4904
|
function pushComment(comments, options) {
|
|
@@ -4961,7 +4961,7 @@
|
|
|
4961
4961
|
if (scope) {
|
|
4962
4962
|
for (const name of parser.exportedBindings) {
|
|
4963
4963
|
if (!scope.hasVariable(name))
|
|
4964
|
-
parser.report(
|
|
4964
|
+
parser.report(150, name);
|
|
4965
4965
|
}
|
|
4966
4966
|
}
|
|
4967
4967
|
}
|
|
@@ -5023,22 +5023,28 @@
|
|
|
5023
5023
|
moduleItem = parseExportDeclaration(parser, context, scope);
|
|
5024
5024
|
break;
|
|
5025
5025
|
case 86106:
|
|
5026
|
+
if (parser.leadingDecorators.decorators.length) {
|
|
5027
|
+
parser.report(172);
|
|
5028
|
+
}
|
|
5026
5029
|
moduleItem = parseImportDeclaration(parser, context, scope);
|
|
5027
5030
|
break;
|
|
5028
5031
|
default:
|
|
5029
5032
|
moduleItem = parseStatementListItem(parser, context, scope, undefined, 4, {});
|
|
5030
5033
|
}
|
|
5031
|
-
if (parser.leadingDecorators?.decorators.length) {
|
|
5032
|
-
parser.report(170);
|
|
5033
|
-
}
|
|
5034
5034
|
return moduleItem;
|
|
5035
5035
|
}
|
|
5036
5036
|
function parseStatementListItem(parser, context, scope, privateScope, origin, labels) {
|
|
5037
5037
|
const start = parser.tokenStart;
|
|
5038
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
5039
|
+
parser.report(172);
|
|
5040
|
+
}
|
|
5038
5041
|
switch (parser.getToken()) {
|
|
5039
5042
|
case 86104:
|
|
5040
5043
|
return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 0, start);
|
|
5041
5044
|
case 133:
|
|
5045
|
+
if (!(parser.features & 1)) {
|
|
5046
|
+
parser.report(30, '@');
|
|
5047
|
+
}
|
|
5042
5048
|
case 86094:
|
|
5043
5049
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5044
5050
|
case 86090:
|
|
@@ -5106,9 +5112,9 @@
|
|
|
5106
5112
|
case 209005:
|
|
5107
5113
|
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, origin, labels, 0);
|
|
5108
5114
|
case 20557:
|
|
5109
|
-
parser.report(
|
|
5115
|
+
parser.report(164);
|
|
5110
5116
|
case 20566:
|
|
5111
|
-
parser.report(
|
|
5117
|
+
parser.report(165);
|
|
5112
5118
|
case 86104:
|
|
5113
5119
|
parser.report(context & 1
|
|
5114
5120
|
? 76
|
|
@@ -5209,7 +5215,7 @@
|
|
|
5209
5215
|
if (!asyncNewLine) {
|
|
5210
5216
|
if (parser.getToken() === 86104) {
|
|
5211
5217
|
if (!allowFuncDecl)
|
|
5212
|
-
parser.report(
|
|
5218
|
+
parser.report(125);
|
|
5213
5219
|
return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 1, start);
|
|
5214
5220
|
}
|
|
5215
5221
|
if (isValidIdentifier(context, parser.getToken())) {
|
|
@@ -5384,7 +5390,7 @@
|
|
|
5384
5390
|
const { tokenValue } = parser;
|
|
5385
5391
|
label = parseIdentifier(parser, context | 32);
|
|
5386
5392
|
if (!isValidLabel(parser, labels, tokenValue, 1))
|
|
5387
|
-
parser.report(
|
|
5393
|
+
parser.report(140, tokenValue);
|
|
5388
5394
|
}
|
|
5389
5395
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5390
5396
|
return parser.finishNode({
|
|
@@ -5400,7 +5406,7 @@
|
|
|
5400
5406
|
const { tokenValue } = parser;
|
|
5401
5407
|
label = parseIdentifier(parser, context | 32);
|
|
5402
5408
|
if (!isValidLabel(parser, labels, tokenValue, 0))
|
|
5403
|
-
parser.report(
|
|
5409
|
+
parser.report(140, tokenValue);
|
|
5404
5410
|
}
|
|
5405
5411
|
else if ((context & (4 | 128)) === 0) {
|
|
5406
5412
|
parser.report(69);
|
|
@@ -5597,7 +5603,7 @@
|
|
|
5597
5603
|
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5598
5604
|
const start = parser.tokenStart;
|
|
5599
5605
|
if (context & 524288)
|
|
5600
|
-
parser.report(
|
|
5606
|
+
parser.report(179);
|
|
5601
5607
|
nextToken(parser, context | 32);
|
|
5602
5608
|
let argument;
|
|
5603
5609
|
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
@@ -5654,7 +5660,7 @@
|
|
|
5654
5660
|
if (resourceNames) {
|
|
5655
5661
|
const { name } = declaration.id;
|
|
5656
5662
|
if (resourceNames.has(name))
|
|
5657
|
-
parser.report(
|
|
5663
|
+
parser.report(147, name);
|
|
5658
5664
|
resourceNames.add(name);
|
|
5659
5665
|
}
|
|
5660
5666
|
list.push(declaration);
|
|
@@ -5733,7 +5739,7 @@
|
|
|
5733
5739
|
parser.assignable = 1;
|
|
5734
5740
|
init = parseMemberOrUpdateExpression(parser, context, privateScope, init, 0, 0, tokenStart);
|
|
5735
5741
|
if (parser.getToken() === 471156)
|
|
5736
|
-
parser.report(
|
|
5742
|
+
parser.report(117);
|
|
5737
5743
|
}
|
|
5738
5744
|
}
|
|
5739
5745
|
else if (token === 209013) {
|
|
@@ -5785,7 +5791,7 @@
|
|
|
5785
5791
|
if (resourceNames) {
|
|
5786
5792
|
const { name } = declaration.id;
|
|
5787
5793
|
if (resourceNames.has(name))
|
|
5788
|
-
parser.report(
|
|
5794
|
+
parser.report(147, name);
|
|
5789
5795
|
resourceNames.add(name);
|
|
5790
5796
|
}
|
|
5791
5797
|
declarations.push(declaration);
|
|
@@ -5830,7 +5836,7 @@
|
|
|
5830
5836
|
else if (token === 209006 &&
|
|
5831
5837
|
(context & 2048 || (context & 2 && context & 8))) {
|
|
5832
5838
|
if (context & 524288)
|
|
5833
|
-
parser.report(
|
|
5839
|
+
parser.report(179);
|
|
5834
5840
|
nextToken(parser, context | 32);
|
|
5835
5841
|
let awaitArgument;
|
|
5836
5842
|
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
@@ -5948,9 +5954,9 @@
|
|
|
5948
5954
|
}
|
|
5949
5955
|
function parseRestrictedIdentifier(parser, context, scope) {
|
|
5950
5956
|
if (!isValidIdentifier(context, parser.getToken()))
|
|
5951
|
-
parser.report(
|
|
5957
|
+
parser.report(120);
|
|
5952
5958
|
if ((parser.getToken() & 537079808) === 537079808)
|
|
5953
|
-
parser.report(
|
|
5959
|
+
parser.report(121);
|
|
5954
5960
|
scope?.addBlockName(context, parser.tokenValue, 8, 0);
|
|
5955
5961
|
return parseIdentifier(parser, context);
|
|
5956
5962
|
}
|
|
@@ -5958,6 +5964,8 @@
|
|
|
5958
5964
|
const start = parser.tokenStart;
|
|
5959
5965
|
nextToken(parser, context);
|
|
5960
5966
|
let source;
|
|
5967
|
+
let sourceParsed = false;
|
|
5968
|
+
let phase = null;
|
|
5961
5969
|
const { tokenStart } = parser;
|
|
5962
5970
|
let specifiers = [];
|
|
5963
5971
|
if (parser.getToken() === 134283267) {
|
|
@@ -5965,14 +5973,93 @@
|
|
|
5965
5973
|
}
|
|
5966
5974
|
else {
|
|
5967
5975
|
if (parser.getToken() & 143360) {
|
|
5968
|
-
const
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
+
const token = parser.getToken();
|
|
5977
|
+
const { tokenValue } = parser;
|
|
5978
|
+
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && tokenValue == 'defer';
|
|
5979
|
+
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && tokenValue == 'source';
|
|
5980
|
+
if (isPhaseDefer || isPhaseSource) {
|
|
5981
|
+
const phaseOrLocal = parseIdentifier(parser, context);
|
|
5982
|
+
if (tokenValue === 'defer') {
|
|
5983
|
+
if (parser.getToken() === 8391476) {
|
|
5984
|
+
phase = 'defer';
|
|
5985
|
+
specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
|
|
5986
|
+
}
|
|
5987
|
+
else if (parser.getToken() === 209011 || parser.getToken() === 18) {
|
|
5988
|
+
scope?.addBlockName(context, tokenValue, 8, 0);
|
|
5989
|
+
specifiers = [
|
|
5990
|
+
parser.finishNode({
|
|
5991
|
+
type: 'ImportDefaultSpecifier',
|
|
5992
|
+
local: phaseOrLocal,
|
|
5993
|
+
}, tokenStart),
|
|
5994
|
+
];
|
|
5995
|
+
}
|
|
5996
|
+
else {
|
|
5997
|
+
parser.report(108);
|
|
5998
|
+
}
|
|
5999
|
+
}
|
|
6000
|
+
else if (parser.getToken() === 209011) {
|
|
6001
|
+
const fromToken = parser.getToken();
|
|
6002
|
+
const fromStart = parser.tokenStart;
|
|
6003
|
+
const fromLocal = parseIdentifier(parser, context);
|
|
6004
|
+
if (parser.getToken() === 209011) {
|
|
6005
|
+
validateBindingIdentifier(parser, context, 16, fromToken, 0);
|
|
6006
|
+
scope?.addBlockName(context, fromLocal.name, 8, 0);
|
|
6007
|
+
phase = 'source';
|
|
6008
|
+
specifiers = [
|
|
6009
|
+
parser.finishNode({
|
|
6010
|
+
type: 'ImportDefaultSpecifier',
|
|
6011
|
+
local: fromLocal,
|
|
6012
|
+
}, fromStart),
|
|
6013
|
+
];
|
|
6014
|
+
}
|
|
6015
|
+
else {
|
|
6016
|
+
scope?.addBlockName(context, tokenValue, 8, 0);
|
|
6017
|
+
specifiers = [
|
|
6018
|
+
parser.finishNode({
|
|
6019
|
+
type: 'ImportDefaultSpecifier',
|
|
6020
|
+
local: phaseOrLocal,
|
|
6021
|
+
}, tokenStart),
|
|
6022
|
+
];
|
|
6023
|
+
if (parser.getToken() !== 134283267)
|
|
6024
|
+
parser.report(105, 'Import');
|
|
6025
|
+
source = parseLiteral(parser, context);
|
|
6026
|
+
sourceParsed = true;
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
6029
|
+
else if (parser.getToken() & 143360) {
|
|
6030
|
+
phase = 'source';
|
|
6031
|
+
const localStart = parser.tokenStart;
|
|
6032
|
+
const local = parseRestrictedIdentifier(parser, context, scope);
|
|
6033
|
+
specifiers = [
|
|
6034
|
+
parser.finishNode({
|
|
6035
|
+
type: 'ImportDefaultSpecifier',
|
|
6036
|
+
local,
|
|
6037
|
+
}, localStart),
|
|
6038
|
+
];
|
|
6039
|
+
}
|
|
6040
|
+
else if (parser.getToken() === 18) {
|
|
6041
|
+
scope?.addBlockName(context, tokenValue, 8, 0);
|
|
6042
|
+
specifiers = [
|
|
6043
|
+
parser.finishNode({
|
|
6044
|
+
type: 'ImportDefaultSpecifier',
|
|
6045
|
+
local: phaseOrLocal,
|
|
6046
|
+
}, tokenStart),
|
|
6047
|
+
];
|
|
6048
|
+
}
|
|
6049
|
+
else {
|
|
6050
|
+
parser.report(109);
|
|
6051
|
+
}
|
|
6052
|
+
}
|
|
6053
|
+
else {
|
|
6054
|
+
const local = parseRestrictedIdentifier(parser, context, scope);
|
|
6055
|
+
specifiers = [
|
|
6056
|
+
parser.finishNode({
|
|
6057
|
+
type: 'ImportDefaultSpecifier',
|
|
6058
|
+
local,
|
|
6059
|
+
}, tokenStart),
|
|
6060
|
+
];
|
|
6061
|
+
}
|
|
6062
|
+
if (phase === null && !sourceParsed && consumeOpt(parser, context, 18)) {
|
|
5976
6063
|
switch (parser.getToken()) {
|
|
5977
6064
|
case 8391476:
|
|
5978
6065
|
specifiers.push(parseImportNamespaceSpecifier(parser, context, scope));
|
|
@@ -6001,7 +6088,8 @@
|
|
|
6001
6088
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
6002
6089
|
}
|
|
6003
6090
|
}
|
|
6004
|
-
|
|
6091
|
+
if (!sourceParsed)
|
|
6092
|
+
source = parseModuleSpecifier(parser, context);
|
|
6005
6093
|
}
|
|
6006
6094
|
const attributes = parseImportAttributes(parser, context);
|
|
6007
6095
|
const node = {
|
|
@@ -6009,6 +6097,7 @@
|
|
|
6009
6097
|
specifiers,
|
|
6010
6098
|
source,
|
|
6011
6099
|
attributes,
|
|
6100
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6012
6101
|
};
|
|
6013
6102
|
matchOrInsertSemicolon(parser, context | 32);
|
|
6014
6103
|
return parser.finishNode(node, start);
|
|
@@ -6091,17 +6180,24 @@
|
|
|
6091
6180
|
function parseExportDeclaration(parser, context, scope) {
|
|
6092
6181
|
const start = parser.leadingDecorators.decorators.length ? parser.leadingDecorators.start : parser.tokenStart;
|
|
6093
6182
|
nextToken(parser, context | 32);
|
|
6183
|
+
const isDefaultExport = consumeOpt(parser, context | 32, 20561);
|
|
6184
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
6185
|
+
parser.report(172);
|
|
6186
|
+
}
|
|
6094
6187
|
const specifiers = [];
|
|
6095
6188
|
let declaration = null;
|
|
6096
6189
|
let source = null;
|
|
6097
6190
|
let attributes = [];
|
|
6098
|
-
if (
|
|
6191
|
+
if (isDefaultExport) {
|
|
6099
6192
|
switch (parser.getToken()) {
|
|
6100
6193
|
case 86104: {
|
|
6101
6194
|
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 4, 1, 1, 0, parser.tokenStart);
|
|
6102
6195
|
break;
|
|
6103
6196
|
}
|
|
6104
6197
|
case 133:
|
|
6198
|
+
if (!(parser.features & 1)) {
|
|
6199
|
+
parser.report(30, '@');
|
|
6200
|
+
}
|
|
6105
6201
|
case 86094:
|
|
6106
6202
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
|
|
6107
6203
|
break;
|
|
@@ -6214,7 +6310,7 @@
|
|
|
6214
6310
|
}
|
|
6215
6311
|
else {
|
|
6216
6312
|
if (hasLiteralLocal) {
|
|
6217
|
-
parser.report(
|
|
6313
|
+
parser.report(174);
|
|
6218
6314
|
}
|
|
6219
6315
|
if (scope) {
|
|
6220
6316
|
tmpExportedNames.forEach((n) => parser.declareUnboundVariable(n));
|
|
@@ -6225,6 +6321,9 @@
|
|
|
6225
6321
|
break;
|
|
6226
6322
|
}
|
|
6227
6323
|
case 133:
|
|
6324
|
+
if (!(parser.features & 1)) {
|
|
6325
|
+
parser.report(30, '@');
|
|
6326
|
+
}
|
|
6228
6327
|
case 86094:
|
|
6229
6328
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
6230
6329
|
break;
|
|
@@ -6357,7 +6456,7 @@
|
|
|
6357
6456
|
t = parser.getToken();
|
|
6358
6457
|
precedence = t & 3840;
|
|
6359
6458
|
if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) {
|
|
6360
|
-
parser.report(
|
|
6459
|
+
parser.report(167);
|
|
6361
6460
|
}
|
|
6362
6461
|
if (precedence + ((t === 8391735) << 8) - ((bit === t) << 12) <= minPrecedence)
|
|
6363
6462
|
break;
|
|
@@ -6384,10 +6483,10 @@
|
|
|
6384
6483
|
parser.report(33);
|
|
6385
6484
|
if (context & 1 && unaryOperator === 16863276) {
|
|
6386
6485
|
if (arg.type === 'Identifier') {
|
|
6387
|
-
parser.report(
|
|
6486
|
+
parser.report(123);
|
|
6388
6487
|
}
|
|
6389
6488
|
else if (isPropertyWithPrivateFieldKey(arg)) {
|
|
6390
|
-
parser.report(
|
|
6489
|
+
parser.report(129);
|
|
6391
6490
|
}
|
|
6392
6491
|
}
|
|
6393
6492
|
parser.assignable = 2;
|
|
@@ -6440,7 +6539,7 @@
|
|
|
6440
6539
|
if (!canAssign)
|
|
6441
6540
|
parser.report(26);
|
|
6442
6541
|
if (parser.getToken() === 22)
|
|
6443
|
-
parser.report(
|
|
6542
|
+
parser.report(126);
|
|
6444
6543
|
let argument = null;
|
|
6445
6544
|
let delegate = false;
|
|
6446
6545
|
if ((parser.flags & 1) === 0) {
|
|
@@ -6467,17 +6566,17 @@
|
|
|
6467
6566
|
if (inGroup)
|
|
6468
6567
|
parser.destructible |= 128;
|
|
6469
6568
|
if (context & 524288)
|
|
6470
|
-
parser.report(
|
|
6569
|
+
parser.report(179);
|
|
6471
6570
|
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope);
|
|
6472
6571
|
const isIdentifier = possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
|
|
6473
6572
|
(parser.getToken() & 65536) === 0;
|
|
6474
6573
|
if (isIdentifier) {
|
|
6475
6574
|
if (context & 2048)
|
|
6476
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6575
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 178);
|
|
6477
6576
|
if (context & 2)
|
|
6478
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6577
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
|
|
6479
6578
|
if (context & 8192 && context & 2048)
|
|
6480
|
-
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn },
|
|
6579
|
+
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 112);
|
|
6481
6580
|
return possibleIdentifierOrArrowFunc;
|
|
6482
6581
|
}
|
|
6483
6582
|
if (context & 8192) {
|
|
@@ -6501,6 +6600,7 @@
|
|
|
6501
6600
|
}
|
|
6502
6601
|
function parseFunctionBody(parser, context, scope, privateScope, origin, funcNameToken, functionScope) {
|
|
6503
6602
|
const { tokenStart } = parser;
|
|
6603
|
+
parser.flags &= -4161;
|
|
6504
6604
|
consume(parser, context | 32, 2162700);
|
|
6505
6605
|
const body = [];
|
|
6506
6606
|
if (parser.getToken() !== 1074790415) {
|
|
@@ -6526,19 +6626,19 @@
|
|
|
6526
6626
|
if (context & 1) {
|
|
6527
6627
|
if (funcNameToken) {
|
|
6528
6628
|
if ((funcNameToken & 537079808) === 537079808) {
|
|
6529
|
-
parser.report(
|
|
6629
|
+
parser.report(121);
|
|
6530
6630
|
}
|
|
6531
6631
|
if ((funcNameToken & 36864) === 36864) {
|
|
6532
6632
|
parser.report(40);
|
|
6533
6633
|
}
|
|
6534
6634
|
}
|
|
6535
6635
|
if (parser.flags & 512)
|
|
6536
|
-
parser.report(
|
|
6636
|
+
parser.report(121);
|
|
6537
6637
|
if (parser.flags & 256) {
|
|
6538
6638
|
if (parser.strictReservedRange) {
|
|
6539
|
-
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1],
|
|
6639
|
+
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 120);
|
|
6540
6640
|
}
|
|
6541
|
-
parser.report(
|
|
6641
|
+
parser.report(120);
|
|
6542
6642
|
}
|
|
6543
6643
|
}
|
|
6544
6644
|
}
|
|
@@ -6563,7 +6663,7 @@
|
|
|
6563
6663
|
nextToken(parser, context);
|
|
6564
6664
|
switch (parser.getToken()) {
|
|
6565
6665
|
case 67108991:
|
|
6566
|
-
parser.report(
|
|
6666
|
+
parser.report(169);
|
|
6567
6667
|
case 67174411: {
|
|
6568
6668
|
if ((context & 512) === 0)
|
|
6569
6669
|
parser.report(28);
|
|
@@ -6610,7 +6710,7 @@
|
|
|
6610
6710
|
case 67108877: {
|
|
6611
6711
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6612
6712
|
if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
|
|
6613
|
-
parser.report(
|
|
6713
|
+
parser.report(175);
|
|
6614
6714
|
}
|
|
6615
6715
|
parser.assignable =
|
|
6616
6716
|
(parser.flags & 2048) === 2048
|
|
@@ -6690,7 +6790,7 @@
|
|
|
6690
6790
|
}
|
|
6691
6791
|
default:
|
|
6692
6792
|
if ((parser.flags & 2048) === 2048) {
|
|
6693
|
-
parser.report(
|
|
6793
|
+
parser.report(168);
|
|
6694
6794
|
}
|
|
6695
6795
|
parser.assignable = 2;
|
|
6696
6796
|
expr = parser.finishNode({
|
|
@@ -6771,7 +6871,7 @@
|
|
|
6771
6871
|
parser.getToken() !== -2147483527 &&
|
|
6772
6872
|
parser.getToken() !== -2147483526 &&
|
|
6773
6873
|
parser.getToken() !== 131) {
|
|
6774
|
-
parser.report(
|
|
6874
|
+
parser.report(162);
|
|
6775
6875
|
}
|
|
6776
6876
|
return parser.getToken() === 131
|
|
6777
6877
|
? parsePrivateIdentifier(parser, context, privateScope, 0)
|
|
@@ -6822,10 +6922,10 @@
|
|
|
6822
6922
|
!(context & 32768) &&
|
|
6823
6923
|
!(context & 8192) &&
|
|
6824
6924
|
parser.tokenValue === 'arguments')
|
|
6825
|
-
parser.report(
|
|
6925
|
+
parser.report(132);
|
|
6826
6926
|
if ((token & 255) === (241737 & 255)) {
|
|
6827
6927
|
if (context & 1)
|
|
6828
|
-
parser.report(
|
|
6928
|
+
parser.report(115);
|
|
6829
6929
|
if (kind & (8 | 16))
|
|
6830
6930
|
parser.report(100);
|
|
6831
6931
|
}
|
|
@@ -6867,6 +6967,9 @@
|
|
|
6867
6967
|
case 65540:
|
|
6868
6968
|
return parseRegExpLiteral(parser, context);
|
|
6869
6969
|
case 133:
|
|
6970
|
+
if (!(parser.features & 1)) {
|
|
6971
|
+
parser.report(30, '@');
|
|
6972
|
+
}
|
|
6870
6973
|
case 86094:
|
|
6871
6974
|
return parseClassExpression(parser, context, privateScope, inGroup, start);
|
|
6872
6975
|
case 86109:
|
|
@@ -6895,24 +6998,37 @@
|
|
|
6895
6998
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6896
6999
|
let expr = parseIdentifier(parser, context);
|
|
6897
7000
|
if (parser.getToken() === 67108877) {
|
|
6898
|
-
return parseImportMetaExpression(parser, context, expr, start);
|
|
7001
|
+
return parseImportMetaExpression(parser, context, expr, start, privateScope, inGroup, inNew);
|
|
6899
7002
|
}
|
|
6900
7003
|
if (inNew)
|
|
6901
|
-
parser.report(
|
|
7004
|
+
parser.report(144);
|
|
6902
7005
|
expr = parseImportExpression(parser, context, privateScope, inGroup, start);
|
|
6903
7006
|
parser.assignable = 2;
|
|
6904
7007
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6905
7008
|
}
|
|
6906
|
-
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6907
|
-
|
|
6908
|
-
|
|
7009
|
+
function parseImportMetaExpression(parser, context, meta, start, privateScope, inGroup = 0, inNew = 0) {
|
|
7010
|
+
const propertyStart = parser.tokenStart;
|
|
7011
|
+
const propertyEnd = parser.currentLocation;
|
|
6909
7012
|
nextToken(parser, context);
|
|
6910
7013
|
const token = parser.getToken();
|
|
7014
|
+
const isPhaseDefer = parser.features & 2 && (token & -2147483648) === 0 && parser.tokenValue === 'defer';
|
|
7015
|
+
const isPhaseSource = parser.features & 4 && (token & -2147483648) === 0 && parser.tokenValue === 'source';
|
|
7016
|
+
if (isPhaseDefer || isPhaseSource) {
|
|
7017
|
+
if (inNew)
|
|
7018
|
+
parser.report(144);
|
|
7019
|
+
nextToken(parser, context);
|
|
7020
|
+
const expression = parseImportExpression(parser, context, privateScope, inGroup, start, parser.tokenValue);
|
|
7021
|
+
parser.assignable = 2;
|
|
7022
|
+
return expression;
|
|
7023
|
+
}
|
|
7024
|
+
if ((context & 2) === 0) {
|
|
7025
|
+
throw new ParseError(propertyStart, propertyEnd, 171);
|
|
7026
|
+
}
|
|
6911
7027
|
if (token !== 209031 && parser.tokenValue !== 'meta') {
|
|
6912
|
-
parser.report(
|
|
7028
|
+
parser.report(176);
|
|
6913
7029
|
}
|
|
6914
7030
|
else if (token & -2147483648) {
|
|
6915
|
-
parser.report(
|
|
7031
|
+
parser.report(177);
|
|
6916
7032
|
}
|
|
6917
7033
|
parser.assignable = 2;
|
|
6918
7034
|
return parser.finishNode({
|
|
@@ -6921,10 +7037,10 @@
|
|
|
6921
7037
|
property: parseIdentifier(parser, context),
|
|
6922
7038
|
}, start);
|
|
6923
7039
|
}
|
|
6924
|
-
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
7040
|
+
function parseImportExpression(parser, context, privateScope, inGroup, start, phase = null) {
|
|
6925
7041
|
consume(parser, context | 32, 67174411);
|
|
6926
7042
|
if (parser.getToken() === 14)
|
|
6927
|
-
parser.report(
|
|
7043
|
+
parser.report(145);
|
|
6928
7044
|
const source = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
|
|
6929
7045
|
let options = null;
|
|
6930
7046
|
if (parser.getToken() === 18) {
|
|
@@ -6939,6 +7055,7 @@
|
|
|
6939
7055
|
type: 'ImportExpression',
|
|
6940
7056
|
source,
|
|
6941
7057
|
options,
|
|
7058
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6942
7059
|
};
|
|
6943
7060
|
consume(parser, context, 16);
|
|
6944
7061
|
return parser.finishNode(node, start);
|
|
@@ -6956,7 +7073,7 @@
|
|
|
6956
7073
|
const value = parseStringLiteral(parser, context);
|
|
6957
7074
|
const keyContent = key.type === 'Literal' ? key.value : key.name;
|
|
6958
7075
|
if (keysContent.has(keyContent)) {
|
|
6959
|
-
parser.report(
|
|
7076
|
+
parser.report(147, keyContent);
|
|
6960
7077
|
}
|
|
6961
7078
|
keysContent.add(keyContent);
|
|
6962
7079
|
attributes.push(parser.finishNode({
|
|
@@ -6994,7 +7111,7 @@
|
|
|
6994
7111
|
if (parser.getToken() === 134283267) {
|
|
6995
7112
|
const value = parser.tokenValue;
|
|
6996
7113
|
if (!value.isWellFormed()) {
|
|
6997
|
-
parser.report(
|
|
7114
|
+
parser.report(173);
|
|
6998
7115
|
}
|
|
6999
7116
|
return parseLiteral(parser, context);
|
|
7000
7117
|
}
|
|
@@ -7555,7 +7672,7 @@
|
|
|
7555
7672
|
}
|
|
7556
7673
|
parser.destructible = destructible;
|
|
7557
7674
|
if (parser.getToken() !== closingToken && parser.getToken() !== 18)
|
|
7558
|
-
parser.report(
|
|
7675
|
+
parser.report(163);
|
|
7559
7676
|
return parser.finishNode({
|
|
7560
7677
|
type: isPattern ? 'RestElement' : 'SpreadElement',
|
|
7561
7678
|
argument: argument,
|
|
@@ -7814,7 +7931,7 @@
|
|
|
7814
7931
|
parser.report(95);
|
|
7815
7932
|
if (token === 209005) {
|
|
7816
7933
|
if (parser.flags & 1)
|
|
7817
|
-
parser.report(
|
|
7934
|
+
parser.report(134);
|
|
7818
7935
|
state |= 16 | 1;
|
|
7819
7936
|
}
|
|
7820
7937
|
else if (token === 209008) {
|
|
@@ -7878,7 +7995,7 @@
|
|
|
7878
7995
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7879
7996
|
}
|
|
7880
7997
|
else {
|
|
7881
|
-
parser.report(
|
|
7998
|
+
parser.report(135);
|
|
7882
7999
|
}
|
|
7883
8000
|
}
|
|
7884
8001
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -7982,7 +8099,7 @@
|
|
|
7982
8099
|
destructible = 16;
|
|
7983
8100
|
}
|
|
7984
8101
|
else {
|
|
7985
|
-
parser.report(
|
|
8102
|
+
parser.report(136);
|
|
7986
8103
|
}
|
|
7987
8104
|
}
|
|
7988
8105
|
else if (parser.getToken() === 69271571) {
|
|
@@ -8129,7 +8246,7 @@
|
|
|
8129
8246
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
8130
8247
|
}
|
|
8131
8248
|
else {
|
|
8132
|
-
parser.report(
|
|
8249
|
+
parser.report(128);
|
|
8133
8250
|
}
|
|
8134
8251
|
}
|
|
8135
8252
|
else {
|
|
@@ -8307,7 +8424,7 @@
|
|
|
8307
8424
|
parser.assignable = 2;
|
|
8308
8425
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8309
8426
|
if (destructible & 8)
|
|
8310
|
-
parser.report(
|
|
8427
|
+
parser.report(124);
|
|
8311
8428
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8312
8429
|
destructible |= 16;
|
|
8313
8430
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
@@ -8380,7 +8497,7 @@
|
|
|
8380
8497
|
}
|
|
8381
8498
|
consume(parser, context, 16);
|
|
8382
8499
|
if (destructible & 16 && destructible & 8)
|
|
8383
|
-
parser.report(
|
|
8500
|
+
parser.report(153);
|
|
8384
8501
|
destructible |=
|
|
8385
8502
|
parser.destructible & 256
|
|
8386
8503
|
? 256
|
|
@@ -8405,7 +8522,7 @@
|
|
|
8405
8522
|
parser.report(63);
|
|
8406
8523
|
}
|
|
8407
8524
|
if (destructible & 8) {
|
|
8408
|
-
parser.report(
|
|
8525
|
+
parser.report(146);
|
|
8409
8526
|
}
|
|
8410
8527
|
parser.destructible = ((parser.destructible | 256) ^ 256) | destructible;
|
|
8411
8528
|
return parser.options.preserveParens
|
|
@@ -8476,17 +8593,17 @@
|
|
|
8476
8593
|
switch (parser.getToken()) {
|
|
8477
8594
|
case 69271571:
|
|
8478
8595
|
if ((parser.flags & 1) === 0) {
|
|
8479
|
-
parser.report(
|
|
8596
|
+
parser.report(118);
|
|
8480
8597
|
}
|
|
8481
8598
|
parser.flags |= 8192;
|
|
8482
8599
|
break;
|
|
8483
8600
|
case 67108877:
|
|
8484
8601
|
case 67174409:
|
|
8485
8602
|
case 22:
|
|
8486
|
-
parser.report(
|
|
8603
|
+
parser.report(119);
|
|
8487
8604
|
case 67174411:
|
|
8488
8605
|
if ((parser.flags & 1) === 0) {
|
|
8489
|
-
parser.report(
|
|
8606
|
+
parser.report(118);
|
|
8490
8607
|
}
|
|
8491
8608
|
parser.flags |= 1024;
|
|
8492
8609
|
break;
|
|
@@ -8494,7 +8611,7 @@
|
|
|
8494
8611
|
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0)
|
|
8495
8612
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
8496
8613
|
if ((parser.getToken() & 33619968) === 33619968)
|
|
8497
|
-
parser.report(
|
|
8614
|
+
parser.report(127);
|
|
8498
8615
|
}
|
|
8499
8616
|
parser.assignable = 2;
|
|
8500
8617
|
return parser.finishNode({
|
|
@@ -8634,7 +8751,7 @@
|
|
|
8634
8751
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
8635
8752
|
context = (context | 131072) ^ 131072;
|
|
8636
8753
|
if (parser.getToken() === 67108991)
|
|
8637
|
-
parser.report(
|
|
8754
|
+
parser.report(170);
|
|
8638
8755
|
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
8639
8756
|
parser.assignable = 2;
|
|
8640
8757
|
return parser.finishNode({
|
|
@@ -8733,7 +8850,7 @@
|
|
|
8733
8850
|
isNonSimpleParameterList = 1;
|
|
8734
8851
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8735
8852
|
if (destructible & 8)
|
|
8736
|
-
parser.report(
|
|
8853
|
+
parser.report(124);
|
|
8737
8854
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8738
8855
|
destructible |= 16;
|
|
8739
8856
|
if ((parser.getToken() & 8388608) === 8388608) {
|
|
@@ -8834,9 +8951,6 @@
|
|
|
8834
8951
|
let start;
|
|
8835
8952
|
let decorators;
|
|
8836
8953
|
if (parser.leadingDecorators.decorators.length) {
|
|
8837
|
-
if (parser.getToken() === 133) {
|
|
8838
|
-
parser.report(30, '@');
|
|
8839
|
-
}
|
|
8840
8954
|
start = parser.leadingDecorators.start;
|
|
8841
8955
|
decorators = [...parser.leadingDecorators.decorators];
|
|
8842
8956
|
parser.leadingDecorators.decorators.length = 0;
|
|
@@ -8846,16 +8960,16 @@
|
|
|
8846
8960
|
decorators = parseDecorators(parser, context, privateScope);
|
|
8847
8961
|
}
|
|
8848
8962
|
context = (context | 16384 | 1) ^ 16384;
|
|
8849
|
-
|
|
8963
|
+
consume(parser, context, 86094);
|
|
8850
8964
|
let id = null;
|
|
8851
8965
|
let superClass = null;
|
|
8852
8966
|
const { tokenValue } = parser;
|
|
8853
8967
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8854
8968
|
if (isStrictReservedWord(parser, context, parser.getToken())) {
|
|
8855
|
-
parser.report(
|
|
8969
|
+
parser.report(120);
|
|
8856
8970
|
}
|
|
8857
8971
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8858
|
-
parser.report(
|
|
8972
|
+
parser.report(121);
|
|
8859
8973
|
}
|
|
8860
8974
|
if (scope) {
|
|
8861
8975
|
scope.addBlockName(context, tokenValue, 32, 0);
|
|
@@ -8885,7 +8999,7 @@
|
|
|
8885
8999
|
id,
|
|
8886
9000
|
superClass,
|
|
8887
9001
|
body,
|
|
8888
|
-
...(parser.
|
|
9002
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8889
9003
|
}, start);
|
|
8890
9004
|
}
|
|
8891
9005
|
function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
@@ -8893,12 +9007,12 @@
|
|
|
8893
9007
|
let superClass = null;
|
|
8894
9008
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8895
9009
|
context = (context | 1 | 16384) ^ 16384;
|
|
8896
|
-
|
|
9010
|
+
consume(parser, context, 86094);
|
|
8897
9011
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8898
9012
|
if (isStrictReservedWord(parser, context, parser.getToken()))
|
|
8899
|
-
parser.report(
|
|
9013
|
+
parser.report(120);
|
|
8900
9014
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8901
|
-
parser.report(
|
|
9015
|
+
parser.report(121);
|
|
8902
9016
|
}
|
|
8903
9017
|
id = parseIdentifier(parser, context);
|
|
8904
9018
|
}
|
|
@@ -8917,24 +9031,61 @@
|
|
|
8917
9031
|
id,
|
|
8918
9032
|
superClass,
|
|
8919
9033
|
body,
|
|
8920
|
-
...(parser.
|
|
9034
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8921
9035
|
}, start);
|
|
8922
9036
|
}
|
|
8923
9037
|
function parseDecorators(parser, context, privateScope) {
|
|
8924
9038
|
const list = [];
|
|
8925
|
-
if (parser.
|
|
9039
|
+
if (parser.features & 1) {
|
|
8926
9040
|
while (parser.getToken() === 133) {
|
|
8927
|
-
list.push(
|
|
9041
|
+
list.push(parseDecorator(parser, context, privateScope));
|
|
8928
9042
|
}
|
|
8929
9043
|
}
|
|
8930
9044
|
return list;
|
|
8931
9045
|
}
|
|
8932
|
-
function
|
|
9046
|
+
function parseDecorator(parser, context, privateScope) {
|
|
8933
9047
|
const start = parser.tokenStart;
|
|
8934
9048
|
nextToken(parser, context | 32);
|
|
8935
9049
|
const expressionStart = parser.tokenStart;
|
|
8936
|
-
let expression
|
|
8937
|
-
|
|
9050
|
+
let expression;
|
|
9051
|
+
if (parser.getToken() === 67174411) {
|
|
9052
|
+
expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
|
|
9053
|
+
}
|
|
9054
|
+
else {
|
|
9055
|
+
const token = parser.getToken();
|
|
9056
|
+
if (((token & 143360) !== 143360 && !isValidIdentifier(context, token)) ||
|
|
9057
|
+
(context & 1 && (token & 36864) === 36864)) {
|
|
9058
|
+
parser.report(30, KeywordDescTable[token & 255]);
|
|
9059
|
+
}
|
|
9060
|
+
if (token === 209006 && context & (2048 | 2)) {
|
|
9061
|
+
parser.report(112);
|
|
9062
|
+
}
|
|
9063
|
+
if (token === 241771 && context & 1024) {
|
|
9064
|
+
parser.report(97, 'yield');
|
|
9065
|
+
}
|
|
9066
|
+
let memberExpression = parseIdentifier(parser, context | 64);
|
|
9067
|
+
while (parser.getToken() === 67108877) {
|
|
9068
|
+
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
9069
|
+
const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
|
|
9070
|
+
memberExpression = parser.finishNode({
|
|
9071
|
+
type: 'MemberExpression',
|
|
9072
|
+
object: memberExpression,
|
|
9073
|
+
computed: false,
|
|
9074
|
+
property,
|
|
9075
|
+
optional: false,
|
|
9076
|
+
}, expressionStart);
|
|
9077
|
+
}
|
|
9078
|
+
expression = memberExpression;
|
|
9079
|
+
if (parser.getToken() === 67174411) {
|
|
9080
|
+
const args = parseArguments(parser, context, privateScope, 0);
|
|
9081
|
+
expression = parser.finishNode({
|
|
9082
|
+
type: 'CallExpression',
|
|
9083
|
+
callee: memberExpression,
|
|
9084
|
+
arguments: args,
|
|
9085
|
+
optional: false,
|
|
9086
|
+
}, expressionStart);
|
|
9087
|
+
}
|
|
9088
|
+
}
|
|
8938
9089
|
return parser.finishNode({
|
|
8939
9090
|
type: 'Decorator',
|
|
8940
9091
|
expression,
|
|
@@ -8953,13 +9104,13 @@
|
|
|
8953
9104
|
const decoratorStart = parser.tokenStart;
|
|
8954
9105
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8955
9106
|
if (decorators.length > 0 && parser.tokenValue === 'constructor') {
|
|
8956
|
-
parser.report(
|
|
9107
|
+
parser.report(111);
|
|
8957
9108
|
}
|
|
8958
9109
|
if (parser.getToken() === 1074790415)
|
|
8959
|
-
parser.report(
|
|
9110
|
+
parser.report(110);
|
|
8960
9111
|
if (consumeOpt(parser, context, 1074790417)) {
|
|
8961
9112
|
if (decorators.length > 0)
|
|
8962
|
-
parser.report(
|
|
9113
|
+
parser.report(122);
|
|
8963
9114
|
continue;
|
|
8964
9115
|
}
|
|
8965
9116
|
body.push(parseClassElementList(parser, context, scope, privateScope, inheritedContext, kind, decorators, 0, inGroup, decorators.length > 0 ? decoratorStart : parser.tokenStart));
|
|
@@ -9022,7 +9173,7 @@
|
|
|
9022
9173
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
9023
9174
|
return parsePropertyDefinition(parser, context, privateScope, key, kind, decorators, start);
|
|
9024
9175
|
}
|
|
9025
|
-
if (parser.
|
|
9176
|
+
if (parser.features & 1)
|
|
9026
9177
|
kind |= 1024;
|
|
9027
9178
|
}
|
|
9028
9179
|
break;
|
|
@@ -9075,12 +9226,12 @@
|
|
|
9075
9226
|
key = parsePrivateIdentifier(parser, context, privateScope, kind);
|
|
9076
9227
|
}
|
|
9077
9228
|
else
|
|
9078
|
-
parser.report(
|
|
9229
|
+
parser.report(137);
|
|
9079
9230
|
}
|
|
9080
9231
|
if ((kind & 2) === 0) {
|
|
9081
9232
|
if (parser.tokenValue === 'constructor') {
|
|
9082
9233
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
9083
|
-
parser.report(
|
|
9234
|
+
parser.report(131);
|
|
9084
9235
|
}
|
|
9085
9236
|
else if ((kind & 32) === 0 && parser.getToken() === 67174411) {
|
|
9086
9237
|
if (kind & (768 | 16 | 128 | 8)) {
|
|
@@ -9118,7 +9269,7 @@
|
|
|
9118
9269
|
computed: (kind & 2) > 0,
|
|
9119
9270
|
key,
|
|
9120
9271
|
value,
|
|
9121
|
-
...(parser.
|
|
9272
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
9122
9273
|
}, start);
|
|
9123
9274
|
}
|
|
9124
9275
|
function parsePrivateIdentifier(parser, context, privateScope, kind) {
|
|
@@ -9126,7 +9277,7 @@
|
|
|
9126
9277
|
nextToken(parser, context);
|
|
9127
9278
|
const { tokenValue } = parser;
|
|
9128
9279
|
if (tokenValue === 'constructor')
|
|
9129
|
-
parser.report(
|
|
9280
|
+
parser.report(130);
|
|
9130
9281
|
if (parser.options.lexical) {
|
|
9131
9282
|
if (!privateScope)
|
|
9132
9283
|
parser.report(4, tokenValue);
|
|
@@ -9151,7 +9302,7 @@
|
|
|
9151
9302
|
nextToken(parser, context | 32);
|
|
9152
9303
|
const { tokenStart } = parser;
|
|
9153
9304
|
if (parser.getToken() === 537079928)
|
|
9154
|
-
parser.report(
|
|
9305
|
+
parser.report(121);
|
|
9155
9306
|
const modifierFlags = 1024 |
|
|
9156
9307
|
2048 |
|
|
9157
9308
|
8192 |
|
|
@@ -9177,7 +9328,7 @@
|
|
|
9177
9328
|
value,
|
|
9178
9329
|
static: (state & 32) > 0,
|
|
9179
9330
|
computed: (state & 2) > 0,
|
|
9180
|
-
...(parser.
|
|
9331
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
9181
9332
|
}, start);
|
|
9182
9333
|
}
|
|
9183
9334
|
function parseBindingPattern(parser, context, scope, privateScope, type, origin) {
|
|
@@ -9199,10 +9350,10 @@
|
|
|
9199
9350
|
const token = parser.getToken();
|
|
9200
9351
|
if (context & 1) {
|
|
9201
9352
|
if ((token & 537079808) === 537079808) {
|
|
9202
|
-
parser.report(
|
|
9353
|
+
parser.report(121);
|
|
9203
9354
|
}
|
|
9204
9355
|
else if ((token & 36864) === 36864 || token === -2147483526) {
|
|
9205
|
-
parser.report(
|
|
9356
|
+
parser.report(120);
|
|
9206
9357
|
}
|
|
9207
9358
|
}
|
|
9208
9359
|
if ((token & 20480) === 20480) {
|
|
@@ -9212,7 +9363,7 @@
|
|
|
9212
9363
|
if (context & 1024)
|
|
9213
9364
|
parser.report(32);
|
|
9214
9365
|
if (context & 2)
|
|
9215
|
-
parser.report(
|
|
9366
|
+
parser.report(113);
|
|
9216
9367
|
}
|
|
9217
9368
|
if ((token & 255) === (241737 & 255)) {
|
|
9218
9369
|
if (kind & (8 | 16))
|
|
@@ -9220,9 +9371,9 @@
|
|
|
9220
9371
|
}
|
|
9221
9372
|
if (token === 209006) {
|
|
9222
9373
|
if (context & 2048)
|
|
9223
|
-
parser.report(
|
|
9374
|
+
parser.report(178);
|
|
9224
9375
|
if (context & 2)
|
|
9225
|
-
parser.report(
|
|
9376
|
+
parser.report(112);
|
|
9226
9377
|
}
|
|
9227
9378
|
const { tokenValue, tokenStart: start } = parser;
|
|
9228
9379
|
nextToken(parser, context);
|
|
@@ -9254,7 +9405,7 @@
|
|
|
9254
9405
|
[children, closingElement] = parseJSXChildrenAndClosingElement(parser, context, privateScope, inJSXChild);
|
|
9255
9406
|
const close = isEqualTagName(closingElement.name);
|
|
9256
9407
|
if (isEqualTagName(openingElement.name) !== close)
|
|
9257
|
-
parser.report(
|
|
9408
|
+
parser.report(157, close);
|
|
9258
9409
|
}
|
|
9259
9410
|
return parser.finishNode({
|
|
9260
9411
|
type: 'JSXElement',
|
|
@@ -9449,7 +9600,7 @@
|
|
|
9449
9600
|
value = parseJSXExpressionContainer(parser, context, privateScope, 0, 1);
|
|
9450
9601
|
break;
|
|
9451
9602
|
default:
|
|
9452
|
-
parser.report(
|
|
9603
|
+
parser.report(156);
|
|
9453
9604
|
}
|
|
9454
9605
|
}
|
|
9455
9606
|
return parser.finishNode({
|
|
@@ -9476,7 +9627,7 @@
|
|
|
9476
9627
|
let expression;
|
|
9477
9628
|
if (parser.getToken() === 1074790415) {
|
|
9478
9629
|
if (isAttr)
|
|
9479
|
-
parser.report(
|
|
9630
|
+
parser.report(159);
|
|
9480
9631
|
expression = parseJSXEmptyExpression(parser, {
|
|
9481
9632
|
index: parser.startIndex,
|
|
9482
9633
|
line: parser.startLine,
|