meriyah 7.1.2 → 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 +32 -0
- package/README.md +1 -7
- package/dist/meriyah.cjs +817 -431
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +817 -431
- package/dist/meriyah.umd.js +817 -431
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/errors.d.ts +72 -70
- package/dist/types/estree.d.ts +3 -1
- 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 +25 -24
- package/package.json +2 -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
|
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
return 'RegularExpression';
|
|
493
493
|
case 67174408:
|
|
494
494
|
case 67174409:
|
|
495
|
-
case
|
|
495
|
+
case 132:
|
|
496
496
|
return 'TemplateLiteral';
|
|
497
497
|
default:
|
|
498
498
|
if ((t & 143360) === 143360)
|
|
@@ -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;
|
|
@@ -800,7 +802,7 @@
|
|
|
800
802
|
loc;
|
|
801
803
|
description;
|
|
802
804
|
constructor(start, end, type, ...params) {
|
|
803
|
-
const description = errorMessages[type].
|
|
805
|
+
const description = errorMessages[type].replaceAll(/%(\d+)/g, (_, i) => params[i]);
|
|
804
806
|
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
805
807
|
super(message);
|
|
806
808
|
this.start = start.index;
|
|
@@ -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',
|
|
@@ -835,79 +833,87 @@
|
|
|
835
833
|
'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
|
|
836
834
|
'this', 'throw', 'try', 'while', 'with',
|
|
837
835
|
'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
|
|
838
|
-
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
|
|
836
|
+
'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of', 'using',
|
|
839
837
|
'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
|
|
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
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
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);
|
|
903
905
|
|
|
904
906
|
function scanIdentifier(parser, context, isValidAsKeyword) {
|
|
905
907
|
while (isIdPart[advanceChar(parser)])
|
|
906
908
|
;
|
|
907
909
|
parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
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;
|
|
911
917
|
}
|
|
912
918
|
function scanUnicodeIdentifier(parser, context) {
|
|
913
919
|
const cookedChar = scanIdentifierUnicodeEscape(parser);
|
|
@@ -949,8 +955,8 @@
|
|
|
949
955
|
parser.tokenValue += parser.source.slice(start, parser.index);
|
|
950
956
|
}
|
|
951
957
|
const { length } = parser.tokenValue;
|
|
952
|
-
if (isValidAsKeyword && length >=
|
|
953
|
-
const token =
|
|
958
|
+
if (isValidAsKeyword && length >= minKeywordLength && length <= maxKeywordLength) {
|
|
959
|
+
const token = descKeywordTable.get(parser.tokenValue);
|
|
954
960
|
if (token === void 0)
|
|
955
961
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
956
962
|
if (!hasEscape)
|
|
@@ -959,24 +965,24 @@
|
|
|
959
965
|
if ((context & (2 | 2048)) === 0) {
|
|
960
966
|
return token | -2147483648;
|
|
961
967
|
}
|
|
962
|
-
return -
|
|
968
|
+
return -2147483527;
|
|
963
969
|
}
|
|
964
970
|
if (context & 1) {
|
|
965
971
|
if (token === 36970) {
|
|
966
|
-
return -
|
|
972
|
+
return -2147483526;
|
|
967
973
|
}
|
|
968
974
|
if ((token & 36864) === 36864) {
|
|
969
|
-
return -
|
|
975
|
+
return -2147483526;
|
|
970
976
|
}
|
|
971
977
|
if ((token & 20480) === 20480) {
|
|
972
978
|
if (context & 262144 && (context & 8) === 0) {
|
|
973
979
|
return token | -2147483648;
|
|
974
980
|
}
|
|
975
981
|
else {
|
|
976
|
-
return -
|
|
982
|
+
return -2147483527;
|
|
977
983
|
}
|
|
978
984
|
}
|
|
979
|
-
return
|
|
985
|
+
return 209019 | -2147483648;
|
|
980
986
|
}
|
|
981
987
|
if (context & 262144 &&
|
|
982
988
|
(context & 8) === 0 &&
|
|
@@ -985,31 +991,31 @@
|
|
|
985
991
|
}
|
|
986
992
|
if (token === 241771) {
|
|
987
993
|
return context & 262144
|
|
988
|
-
?
|
|
994
|
+
? 209019 | -2147483648
|
|
989
995
|
: context & 1024
|
|
990
|
-
? -
|
|
996
|
+
? -2147483527
|
|
991
997
|
: token | -2147483648;
|
|
992
998
|
}
|
|
993
999
|
if (token === 209005) {
|
|
994
|
-
return
|
|
1000
|
+
return 209019 | -2147483648;
|
|
995
1001
|
}
|
|
996
1002
|
if ((token & 36864) === 36864) {
|
|
997
1003
|
return token | 12288 | -2147483648;
|
|
998
1004
|
}
|
|
999
|
-
return -
|
|
1005
|
+
return -2147483527;
|
|
1000
1006
|
}
|
|
1001
1007
|
return 208897 | (hasEscape ? -2147483648 : 0);
|
|
1002
1008
|
}
|
|
1003
1009
|
function scanPrivateIdentifier(parser) {
|
|
1004
1010
|
let char = advanceChar(parser);
|
|
1005
1011
|
if (char === 92)
|
|
1006
|
-
return
|
|
1012
|
+
return 131;
|
|
1007
1013
|
const merged = consumePossibleSurrogatePair(parser);
|
|
1008
1014
|
if (merged)
|
|
1009
1015
|
char = merged;
|
|
1010
1016
|
if (!isIdentifierStart(char))
|
|
1011
1017
|
parser.report(96);
|
|
1012
|
-
return
|
|
1018
|
+
return 131;
|
|
1013
1019
|
}
|
|
1014
1020
|
function scanIdentifierUnicodeEscape(parser) {
|
|
1015
1021
|
if (parser.source.charCodeAt(parser.index + 1) !== 117) {
|
|
@@ -1074,7 +1080,7 @@
|
|
|
1074
1080
|
while (CharTypes[char] & (64 | 4096)) {
|
|
1075
1081
|
if (char === 95) {
|
|
1076
1082
|
if (!allowSeparator)
|
|
1077
|
-
parser.report(
|
|
1083
|
+
parser.report(154);
|
|
1078
1084
|
allowSeparator = 0;
|
|
1079
1085
|
char = advanceChar(parser);
|
|
1080
1086
|
continue;
|
|
@@ -1085,7 +1091,7 @@
|
|
|
1085
1091
|
char = advanceChar(parser);
|
|
1086
1092
|
}
|
|
1087
1093
|
if (digits === 0 || !allowSeparator) {
|
|
1088
|
-
parser.report(digits === 0 ? 21 :
|
|
1094
|
+
parser.report(digits === 0 ? 21 : 155);
|
|
1089
1095
|
}
|
|
1090
1096
|
}
|
|
1091
1097
|
else if ((char | 32) === 111) {
|
|
@@ -1094,7 +1100,7 @@
|
|
|
1094
1100
|
while (CharTypes[char] & (32 | 4096)) {
|
|
1095
1101
|
if (char === 95) {
|
|
1096
1102
|
if (!allowSeparator) {
|
|
1097
|
-
parser.report(
|
|
1103
|
+
parser.report(154);
|
|
1098
1104
|
}
|
|
1099
1105
|
allowSeparator = 0;
|
|
1100
1106
|
char = advanceChar(parser);
|
|
@@ -1106,7 +1112,7 @@
|
|
|
1106
1112
|
char = advanceChar(parser);
|
|
1107
1113
|
}
|
|
1108
1114
|
if (digits === 0 || !allowSeparator) {
|
|
1109
|
-
parser.report(digits === 0 ? 0 :
|
|
1115
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1110
1116
|
}
|
|
1111
1117
|
}
|
|
1112
1118
|
else if ((char | 32) === 98) {
|
|
@@ -1115,7 +1121,7 @@
|
|
|
1115
1121
|
while (CharTypes[char] & (128 | 4096)) {
|
|
1116
1122
|
if (char === 95) {
|
|
1117
1123
|
if (!allowSeparator) {
|
|
1118
|
-
parser.report(
|
|
1124
|
+
parser.report(154);
|
|
1119
1125
|
}
|
|
1120
1126
|
allowSeparator = 0;
|
|
1121
1127
|
char = advanceChar(parser);
|
|
@@ -1127,7 +1133,7 @@
|
|
|
1127
1133
|
char = advanceChar(parser);
|
|
1128
1134
|
}
|
|
1129
1135
|
if (digits === 0 || !allowSeparator) {
|
|
1130
|
-
parser.report(digits === 0 ? 0 :
|
|
1136
|
+
parser.report(digits === 0 ? 0 : 155);
|
|
1131
1137
|
}
|
|
1132
1138
|
}
|
|
1133
1139
|
else if (CharTypes[char] & 32) {
|
|
@@ -1160,7 +1166,7 @@
|
|
|
1160
1166
|
if (char === 95) {
|
|
1161
1167
|
char = advanceChar(parser);
|
|
1162
1168
|
if (char === 95 || kind & 32) {
|
|
1163
|
-
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);
|
|
1164
1170
|
}
|
|
1165
1171
|
allowSeparator = 1;
|
|
1166
1172
|
continue;
|
|
@@ -1171,7 +1177,7 @@
|
|
|
1171
1177
|
--digit;
|
|
1172
1178
|
}
|
|
1173
1179
|
if (allowSeparator) {
|
|
1174
|
-
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);
|
|
1175
1181
|
}
|
|
1176
1182
|
if (digit >= 0 && !isIdentifierStart(char) && char !== 46) {
|
|
1177
1183
|
parser.tokenValue = value;
|
|
@@ -1215,7 +1221,7 @@
|
|
|
1215
1221
|
if (isBigInt) {
|
|
1216
1222
|
parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
|
|
1217
1223
|
parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
|
|
1218
|
-
return
|
|
1224
|
+
return 134283389;
|
|
1219
1225
|
}
|
|
1220
1226
|
parser.tokenValue =
|
|
1221
1227
|
kind & (1 | 2 | 8 | 4)
|
|
@@ -1236,7 +1242,7 @@
|
|
|
1236
1242
|
const { index } = parser;
|
|
1237
1243
|
char = advanceChar(parser);
|
|
1238
1244
|
if (char === 95) {
|
|
1239
|
-
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);
|
|
1240
1246
|
}
|
|
1241
1247
|
allowSeparator = 1;
|
|
1242
1248
|
ret += parser.source.substring(start, index);
|
|
@@ -1247,7 +1253,7 @@
|
|
|
1247
1253
|
char = advanceChar(parser);
|
|
1248
1254
|
}
|
|
1249
1255
|
if (allowSeparator) {
|
|
1250
|
-
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);
|
|
1251
1257
|
}
|
|
1252
1258
|
return ret + parser.source.substring(start, parser.index);
|
|
1253
1259
|
}
|
|
@@ -1584,6 +1590,7 @@
|
|
|
1584
1590
|
const { index: start } = parser;
|
|
1585
1591
|
let token = 67174409;
|
|
1586
1592
|
let ret = '';
|
|
1593
|
+
let hasCarriageReturn = false;
|
|
1587
1594
|
let char = advanceChar(parser);
|
|
1588
1595
|
while (char !== 96) {
|
|
1589
1596
|
if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) {
|
|
@@ -1593,6 +1600,8 @@
|
|
|
1593
1600
|
}
|
|
1594
1601
|
else if (char === 92) {
|
|
1595
1602
|
char = advanceChar(parser);
|
|
1603
|
+
if (char === 13)
|
|
1604
|
+
hasCarriageReturn = true;
|
|
1596
1605
|
if (char > 0x7e) {
|
|
1597
1606
|
ret += String.fromCodePoint(char);
|
|
1598
1607
|
}
|
|
@@ -1607,7 +1616,9 @@
|
|
|
1607
1616
|
parser.line = line;
|
|
1608
1617
|
parser.column = column;
|
|
1609
1618
|
ret = null;
|
|
1610
|
-
char = scanBadTemplate(parser, char)
|
|
1619
|
+
char = scanBadTemplate(parser, char, () => {
|
|
1620
|
+
hasCarriageReturn = true;
|
|
1621
|
+
});
|
|
1611
1622
|
if (char < 0)
|
|
1612
1623
|
token = 67174408;
|
|
1613
1624
|
break;
|
|
@@ -1618,10 +1629,13 @@
|
|
|
1618
1629
|
}
|
|
1619
1630
|
}
|
|
1620
1631
|
else if (parser.index < parser.end) {
|
|
1621
|
-
if (char === 13
|
|
1622
|
-
|
|
1632
|
+
if (char === 13)
|
|
1633
|
+
hasCarriageReturn = true;
|
|
1634
|
+
if (char === 13 && parser.source.charCodeAt(parser.index + 1) === 10) {
|
|
1623
1635
|
parser.currentChar = parser.source.charCodeAt(++parser.index);
|
|
1624
1636
|
}
|
|
1637
|
+
if (char === 13)
|
|
1638
|
+
char = 10;
|
|
1625
1639
|
if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) {
|
|
1626
1640
|
parser.column = -1;
|
|
1627
1641
|
parser.line++;
|
|
@@ -1634,12 +1648,16 @@
|
|
|
1634
1648
|
}
|
|
1635
1649
|
advanceChar(parser);
|
|
1636
1650
|
parser.tokenValue = ret;
|
|
1637
|
-
|
|
1651
|
+
const tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2));
|
|
1652
|
+
parser.tokenRaw = hasCarriageReturn ? tokenRaw.replaceAll(/\r\n?/g, '\n') : tokenRaw;
|
|
1638
1653
|
return token;
|
|
1639
1654
|
}
|
|
1640
|
-
function scanBadTemplate(parser, ch) {
|
|
1655
|
+
function scanBadTemplate(parser, ch, onCarriageReturn) {
|
|
1641
1656
|
while (ch !== 96) {
|
|
1642
1657
|
switch (ch) {
|
|
1658
|
+
case 13:
|
|
1659
|
+
onCarriageReturn();
|
|
1660
|
+
break;
|
|
1643
1661
|
case 36: {
|
|
1644
1662
|
const index = parser.index + 1;
|
|
1645
1663
|
if (index < parser.end && parser.source.charCodeAt(index) === 123) {
|
|
@@ -1670,42 +1688,42 @@
|
|
|
1670
1688
|
}
|
|
1671
1689
|
|
|
1672
1690
|
const TokenLookup = [
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
128,
|
|
1682
|
-
127,
|
|
1683
|
-
135,
|
|
1684
|
-
127,
|
|
1685
|
-
127,
|
|
1691
|
+
129,
|
|
1692
|
+
129,
|
|
1693
|
+
129,
|
|
1694
|
+
129,
|
|
1695
|
+
129,
|
|
1696
|
+
129,
|
|
1697
|
+
129,
|
|
1698
|
+
129,
|
|
1686
1699
|
129,
|
|
1687
1700
|
128,
|
|
1701
|
+
136,
|
|
1688
1702
|
128,
|
|
1689
1703
|
128,
|
|
1704
|
+
130,
|
|
1705
|
+
129,
|
|
1706
|
+
129,
|
|
1707
|
+
129,
|
|
1708
|
+
129,
|
|
1709
|
+
129,
|
|
1710
|
+
129,
|
|
1711
|
+
129,
|
|
1712
|
+
129,
|
|
1713
|
+
129,
|
|
1714
|
+
129,
|
|
1715
|
+
129,
|
|
1716
|
+
129,
|
|
1717
|
+
129,
|
|
1718
|
+
129,
|
|
1719
|
+
129,
|
|
1720
|
+
129,
|
|
1721
|
+
129,
|
|
1722
|
+
129,
|
|
1690
1723
|
128,
|
|
1691
|
-
128,
|
|
1692
|
-
128,
|
|
1693
|
-
128,
|
|
1694
|
-
128,
|
|
1695
|
-
128,
|
|
1696
|
-
128,
|
|
1697
|
-
128,
|
|
1698
|
-
128,
|
|
1699
|
-
128,
|
|
1700
|
-
128,
|
|
1701
|
-
128,
|
|
1702
|
-
128,
|
|
1703
|
-
128,
|
|
1704
|
-
128,
|
|
1705
|
-
127,
|
|
1706
1724
|
16842798,
|
|
1707
1725
|
134283267,
|
|
1708
|
-
|
|
1726
|
+
131,
|
|
1709
1727
|
208897,
|
|
1710
1728
|
8391477,
|
|
1711
1729
|
8390213,
|
|
@@ -1734,7 +1752,7 @@
|
|
|
1734
1752
|
1077936155,
|
|
1735
1753
|
8390721,
|
|
1736
1754
|
22,
|
|
1737
|
-
|
|
1755
|
+
133,
|
|
1738
1756
|
208897,
|
|
1739
1757
|
208897,
|
|
1740
1758
|
208897,
|
|
@@ -1762,11 +1780,11 @@
|
|
|
1762
1780
|
208897,
|
|
1763
1781
|
208897,
|
|
1764
1782
|
69271571,
|
|
1765
|
-
|
|
1783
|
+
137,
|
|
1766
1784
|
20,
|
|
1767
1785
|
8389959,
|
|
1768
1786
|
208897,
|
|
1769
|
-
|
|
1787
|
+
132,
|
|
1770
1788
|
4096,
|
|
1771
1789
|
4096,
|
|
1772
1790
|
4096,
|
|
@@ -1797,7 +1815,7 @@
|
|
|
1797
1815
|
8389702,
|
|
1798
1816
|
1074790415,
|
|
1799
1817
|
16842799,
|
|
1800
|
-
|
|
1818
|
+
129,
|
|
1801
1819
|
];
|
|
1802
1820
|
function nextToken(parser, context) {
|
|
1803
1821
|
parser.flags = (parser.flags | 1) ^ 1;
|
|
@@ -1827,8 +1845,8 @@
|
|
|
1827
1845
|
case 1074790417:
|
|
1828
1846
|
case 18:
|
|
1829
1847
|
case 16842799:
|
|
1830
|
-
case
|
|
1831
|
-
case
|
|
1848
|
+
case 133:
|
|
1849
|
+
case 129:
|
|
1832
1850
|
advanceChar(parser);
|
|
1833
1851
|
return token;
|
|
1834
1852
|
case 208897:
|
|
@@ -1839,20 +1857,20 @@
|
|
|
1839
1857
|
return scanNumber(parser, context, 16 | 128);
|
|
1840
1858
|
case 134283267:
|
|
1841
1859
|
return scanString(parser, context, char);
|
|
1842
|
-
case
|
|
1860
|
+
case 132:
|
|
1843
1861
|
return scanTemplate(parser, context);
|
|
1844
|
-
case
|
|
1862
|
+
case 137:
|
|
1845
1863
|
return scanUnicodeIdentifier(parser, context);
|
|
1846
|
-
case
|
|
1864
|
+
case 131:
|
|
1847
1865
|
return scanPrivateIdentifier(parser);
|
|
1848
|
-
case
|
|
1866
|
+
case 128:
|
|
1849
1867
|
advanceChar(parser);
|
|
1850
1868
|
break;
|
|
1851
|
-
case
|
|
1869
|
+
case 130:
|
|
1852
1870
|
state |= 1 | 4;
|
|
1853
1871
|
scanNewLine(parser);
|
|
1854
1872
|
break;
|
|
1855
|
-
case
|
|
1873
|
+
case 136:
|
|
1856
1874
|
consumeLineFeed(parser, state);
|
|
1857
1875
|
state = (state & -5) | 1;
|
|
1858
1876
|
break;
|
|
@@ -1956,7 +1974,7 @@
|
|
|
1956
1974
|
advanceChar(parser);
|
|
1957
1975
|
if ((state & 1 || isStartOfLine) && parser.currentChar === 62) {
|
|
1958
1976
|
if (!parser.options.webcompat)
|
|
1959
|
-
parser.report(
|
|
1977
|
+
parser.report(114);
|
|
1960
1978
|
advanceChar(parser);
|
|
1961
1979
|
state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
|
|
1962
1980
|
continue;
|
|
@@ -2075,7 +2093,7 @@
|
|
|
2075
2093
|
advanceChar(parser);
|
|
2076
2094
|
return 4718634;
|
|
2077
2095
|
}
|
|
2078
|
-
return
|
|
2096
|
+
return 276824446;
|
|
2079
2097
|
}
|
|
2080
2098
|
if (ch === 46) {
|
|
2081
2099
|
const index = parser.index + 1;
|
|
@@ -2083,7 +2101,7 @@
|
|
|
2083
2101
|
ch = source.charCodeAt(index);
|
|
2084
2102
|
if (!(ch >= 48 && ch <= 57)) {
|
|
2085
2103
|
advanceChar(parser);
|
|
2086
|
-
return
|
|
2104
|
+
return 67108991;
|
|
2087
2105
|
}
|
|
2088
2106
|
}
|
|
2089
2107
|
}
|
|
@@ -2185,20 +2203,20 @@
|
|
|
2185
2203
|
function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
|
|
2186
2204
|
if (context & 1) {
|
|
2187
2205
|
if ((t & 36864) === 36864) {
|
|
2188
|
-
parser.report(
|
|
2206
|
+
parser.report(120);
|
|
2189
2207
|
}
|
|
2190
2208
|
if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
|
|
2191
|
-
parser.report(
|
|
2209
|
+
parser.report(121);
|
|
2192
2210
|
}
|
|
2193
2211
|
}
|
|
2194
|
-
if ((t & 20480) === 20480 || t === -
|
|
2212
|
+
if ((t & 20480) === 20480 || t === -2147483527) {
|
|
2195
2213
|
parser.report(102);
|
|
2196
2214
|
}
|
|
2197
2215
|
if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
|
|
2198
2216
|
parser.report(100);
|
|
2199
2217
|
}
|
|
2200
2218
|
if (context & (2048 | 2) && t === 209006) {
|
|
2201
|
-
parser.report(
|
|
2219
|
+
parser.report(112);
|
|
2202
2220
|
}
|
|
2203
2221
|
if (context & (1024 | 1) && t === 241771) {
|
|
2204
2222
|
parser.report(97, 'yield');
|
|
@@ -2207,15 +2225,15 @@
|
|
|
2207
2225
|
function validateFunctionName(parser, context, t) {
|
|
2208
2226
|
if (context & 1) {
|
|
2209
2227
|
if ((t & 36864) === 36864) {
|
|
2210
|
-
parser.report(
|
|
2228
|
+
parser.report(120);
|
|
2211
2229
|
}
|
|
2212
2230
|
if ((t & 537079808) === 537079808) {
|
|
2213
|
-
parser.report(
|
|
2231
|
+
parser.report(121);
|
|
2214
2232
|
}
|
|
2215
|
-
if (t === -
|
|
2233
|
+
if (t === -2147483526) {
|
|
2216
2234
|
parser.report(95);
|
|
2217
2235
|
}
|
|
2218
|
-
if (t === -
|
|
2236
|
+
if (t === -2147483527) {
|
|
2219
2237
|
parser.report(95);
|
|
2220
2238
|
}
|
|
2221
2239
|
}
|
|
@@ -2223,7 +2241,7 @@
|
|
|
2223
2241
|
parser.report(102);
|
|
2224
2242
|
}
|
|
2225
2243
|
if (context & (2048 | 2) && t === 209006) {
|
|
2226
|
-
parser.report(
|
|
2244
|
+
parser.report(112);
|
|
2227
2245
|
}
|
|
2228
2246
|
if (context & (1024 | 1) && t === 241771) {
|
|
2229
2247
|
parser.report(97, 'yield');
|
|
@@ -2232,14 +2250,14 @@
|
|
|
2232
2250
|
function isStrictReservedWord(parser, context, t) {
|
|
2233
2251
|
if (t === 209006) {
|
|
2234
2252
|
if (context & (2048 | 2))
|
|
2235
|
-
parser.report(
|
|
2253
|
+
parser.report(112);
|
|
2236
2254
|
parser.destructible |= 128;
|
|
2237
2255
|
}
|
|
2238
2256
|
if (t === 241771 && context & 1024)
|
|
2239
2257
|
parser.report(97, 'yield');
|
|
2240
2258
|
return ((t & 20480) === 20480 ||
|
|
2241
2259
|
(t & 36864) === 36864 ||
|
|
2242
|
-
t == -
|
|
2260
|
+
t == -2147483526);
|
|
2243
2261
|
}
|
|
2244
2262
|
function isPropertyWithPrivateFieldKey(expr) {
|
|
2245
2263
|
return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
|
|
@@ -2248,7 +2266,7 @@
|
|
|
2248
2266
|
while (labels) {
|
|
2249
2267
|
if (labels['$' + name]) {
|
|
2250
2268
|
if (isIterationStatement)
|
|
2251
|
-
parser.report(
|
|
2269
|
+
parser.report(139);
|
|
2252
2270
|
return 1;
|
|
2253
2271
|
}
|
|
2254
2272
|
if (isIterationStatement && labels.loop)
|
|
@@ -2261,7 +2279,7 @@
|
|
|
2261
2279
|
let set = labels;
|
|
2262
2280
|
while (set) {
|
|
2263
2281
|
if (set['$' + name])
|
|
2264
|
-
parser.report(
|
|
2282
|
+
parser.report(138, name);
|
|
2265
2283
|
set = set['$'];
|
|
2266
2284
|
}
|
|
2267
2285
|
labels['$' + name] = 1;
|
|
@@ -2289,14 +2307,14 @@
|
|
|
2289
2307
|
function classifyIdentifier(parser, context, t) {
|
|
2290
2308
|
if ((t & 537079808) === 537079808) {
|
|
2291
2309
|
if (context & 1)
|
|
2292
|
-
parser.report(
|
|
2310
|
+
parser.report(121);
|
|
2293
2311
|
parser.flags |= 512;
|
|
2294
2312
|
}
|
|
2295
2313
|
if (!isValidIdentifier(context, t))
|
|
2296
2314
|
parser.report(0);
|
|
2297
2315
|
}
|
|
2298
2316
|
|
|
2299
|
-
const entities = {
|
|
2317
|
+
const entities = new Map(Object.entries({
|
|
2300
2318
|
AElig: '\u00C6',
|
|
2301
2319
|
AMP: '\u0026',
|
|
2302
2320
|
Aacute: '\u00C1',
|
|
@@ -4422,8 +4440,8 @@
|
|
|
4422
4440
|
zscr: '\uD835\uDCCF',
|
|
4423
4441
|
zwj: '\u200D',
|
|
4424
4442
|
zwnj: '\u200C',
|
|
4425
|
-
};
|
|
4426
|
-
const decodeMap = {
|
|
4443
|
+
}));
|
|
4444
|
+
const decodeMap = new Map(Object.entries({
|
|
4427
4445
|
'0': 65533,
|
|
4428
4446
|
'128': 8364,
|
|
4429
4447
|
'130': 8218,
|
|
@@ -4452,22 +4470,22 @@
|
|
|
4452
4470
|
'156': 339,
|
|
4453
4471
|
'158': 382,
|
|
4454
4472
|
'159': 376,
|
|
4455
|
-
};
|
|
4473
|
+
}).map(([key, value]) => [Number(key), value]));
|
|
4456
4474
|
function decodeHTMLStrict(text) {
|
|
4457
|
-
return text.
|
|
4475
|
+
return text.replaceAll(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => {
|
|
4458
4476
|
if (key.charAt(1) === '#') {
|
|
4459
4477
|
const secondChar = key.charAt(2);
|
|
4460
4478
|
const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10);
|
|
4461
4479
|
return decodeCodePoint(codePoint);
|
|
4462
4480
|
}
|
|
4463
|
-
return
|
|
4481
|
+
return entities.get(key.slice(1, -1)) ?? key;
|
|
4464
4482
|
});
|
|
4465
4483
|
}
|
|
4466
4484
|
function decodeCodePoint(codePoint) {
|
|
4467
4485
|
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
|
|
4468
4486
|
return '\uFFFD';
|
|
4469
4487
|
}
|
|
4470
|
-
return String.fromCodePoint(
|
|
4488
|
+
return String.fromCodePoint(decodeMap.get(codePoint) ?? codePoint);
|
|
4471
4489
|
}
|
|
4472
4490
|
|
|
4473
4491
|
function scanJSXAttributeValue(parser, context) {
|
|
@@ -4537,7 +4555,7 @@
|
|
|
4537
4555
|
if (parser.options.raw)
|
|
4538
4556
|
parser.tokenRaw = raw;
|
|
4539
4557
|
parser.tokenValue = decodeHTMLStrict(raw);
|
|
4540
|
-
parser.setToken(
|
|
4558
|
+
parser.setToken(138);
|
|
4541
4559
|
}
|
|
4542
4560
|
function rescanJSXIdentifier(parser) {
|
|
4543
4561
|
if ((parser.getToken() & 143360) === 143360) {
|
|
@@ -4552,6 +4570,8 @@
|
|
|
4552
4570
|
return parser.getToken();
|
|
4553
4571
|
}
|
|
4554
4572
|
|
|
4573
|
+
const nextFeatures = 1 | 2 | 4;
|
|
4574
|
+
|
|
4555
4575
|
function normalizeRanges(ranges) {
|
|
4556
4576
|
if (!ranges)
|
|
4557
4577
|
return undefined;
|
|
@@ -4564,17 +4584,27 @@
|
|
|
4564
4584
|
};
|
|
4565
4585
|
}
|
|
4566
4586
|
function normalizeOptions(rawOptions) {
|
|
4567
|
-
|
|
4587
|
+
let { features, next, ranges, module, sourceType, globalReturn, ...restOptions } = {
|
|
4568
4588
|
validateRegex: true,
|
|
4589
|
+
features: 0,
|
|
4569
4590
|
...rawOptions,
|
|
4570
|
-
ranges: normalizeRanges(rawOptions.ranges),
|
|
4571
4591
|
};
|
|
4572
|
-
if (
|
|
4573
|
-
|
|
4592
|
+
if (next) {
|
|
4593
|
+
features |= nextFeatures;
|
|
4574
4594
|
}
|
|
4575
|
-
|
|
4576
|
-
|
|
4595
|
+
ranges = normalizeRanges(ranges);
|
|
4596
|
+
if (module && !sourceType) {
|
|
4597
|
+
sourceType = 'module';
|
|
4577
4598
|
}
|
|
4599
|
+
if (globalReturn && (!sourceType || sourceType === 'script')) {
|
|
4600
|
+
sourceType = 'commonjs';
|
|
4601
|
+
}
|
|
4602
|
+
const options = {
|
|
4603
|
+
...restOptions,
|
|
4604
|
+
ranges,
|
|
4605
|
+
features,
|
|
4606
|
+
sourceType,
|
|
4607
|
+
};
|
|
4578
4608
|
return options;
|
|
4579
4609
|
}
|
|
4580
4610
|
|
|
@@ -4595,7 +4625,7 @@
|
|
|
4595
4625
|
const value = privateIdentifiers.get(name);
|
|
4596
4626
|
if (this.hasPrivateIdentifier(name) &&
|
|
4597
4627
|
((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
|
|
4598
|
-
this.parser.report(
|
|
4628
|
+
this.parser.report(148, name);
|
|
4599
4629
|
}
|
|
4600
4630
|
privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
|
|
4601
4631
|
}
|
|
@@ -4656,17 +4686,17 @@
|
|
|
4656
4686
|
((kind & 128 && value & 68) ||
|
|
4657
4687
|
(value & 128 && kind & 68))) ;
|
|
4658
4688
|
else {
|
|
4659
|
-
parser.report(
|
|
4689
|
+
parser.report(147, name);
|
|
4660
4690
|
}
|
|
4661
4691
|
}
|
|
4662
4692
|
if (currentScope === this) {
|
|
4663
4693
|
if (value && value & 1 && kind & 1) {
|
|
4664
|
-
currentScope.recordScopeError(
|
|
4694
|
+
currentScope.recordScopeError(147, name);
|
|
4665
4695
|
}
|
|
4666
4696
|
}
|
|
4667
4697
|
if (value &&
|
|
4668
4698
|
(value & 256 || (value & 512 && !parser.options.webcompat))) {
|
|
4669
|
-
parser.report(
|
|
4699
|
+
parser.report(147, name);
|
|
4670
4700
|
}
|
|
4671
4701
|
currentScope.variableBindings.set(name, kind);
|
|
4672
4702
|
currentScope = currentScope.parent;
|
|
@@ -4680,7 +4710,7 @@
|
|
|
4680
4710
|
const value = this.variableBindings.get(name);
|
|
4681
4711
|
if (value && (value & 2) === 0) {
|
|
4682
4712
|
if (kind & 1) {
|
|
4683
|
-
this.recordScopeError(
|
|
4713
|
+
this.recordScopeError(147, name);
|
|
4684
4714
|
}
|
|
4685
4715
|
else if (parser.options.webcompat &&
|
|
4686
4716
|
(context & 1) === 0 &&
|
|
@@ -4688,22 +4718,22 @@
|
|
|
4688
4718
|
value === 64 &&
|
|
4689
4719
|
kind === 64) ;
|
|
4690
4720
|
else {
|
|
4691
|
-
parser.report(
|
|
4721
|
+
parser.report(147, name);
|
|
4692
4722
|
}
|
|
4693
4723
|
}
|
|
4694
4724
|
if (this.type & 64 &&
|
|
4695
4725
|
this.parent?.hasVariable(name) &&
|
|
4696
4726
|
(this.parent.variableBindings.get(name) & 2) === 0) {
|
|
4697
|
-
parser.report(
|
|
4727
|
+
parser.report(147, name);
|
|
4698
4728
|
}
|
|
4699
4729
|
if (this.type & 512 && value && (value & 2) === 0) {
|
|
4700
4730
|
if (kind & 1) {
|
|
4701
|
-
this.recordScopeError(
|
|
4731
|
+
this.recordScopeError(147, name);
|
|
4702
4732
|
}
|
|
4703
4733
|
}
|
|
4704
4734
|
if (this.type & 32) {
|
|
4705
4735
|
if (this.parent.variableBindings.get(name) & 768)
|
|
4706
|
-
parser.report(
|
|
4736
|
+
parser.report(161, name);
|
|
4707
4737
|
}
|
|
4708
4738
|
this.variableBindings.set(name, kind);
|
|
4709
4739
|
}
|
|
@@ -4735,6 +4765,7 @@
|
|
|
4735
4765
|
options;
|
|
4736
4766
|
token = 1048576;
|
|
4737
4767
|
flags = 0;
|
|
4768
|
+
features = 0;
|
|
4738
4769
|
index = 0;
|
|
4739
4770
|
line = 1;
|
|
4740
4771
|
column = 0;
|
|
@@ -4760,6 +4791,7 @@
|
|
|
4760
4791
|
this.end = source.length;
|
|
4761
4792
|
this.currentChar = source.charCodeAt(0);
|
|
4762
4793
|
this.options = normalizeOptions(rawOptions);
|
|
4794
|
+
this.features = this.options.features;
|
|
4763
4795
|
if (Array.isArray(this.options.onComment)) {
|
|
4764
4796
|
this.options.onComment = pushComment(this.options.onComment, this.options);
|
|
4765
4797
|
}
|
|
@@ -4840,7 +4872,7 @@
|
|
|
4840
4872
|
declareUnboundVariable(name) {
|
|
4841
4873
|
const { exportedNames } = this;
|
|
4842
4874
|
if (exportedNames.has(name)) {
|
|
4843
|
-
this.report(
|
|
4875
|
+
this.report(149, name);
|
|
4844
4876
|
}
|
|
4845
4877
|
exportedNames.add(name);
|
|
4846
4878
|
}
|
|
@@ -4863,29 +4895,10 @@
|
|
|
4863
4895
|
return undefined;
|
|
4864
4896
|
}
|
|
4865
4897
|
cloneIdentifier(original) {
|
|
4866
|
-
return
|
|
4898
|
+
return structuredClone(original);
|
|
4867
4899
|
}
|
|
4868
4900
|
cloneStringLiteral(original) {
|
|
4869
|
-
return
|
|
4870
|
-
}
|
|
4871
|
-
cloneLocationInformation(node, original) {
|
|
4872
|
-
const { ranges } = this.options;
|
|
4873
|
-
if (ranges) {
|
|
4874
|
-
if (ranges.start)
|
|
4875
|
-
node.start = original.start;
|
|
4876
|
-
if (ranges.end)
|
|
4877
|
-
node.end = original.end;
|
|
4878
|
-
if (ranges.range)
|
|
4879
|
-
node.range = [...original.range];
|
|
4880
|
-
}
|
|
4881
|
-
if (this.options.loc) {
|
|
4882
|
-
node.loc = {
|
|
4883
|
-
...original.loc,
|
|
4884
|
-
start: { ...original.loc.start },
|
|
4885
|
-
end: { ...original.loc.end },
|
|
4886
|
-
};
|
|
4887
|
-
}
|
|
4888
|
-
return node;
|
|
4901
|
+
return structuredClone(original);
|
|
4889
4902
|
}
|
|
4890
4903
|
}
|
|
4891
4904
|
function pushComment(comments, options) {
|
|
@@ -4948,7 +4961,7 @@
|
|
|
4948
4961
|
if (scope) {
|
|
4949
4962
|
for (const name of parser.exportedBindings) {
|
|
4950
4963
|
if (!scope.hasVariable(name))
|
|
4951
|
-
parser.report(
|
|
4964
|
+
parser.report(150, name);
|
|
4952
4965
|
}
|
|
4953
4966
|
}
|
|
4954
4967
|
}
|
|
@@ -4998,7 +5011,7 @@
|
|
|
4998
5011
|
return statements;
|
|
4999
5012
|
}
|
|
5000
5013
|
function parseModuleItem(parser, context, scope) {
|
|
5001
|
-
if (parser.getToken() ===
|
|
5014
|
+
if (parser.getToken() === 133) {
|
|
5002
5015
|
Object.assign(parser.leadingDecorators, {
|
|
5003
5016
|
start: parser.tokenStart,
|
|
5004
5017
|
decorators: parseDecorators(parser, context, undefined),
|
|
@@ -5010,28 +5023,42 @@
|
|
|
5010
5023
|
moduleItem = parseExportDeclaration(parser, context, scope);
|
|
5011
5024
|
break;
|
|
5012
5025
|
case 86106:
|
|
5026
|
+
if (parser.leadingDecorators.decorators.length) {
|
|
5027
|
+
parser.report(172);
|
|
5028
|
+
}
|
|
5013
5029
|
moduleItem = parseImportDeclaration(parser, context, scope);
|
|
5014
5030
|
break;
|
|
5015
5031
|
default:
|
|
5016
5032
|
moduleItem = parseStatementListItem(parser, context, scope, undefined, 4, {});
|
|
5017
5033
|
}
|
|
5018
|
-
if (parser.leadingDecorators?.decorators.length) {
|
|
5019
|
-
parser.report(170);
|
|
5020
|
-
}
|
|
5021
5034
|
return moduleItem;
|
|
5022
5035
|
}
|
|
5023
5036
|
function parseStatementListItem(parser, context, scope, privateScope, origin, labels) {
|
|
5024
5037
|
const start = parser.tokenStart;
|
|
5038
|
+
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
5039
|
+
parser.report(172);
|
|
5040
|
+
}
|
|
5025
5041
|
switch (parser.getToken()) {
|
|
5026
5042
|
case 86104:
|
|
5027
5043
|
return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 0, start);
|
|
5028
|
-
case
|
|
5044
|
+
case 133:
|
|
5045
|
+
if (!(parser.features & 1)) {
|
|
5046
|
+
parser.report(30, '@');
|
|
5047
|
+
}
|
|
5029
5048
|
case 86094:
|
|
5030
5049
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5031
5050
|
case 86090:
|
|
5032
5051
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, 0);
|
|
5033
5052
|
case 241737:
|
|
5034
5053
|
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
5054
|
+
case 209013:
|
|
5055
|
+
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels);
|
|
5056
|
+
case 209006:
|
|
5057
|
+
if ((context & 2048 || (context & 2 && context & 8)) &&
|
|
5058
|
+
nextTokenIsUsingOnSameLine(parser)) {
|
|
5059
|
+
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels);
|
|
5060
|
+
}
|
|
5061
|
+
return parseStatement(parser, context, scope, privateScope, origin, labels, 1);
|
|
5035
5062
|
case 20564:
|
|
5036
5063
|
parser.report(103, 'export');
|
|
5037
5064
|
case 86106:
|
|
@@ -5085,9 +5112,9 @@
|
|
|
5085
5112
|
case 209005:
|
|
5086
5113
|
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, origin, labels, 0);
|
|
5087
5114
|
case 20557:
|
|
5088
|
-
parser.report(
|
|
5115
|
+
parser.report(164);
|
|
5089
5116
|
case 20566:
|
|
5090
|
-
parser.report(
|
|
5117
|
+
parser.report(165);
|
|
5091
5118
|
case 86104:
|
|
5092
5119
|
parser.report(context & 1
|
|
5093
5120
|
? 76
|
|
@@ -5115,15 +5142,18 @@
|
|
|
5115
5142
|
default:
|
|
5116
5143
|
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart);
|
|
5117
5144
|
}
|
|
5145
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, allowFuncDecl, expr, token, tokenValue, tokenStart);
|
|
5146
|
+
}
|
|
5147
|
+
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, allowFuncDecl, initialExpression, token, tokenValue, tokenStart) {
|
|
5118
5148
|
if (token & 143360 && parser.getToken() === 21) {
|
|
5119
|
-
return parseLabelledStatement(parser, context, scope, privateScope, origin, labels, tokenValue,
|
|
5149
|
+
return parseLabelledStatement(parser, context, scope, privateScope, origin, labels, tokenValue, initialExpression, token, allowFuncDecl, tokenStart);
|
|
5120
5150
|
}
|
|
5121
|
-
|
|
5122
|
-
|
|
5151
|
+
let expression = parseMemberOrUpdateExpression(parser, context, privateScope, initialExpression, 0, 0, tokenStart);
|
|
5152
|
+
expression = parseAssignmentExpression(parser, context, privateScope, 0, 0, tokenStart, expression);
|
|
5123
5153
|
if (parser.getToken() === 18) {
|
|
5124
|
-
|
|
5154
|
+
expression = parseSequenceExpression(parser, context, privateScope, 0, tokenStart, expression);
|
|
5125
5155
|
}
|
|
5126
|
-
return parseExpressionStatement(parser, context,
|
|
5156
|
+
return parseExpressionStatement(parser, context, expression, tokenStart);
|
|
5127
5157
|
}
|
|
5128
5158
|
function parseBlock(parser, context, scope, privateScope, labels, start = parser.tokenStart, type = 'BlockStatement') {
|
|
5129
5159
|
const body = [];
|
|
@@ -5185,7 +5215,7 @@
|
|
|
5185
5215
|
if (!asyncNewLine) {
|
|
5186
5216
|
if (parser.getToken() === 86104) {
|
|
5187
5217
|
if (!allowFuncDecl)
|
|
5188
|
-
parser.report(
|
|
5218
|
+
parser.report(125);
|
|
5189
5219
|
return parseFunctionDeclaration(parser, context, scope, privateScope, origin, 1, 0, 1, start);
|
|
5190
5220
|
}
|
|
5191
5221
|
if (isValidIdentifier(context, parser.getToken())) {
|
|
@@ -5312,9 +5342,14 @@
|
|
|
5312
5342
|
while (parser.getToken() !== 20556 &&
|
|
5313
5343
|
parser.getToken() !== 1074790415 &&
|
|
5314
5344
|
parser.getToken() !== 20561) {
|
|
5315
|
-
|
|
5345
|
+
const statement = parseStatementListItem(parser, context | 4, scope, privateScope, 2, {
|
|
5316
5346
|
$: labels,
|
|
5317
|
-
})
|
|
5347
|
+
});
|
|
5348
|
+
if (statement.type === 'VariableDeclaration' &&
|
|
5349
|
+
(statement.kind === 'using' || statement.kind === 'await using')) {
|
|
5350
|
+
parser.report(30, statement.kind);
|
|
5351
|
+
}
|
|
5352
|
+
consequent.push(statement);
|
|
5318
5353
|
}
|
|
5319
5354
|
cases.push(parser.finishNode({
|
|
5320
5355
|
type: 'SwitchCase',
|
|
@@ -5355,7 +5390,7 @@
|
|
|
5355
5390
|
const { tokenValue } = parser;
|
|
5356
5391
|
label = parseIdentifier(parser, context | 32);
|
|
5357
5392
|
if (!isValidLabel(parser, labels, tokenValue, 1))
|
|
5358
|
-
parser.report(
|
|
5393
|
+
parser.report(140, tokenValue);
|
|
5359
5394
|
}
|
|
5360
5395
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5361
5396
|
return parser.finishNode({
|
|
@@ -5371,7 +5406,7 @@
|
|
|
5371
5406
|
const { tokenValue } = parser;
|
|
5372
5407
|
label = parseIdentifier(parser, context | 32);
|
|
5373
5408
|
if (!isValidLabel(parser, labels, tokenValue, 0))
|
|
5374
|
-
parser.report(
|
|
5409
|
+
parser.report(140, tokenValue);
|
|
5375
5410
|
}
|
|
5376
5411
|
else if ((context & (4 | 128)) === 0) {
|
|
5377
5412
|
parser.report(69);
|
|
@@ -5516,14 +5551,90 @@
|
|
|
5516
5551
|
}
|
|
5517
5552
|
return parseExpressionStatement(parser, context, expr, tokenStart);
|
|
5518
5553
|
}
|
|
5519
|
-
function
|
|
5554
|
+
function nextTokenIsUsingOnSameLine(parser) {
|
|
5555
|
+
const { index: parserIndex, source } = parser;
|
|
5556
|
+
let index = parserIndex;
|
|
5557
|
+
while (index < parser.end) {
|
|
5558
|
+
const char = source.charCodeAt(index);
|
|
5559
|
+
if (char === 0x0a || char === 0x0d || char === 0x2028 || char === 0x2029)
|
|
5560
|
+
return false;
|
|
5561
|
+
if (/\s/u.test(source[index])) {
|
|
5562
|
+
index++;
|
|
5563
|
+
continue;
|
|
5564
|
+
}
|
|
5565
|
+
if (char === 0x2f && source.charCodeAt(index + 1) === 0x2a) {
|
|
5566
|
+
index += 2;
|
|
5567
|
+
while (index < parser.end) {
|
|
5568
|
+
const commentChar = source.charCodeAt(index);
|
|
5569
|
+
if (commentChar === 0x0a || commentChar === 0x0d || commentChar === 0x2028 || commentChar === 0x2029) {
|
|
5570
|
+
return false;
|
|
5571
|
+
}
|
|
5572
|
+
if (commentChar === 0x2a && source.charCodeAt(index + 1) === 0x2f) {
|
|
5573
|
+
index += 2;
|
|
5574
|
+
break;
|
|
5575
|
+
}
|
|
5576
|
+
index++;
|
|
5577
|
+
}
|
|
5578
|
+
continue;
|
|
5579
|
+
}
|
|
5580
|
+
break;
|
|
5581
|
+
}
|
|
5582
|
+
if (source.slice(index, index + 5) !== 'using')
|
|
5583
|
+
return false;
|
|
5584
|
+
const following = source.codePointAt(index + 5);
|
|
5585
|
+
return following === undefined || (following !== 0x5c && !isIdentifierPart(following));
|
|
5586
|
+
}
|
|
5587
|
+
function isResourceBindingStart(token) {
|
|
5588
|
+
return (token & 143360) === 143360 && (token & 20480) !== 20480;
|
|
5589
|
+
}
|
|
5590
|
+
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5591
|
+
const { tokenStart, tokenValue } = parser;
|
|
5592
|
+
const token = parser.getToken();
|
|
5593
|
+
const expression = parseIdentifier(parser, context);
|
|
5594
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5595
|
+
if (origin & 4 && context & 8 && (context & 2) === 0) {
|
|
5596
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5597
|
+
}
|
|
5598
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'using', tokenStart, 1);
|
|
5599
|
+
}
|
|
5600
|
+
parser.assignable = 1;
|
|
5601
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, 1, expression, token, tokenValue, tokenStart);
|
|
5602
|
+
}
|
|
5603
|
+
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, origin, labels) {
|
|
5520
5604
|
const start = parser.tokenStart;
|
|
5521
|
-
|
|
5522
|
-
|
|
5605
|
+
if (context & 524288)
|
|
5606
|
+
parser.report(179);
|
|
5607
|
+
nextToken(parser, context | 32);
|
|
5608
|
+
let argument;
|
|
5609
|
+
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
5610
|
+
const usingStart = parser.tokenStart;
|
|
5611
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5612
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5613
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'await using', start, 1);
|
|
5614
|
+
}
|
|
5615
|
+
argument = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, usingStart);
|
|
5616
|
+
}
|
|
5617
|
+
else {
|
|
5618
|
+
argument = parseLeftHandSideExpression(parser, context, privateScope, 0, 0, 1);
|
|
5619
|
+
}
|
|
5620
|
+
if (parser.getToken() === 8391735)
|
|
5621
|
+
parser.report(33);
|
|
5622
|
+
parser.assignable = 2;
|
|
5623
|
+
const expression = parser.finishNode({
|
|
5624
|
+
type: 'AwaitExpression',
|
|
5625
|
+
argument,
|
|
5626
|
+
}, start);
|
|
5627
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, origin, labels, 0, expression, 1048576, '', start);
|
|
5628
|
+
}
|
|
5629
|
+
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5630
|
+
const start = declarationStart;
|
|
5631
|
+
if (!keywordConsumed)
|
|
5632
|
+
nextToken(parser, context);
|
|
5633
|
+
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5523
5634
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5524
5635
|
return parser.finishNode({
|
|
5525
5636
|
type: 'VariableDeclaration',
|
|
5526
|
-
kind: kind & 8 ? 'let' : 'const',
|
|
5637
|
+
kind: declarationKind ?? (kind & 8 ? 'let' : 'const'),
|
|
5527
5638
|
declarations,
|
|
5528
5639
|
}, start);
|
|
5529
5640
|
}
|
|
@@ -5538,24 +5649,34 @@
|
|
|
5538
5649
|
declarations,
|
|
5539
5650
|
}, start);
|
|
5540
5651
|
}
|
|
5541
|
-
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin) {
|
|
5652
|
+
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5542
5653
|
let bindingCount = 1;
|
|
5543
|
-
const
|
|
5544
|
-
|
|
5545
|
-
];
|
|
5654
|
+
const firstDeclaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5655
|
+
const list = [firstDeclaration];
|
|
5656
|
+
const resourceNames = declarationKind && parser.options.lexical ? new Set([firstDeclaration.id.name]) : undefined;
|
|
5546
5657
|
while (consumeOpt(parser, context, 18)) {
|
|
5547
5658
|
bindingCount++;
|
|
5548
|
-
|
|
5659
|
+
const declaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5660
|
+
if (resourceNames) {
|
|
5661
|
+
const { name } = declaration.id;
|
|
5662
|
+
if (resourceNames.has(name))
|
|
5663
|
+
parser.report(147, name);
|
|
5664
|
+
resourceNames.add(name);
|
|
5665
|
+
}
|
|
5666
|
+
list.push(declaration);
|
|
5549
5667
|
}
|
|
5550
5668
|
if (bindingCount > 1 && origin & 32 && parser.getToken() & 262144) {
|
|
5551
5669
|
parser.report(61, KeywordDescTable[parser.getToken() & 255]);
|
|
5552
5670
|
}
|
|
5553
5671
|
return list;
|
|
5554
5672
|
}
|
|
5555
|
-
function parseVariableDeclaration(parser, context, scope, privateScope, kind, origin) {
|
|
5673
|
+
function parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5556
5674
|
const { tokenStart } = parser;
|
|
5557
5675
|
const token = parser.getToken();
|
|
5558
5676
|
let init = null;
|
|
5677
|
+
if (declarationKind && (token & 2097152) === 2097152) {
|
|
5678
|
+
parser.report(50);
|
|
5679
|
+
}
|
|
5559
5680
|
const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
|
|
5560
5681
|
if (parser.getToken() === 1077936155) {
|
|
5561
5682
|
nextToken(parser, context | 32);
|
|
@@ -5570,7 +5691,7 @@
|
|
|
5570
5691
|
}
|
|
5571
5692
|
else if ((kind & 16 || (token & 2097152) > 0) &&
|
|
5572
5693
|
(parser.getToken() & 262144) !== 262144) {
|
|
5573
|
-
parser.report(59, kind & 16 ? 'const' : 'destructuring');
|
|
5694
|
+
parser.report(59, declarationKind ?? (kind & 16 ? 'const' : 'destructuring'));
|
|
5574
5695
|
}
|
|
5575
5696
|
return parser.finishNode({
|
|
5576
5697
|
type: 'VariableDeclarator',
|
|
@@ -5591,7 +5712,10 @@
|
|
|
5591
5712
|
let init = null;
|
|
5592
5713
|
let isVarDecl = parser.getToken() === 86088 ||
|
|
5593
5714
|
parser.getToken() === 241737 ||
|
|
5594
|
-
parser.getToken() === 86090
|
|
5715
|
+
parser.getToken() === 86090 ||
|
|
5716
|
+
parser.getToken() === 209013;
|
|
5717
|
+
let resourceDeclarationKind;
|
|
5718
|
+
let consumedForOfDelimiter = false;
|
|
5595
5719
|
let right;
|
|
5596
5720
|
const { tokenStart } = parser;
|
|
5597
5721
|
const token = parser.getToken();
|
|
@@ -5615,7 +5739,82 @@
|
|
|
5615
5739
|
parser.assignable = 1;
|
|
5616
5740
|
init = parseMemberOrUpdateExpression(parser, context, privateScope, init, 0, 0, tokenStart);
|
|
5617
5741
|
if (parser.getToken() === 471156)
|
|
5618
|
-
parser.report(
|
|
5742
|
+
parser.report(117);
|
|
5743
|
+
}
|
|
5744
|
+
}
|
|
5745
|
+
else if (token === 209013) {
|
|
5746
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5747
|
+
if ((parser.flags & 1) !== 0 || !isResourceBindingStart(parser.getToken())) {
|
|
5748
|
+
isVarDecl = false;
|
|
5749
|
+
parser.assignable = 1;
|
|
5750
|
+
init = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, tokenStart);
|
|
5751
|
+
}
|
|
5752
|
+
else if (parser.getToken() === 471156) {
|
|
5753
|
+
const ofStart = parser.tokenStart;
|
|
5754
|
+
const ofToken = parser.getToken();
|
|
5755
|
+
const ofValue = parser.tokenValue;
|
|
5756
|
+
const ofIdentifier = parseIdentifier(parser, context);
|
|
5757
|
+
if (parser.getToken() !== 1077936155 &&
|
|
5758
|
+
parser.getToken() !== 8673330 &&
|
|
5759
|
+
parser.getToken() !== 1074790417 &&
|
|
5760
|
+
parser.getToken() !== 18) {
|
|
5761
|
+
isVarDecl = false;
|
|
5762
|
+
consumedForOfDelimiter = true;
|
|
5763
|
+
parser.assignable = 1;
|
|
5764
|
+
init = usingIdentifier;
|
|
5765
|
+
}
|
|
5766
|
+
else {
|
|
5767
|
+
resourceDeclarationKind = 'using';
|
|
5768
|
+
validateBindingIdentifier(parser, context, 16, ofToken, 0);
|
|
5769
|
+
scope?.addBlockName(context, ofValue, 16, 32);
|
|
5770
|
+
let declarationInitializer = null;
|
|
5771
|
+
if (parser.getToken() === 1077936155) {
|
|
5772
|
+
nextToken(parser, context | 32);
|
|
5773
|
+
declarationInitializer = parseExpression(parser, context | 131072, privateScope, 1, 0, parser.tokenStart);
|
|
5774
|
+
if ((parser.getToken() & 262144) === 262144) {
|
|
5775
|
+
throw new ParseError(ofStart, parser.currentLocation, 60, parser.getToken() === 471156 ? 'of' : 'in');
|
|
5776
|
+
}
|
|
5777
|
+
}
|
|
5778
|
+
else if (parser.getToken() !== 8673330) {
|
|
5779
|
+
parser.report(59, resourceDeclarationKind);
|
|
5780
|
+
}
|
|
5781
|
+
const declarations = [
|
|
5782
|
+
parser.finishNode({
|
|
5783
|
+
type: 'VariableDeclarator',
|
|
5784
|
+
id: ofIdentifier,
|
|
5785
|
+
init: declarationInitializer,
|
|
5786
|
+
}, ofStart),
|
|
5787
|
+
];
|
|
5788
|
+
const resourceNames = parser.options.lexical ? new Set([ofValue]) : undefined;
|
|
5789
|
+
while (consumeOpt(parser, context | 131072, 18)) {
|
|
5790
|
+
const declaration = parseVariableDeclaration(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind);
|
|
5791
|
+
if (resourceNames) {
|
|
5792
|
+
const { name } = declaration.id;
|
|
5793
|
+
if (resourceNames.has(name))
|
|
5794
|
+
parser.report(147, name);
|
|
5795
|
+
resourceNames.add(name);
|
|
5796
|
+
}
|
|
5797
|
+
declarations.push(declaration);
|
|
5798
|
+
}
|
|
5799
|
+
if (declarations.length > 1 && parser.getToken() & 262144) {
|
|
5800
|
+
parser.report(61, KeywordDescTable[parser.getToken() & 255]);
|
|
5801
|
+
}
|
|
5802
|
+
init = parser.finishNode({
|
|
5803
|
+
type: 'VariableDeclaration',
|
|
5804
|
+
kind: resourceDeclarationKind,
|
|
5805
|
+
declarations,
|
|
5806
|
+
}, tokenStart);
|
|
5807
|
+
parser.assignable = 1;
|
|
5808
|
+
}
|
|
5809
|
+
}
|
|
5810
|
+
else {
|
|
5811
|
+
resourceDeclarationKind = 'using';
|
|
5812
|
+
init = parser.finishNode({
|
|
5813
|
+
type: 'VariableDeclaration',
|
|
5814
|
+
kind: resourceDeclarationKind,
|
|
5815
|
+
declarations: parseVariableDeclarationList(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind),
|
|
5816
|
+
}, tokenStart);
|
|
5817
|
+
parser.assignable = 1;
|
|
5619
5818
|
}
|
|
5620
5819
|
}
|
|
5621
5820
|
else {
|
|
@@ -5634,6 +5833,42 @@
|
|
|
5634
5833
|
parser.assignable = 1;
|
|
5635
5834
|
}
|
|
5636
5835
|
}
|
|
5836
|
+
else if (token === 209006 &&
|
|
5837
|
+
(context & 2048 || (context & 2 && context & 8))) {
|
|
5838
|
+
if (context & 524288)
|
|
5839
|
+
parser.report(179);
|
|
5840
|
+
nextToken(parser, context | 32);
|
|
5841
|
+
let awaitArgument;
|
|
5842
|
+
if ((parser.flags & 1) === 0 && parser.getToken() === 209013) {
|
|
5843
|
+
const usingStart = parser.tokenStart;
|
|
5844
|
+
const usingIdentifier = parseIdentifier(parser, context);
|
|
5845
|
+
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5846
|
+
resourceDeclarationKind = 'await using';
|
|
5847
|
+
isVarDecl = true;
|
|
5848
|
+
init = parser.finishNode({
|
|
5849
|
+
type: 'VariableDeclaration',
|
|
5850
|
+
kind: resourceDeclarationKind,
|
|
5851
|
+
declarations: parseVariableDeclarationList(parser, context | 131072, scope, privateScope, 16, 32, resourceDeclarationKind),
|
|
5852
|
+
}, tokenStart);
|
|
5853
|
+
parser.assignable = 1;
|
|
5854
|
+
}
|
|
5855
|
+
else {
|
|
5856
|
+
awaitArgument = parseMemberOrUpdateExpression(parser, context, privateScope, usingIdentifier, 0, 0, usingStart);
|
|
5857
|
+
}
|
|
5858
|
+
}
|
|
5859
|
+
else {
|
|
5860
|
+
awaitArgument = parseLeftHandSideExpression(parser, context, privateScope, 0, 0, 1);
|
|
5861
|
+
}
|
|
5862
|
+
if (!isVarDecl) {
|
|
5863
|
+
if (parser.getToken() === 8391735)
|
|
5864
|
+
parser.report(33);
|
|
5865
|
+
parser.assignable = 2;
|
|
5866
|
+
init = parser.finishNode({
|
|
5867
|
+
type: 'AwaitExpression',
|
|
5868
|
+
argument: awaitArgument,
|
|
5869
|
+
}, tokenStart);
|
|
5870
|
+
}
|
|
5871
|
+
}
|
|
5637
5872
|
else if (token === 1074790417) {
|
|
5638
5873
|
if (forAwait)
|
|
5639
5874
|
parser.report(82);
|
|
@@ -5655,12 +5890,13 @@
|
|
|
5655
5890
|
else {
|
|
5656
5891
|
init = parseLeftHandSideExpression(parser, context | 131072, privateScope, 1, 0, 1);
|
|
5657
5892
|
}
|
|
5658
|
-
if ((parser.getToken() & 262144) === 262144) {
|
|
5659
|
-
if (parser.getToken() === 471156) {
|
|
5893
|
+
if (consumedForOfDelimiter || (parser.getToken() & 262144) === 262144) {
|
|
5894
|
+
if (consumedForOfDelimiter || parser.getToken() === 471156) {
|
|
5660
5895
|
if (parser.assignable & 2)
|
|
5661
5896
|
parser.report(80, forAwait ? 'await' : 'of');
|
|
5662
5897
|
reinterpretToPattern(parser, init);
|
|
5663
|
-
|
|
5898
|
+
if (!consumedForOfDelimiter)
|
|
5899
|
+
nextToken(parser, context | 32);
|
|
5664
5900
|
right = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5665
5901
|
consume(parser, context | 32, 16);
|
|
5666
5902
|
const body = parseIterationStatementBody(parser, context, scope, privateScope, labels);
|
|
@@ -5672,6 +5908,8 @@
|
|
|
5672
5908
|
await: forAwait,
|
|
5673
5909
|
}, start);
|
|
5674
5910
|
}
|
|
5911
|
+
if (resourceDeclarationKind)
|
|
5912
|
+
parser.report(30, 'in');
|
|
5675
5913
|
if (parser.assignable & 2)
|
|
5676
5914
|
parser.report(80, 'in');
|
|
5677
5915
|
reinterpretToPattern(parser, init);
|
|
@@ -5716,9 +5954,9 @@
|
|
|
5716
5954
|
}
|
|
5717
5955
|
function parseRestrictedIdentifier(parser, context, scope) {
|
|
5718
5956
|
if (!isValidIdentifier(context, parser.getToken()))
|
|
5719
|
-
parser.report(
|
|
5957
|
+
parser.report(120);
|
|
5720
5958
|
if ((parser.getToken() & 537079808) === 537079808)
|
|
5721
|
-
parser.report(
|
|
5959
|
+
parser.report(121);
|
|
5722
5960
|
scope?.addBlockName(context, parser.tokenValue, 8, 0);
|
|
5723
5961
|
return parseIdentifier(parser, context);
|
|
5724
5962
|
}
|
|
@@ -5726,6 +5964,8 @@
|
|
|
5726
5964
|
const start = parser.tokenStart;
|
|
5727
5965
|
nextToken(parser, context);
|
|
5728
5966
|
let source;
|
|
5967
|
+
let sourceParsed = false;
|
|
5968
|
+
let phase = null;
|
|
5729
5969
|
const { tokenStart } = parser;
|
|
5730
5970
|
let specifiers = [];
|
|
5731
5971
|
if (parser.getToken() === 134283267) {
|
|
@@ -5733,14 +5973,93 @@
|
|
|
5733
5973
|
}
|
|
5734
5974
|
else {
|
|
5735
5975
|
if (parser.getToken() & 143360) {
|
|
5736
|
-
const
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
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)) {
|
|
5744
6063
|
switch (parser.getToken()) {
|
|
5745
6064
|
case 8391476:
|
|
5746
6065
|
specifiers.push(parseImportNamespaceSpecifier(parser, context, scope));
|
|
@@ -5769,7 +6088,8 @@
|
|
|
5769
6088
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5770
6089
|
}
|
|
5771
6090
|
}
|
|
5772
|
-
|
|
6091
|
+
if (!sourceParsed)
|
|
6092
|
+
source = parseModuleSpecifier(parser, context);
|
|
5773
6093
|
}
|
|
5774
6094
|
const attributes = parseImportAttributes(parser, context);
|
|
5775
6095
|
const node = {
|
|
@@ -5777,6 +6097,7 @@
|
|
|
5777
6097
|
specifiers,
|
|
5778
6098
|
source,
|
|
5779
6099
|
attributes,
|
|
6100
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
5780
6101
|
};
|
|
5781
6102
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5782
6103
|
return parser.finishNode(node, start);
|
|
@@ -5859,17 +6180,24 @@
|
|
|
5859
6180
|
function parseExportDeclaration(parser, context, scope) {
|
|
5860
6181
|
const start = parser.leadingDecorators.decorators.length ? parser.leadingDecorators.start : parser.tokenStart;
|
|
5861
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
|
+
}
|
|
5862
6187
|
const specifiers = [];
|
|
5863
6188
|
let declaration = null;
|
|
5864
6189
|
let source = null;
|
|
5865
6190
|
let attributes = [];
|
|
5866
|
-
if (
|
|
6191
|
+
if (isDefaultExport) {
|
|
5867
6192
|
switch (parser.getToken()) {
|
|
5868
6193
|
case 86104: {
|
|
5869
6194
|
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 4, 1, 1, 0, parser.tokenStart);
|
|
5870
6195
|
break;
|
|
5871
6196
|
}
|
|
5872
|
-
case
|
|
6197
|
+
case 133:
|
|
6198
|
+
if (!(parser.features & 1)) {
|
|
6199
|
+
parser.report(30, '@');
|
|
6200
|
+
}
|
|
5873
6201
|
case 86094:
|
|
5874
6202
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 1);
|
|
5875
6203
|
break;
|
|
@@ -5982,7 +6310,7 @@
|
|
|
5982
6310
|
}
|
|
5983
6311
|
else {
|
|
5984
6312
|
if (hasLiteralLocal) {
|
|
5985
|
-
parser.report(
|
|
6313
|
+
parser.report(174);
|
|
5986
6314
|
}
|
|
5987
6315
|
if (scope) {
|
|
5988
6316
|
tmpExportedNames.forEach((n) => parser.declareUnboundVariable(n));
|
|
@@ -5992,7 +6320,10 @@
|
|
|
5992
6320
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5993
6321
|
break;
|
|
5994
6322
|
}
|
|
5995
|
-
case
|
|
6323
|
+
case 133:
|
|
6324
|
+
if (!(parser.features & 1)) {
|
|
6325
|
+
parser.report(30, '@');
|
|
6326
|
+
}
|
|
5996
6327
|
case 86094:
|
|
5997
6328
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
5998
6329
|
break;
|
|
@@ -6125,7 +6456,7 @@
|
|
|
6125
6456
|
t = parser.getToken();
|
|
6126
6457
|
precedence = t & 3840;
|
|
6127
6458
|
if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) {
|
|
6128
|
-
parser.report(
|
|
6459
|
+
parser.report(167);
|
|
6129
6460
|
}
|
|
6130
6461
|
if (precedence + ((t === 8391735) << 8) - ((bit === t) << 12) <= minPrecedence)
|
|
6131
6462
|
break;
|
|
@@ -6152,10 +6483,10 @@
|
|
|
6152
6483
|
parser.report(33);
|
|
6153
6484
|
if (context & 1 && unaryOperator === 16863276) {
|
|
6154
6485
|
if (arg.type === 'Identifier') {
|
|
6155
|
-
parser.report(
|
|
6486
|
+
parser.report(123);
|
|
6156
6487
|
}
|
|
6157
6488
|
else if (isPropertyWithPrivateFieldKey(arg)) {
|
|
6158
|
-
parser.report(
|
|
6489
|
+
parser.report(129);
|
|
6159
6490
|
}
|
|
6160
6491
|
}
|
|
6161
6492
|
parser.assignable = 2;
|
|
@@ -6208,7 +6539,7 @@
|
|
|
6208
6539
|
if (!canAssign)
|
|
6209
6540
|
parser.report(26);
|
|
6210
6541
|
if (parser.getToken() === 22)
|
|
6211
|
-
parser.report(
|
|
6542
|
+
parser.report(126);
|
|
6212
6543
|
let argument = null;
|
|
6213
6544
|
let delegate = false;
|
|
6214
6545
|
if ((parser.flags & 1) === 0) {
|
|
@@ -6235,17 +6566,17 @@
|
|
|
6235
6566
|
if (inGroup)
|
|
6236
6567
|
parser.destructible |= 128;
|
|
6237
6568
|
if (context & 524288)
|
|
6238
|
-
parser.report(
|
|
6569
|
+
parser.report(179);
|
|
6239
6570
|
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope);
|
|
6240
6571
|
const isIdentifier = possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
|
|
6241
6572
|
(parser.getToken() & 65536) === 0;
|
|
6242
6573
|
if (isIdentifier) {
|
|
6243
6574
|
if (context & 2048)
|
|
6244
|
-
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);
|
|
6245
6576
|
if (context & 2)
|
|
6246
|
-
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);
|
|
6247
6578
|
if (context & 8192 && context & 2048)
|
|
6248
|
-
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);
|
|
6249
6580
|
return possibleIdentifierOrArrowFunc;
|
|
6250
6581
|
}
|
|
6251
6582
|
if (context & 8192) {
|
|
@@ -6269,6 +6600,7 @@
|
|
|
6269
6600
|
}
|
|
6270
6601
|
function parseFunctionBody(parser, context, scope, privateScope, origin, funcNameToken, functionScope) {
|
|
6271
6602
|
const { tokenStart } = parser;
|
|
6603
|
+
parser.flags &= -4161;
|
|
6272
6604
|
consume(parser, context | 32, 2162700);
|
|
6273
6605
|
const body = [];
|
|
6274
6606
|
if (parser.getToken() !== 1074790415) {
|
|
@@ -6294,19 +6626,19 @@
|
|
|
6294
6626
|
if (context & 1) {
|
|
6295
6627
|
if (funcNameToken) {
|
|
6296
6628
|
if ((funcNameToken & 537079808) === 537079808) {
|
|
6297
|
-
parser.report(
|
|
6629
|
+
parser.report(121);
|
|
6298
6630
|
}
|
|
6299
6631
|
if ((funcNameToken & 36864) === 36864) {
|
|
6300
6632
|
parser.report(40);
|
|
6301
6633
|
}
|
|
6302
6634
|
}
|
|
6303
6635
|
if (parser.flags & 512)
|
|
6304
|
-
parser.report(
|
|
6636
|
+
parser.report(121);
|
|
6305
6637
|
if (parser.flags & 256) {
|
|
6306
6638
|
if (parser.strictReservedRange) {
|
|
6307
|
-
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1],
|
|
6639
|
+
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 120);
|
|
6308
6640
|
}
|
|
6309
|
-
parser.report(
|
|
6641
|
+
parser.report(120);
|
|
6310
6642
|
}
|
|
6311
6643
|
}
|
|
6312
6644
|
}
|
|
@@ -6330,8 +6662,8 @@
|
|
|
6330
6662
|
const { tokenStart } = parser;
|
|
6331
6663
|
nextToken(parser, context);
|
|
6332
6664
|
switch (parser.getToken()) {
|
|
6333
|
-
case
|
|
6334
|
-
parser.report(
|
|
6665
|
+
case 67108991:
|
|
6666
|
+
parser.report(169);
|
|
6335
6667
|
case 67174411: {
|
|
6336
6668
|
if ((context & 512) === 0)
|
|
6337
6669
|
parser.report(28);
|
|
@@ -6377,10 +6709,13 @@
|
|
|
6377
6709
|
switch (parser.getToken()) {
|
|
6378
6710
|
case 67108877: {
|
|
6379
6711
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6380
|
-
if (context & 16 && parser.getToken() ===
|
|
6381
|
-
parser.report(
|
|
6712
|
+
if (context & 16 && parser.getToken() === 131 && parser.tokenValue === 'super') {
|
|
6713
|
+
parser.report(175);
|
|
6382
6714
|
}
|
|
6383
|
-
parser.assignable =
|
|
6715
|
+
parser.assignable =
|
|
6716
|
+
(parser.flags & 2048) === 2048
|
|
6717
|
+
? 2
|
|
6718
|
+
: 1;
|
|
6384
6719
|
const property = parsePropertyOrPrivatePropertyName(parser, context | 64, privateScope);
|
|
6385
6720
|
expr = parser.finishNode({
|
|
6386
6721
|
type: 'MemberExpression',
|
|
@@ -6405,7 +6740,7 @@
|
|
|
6405
6740
|
const { tokenStart } = parser;
|
|
6406
6741
|
const property = parseExpressions(parser, context, privateScope, inGroup, 1, tokenStart);
|
|
6407
6742
|
consume(parser, context, 20);
|
|
6408
|
-
parser.assignable = 1;
|
|
6743
|
+
parser.assignable = restoreHasOptionalChaining ? 2 : 1;
|
|
6409
6744
|
expr = parser.finishNode({
|
|
6410
6745
|
type: 'MemberExpression',
|
|
6411
6746
|
object: expr,
|
|
@@ -6446,7 +6781,7 @@
|
|
|
6446
6781
|
}
|
|
6447
6782
|
break;
|
|
6448
6783
|
}
|
|
6449
|
-
case
|
|
6784
|
+
case 67108991: {
|
|
6450
6785
|
nextToken(parser, (context | 262144 | 8) ^ 8);
|
|
6451
6786
|
parser.flags |= 2048;
|
|
6452
6787
|
parser.assignable = 2;
|
|
@@ -6455,7 +6790,7 @@
|
|
|
6455
6790
|
}
|
|
6456
6791
|
default:
|
|
6457
6792
|
if ((parser.flags & 2048) === 2048) {
|
|
6458
|
-
parser.report(
|
|
6793
|
+
parser.report(168);
|
|
6459
6794
|
}
|
|
6460
6795
|
parser.assignable = 2;
|
|
6461
6796
|
expr = parser.finishNode({
|
|
@@ -6533,12 +6868,12 @@
|
|
|
6533
6868
|
}
|
|
6534
6869
|
function parsePropertyOrPrivatePropertyName(parser, context, privateScope) {
|
|
6535
6870
|
if ((parser.getToken() & 143360) === 0 &&
|
|
6536
|
-
parser.getToken() !== -2147483528 &&
|
|
6537
6871
|
parser.getToken() !== -2147483527 &&
|
|
6538
|
-
parser.getToken() !==
|
|
6539
|
-
parser.
|
|
6872
|
+
parser.getToken() !== -2147483526 &&
|
|
6873
|
+
parser.getToken() !== 131) {
|
|
6874
|
+
parser.report(162);
|
|
6540
6875
|
}
|
|
6541
|
-
return parser.getToken() ===
|
|
6876
|
+
return parser.getToken() === 131
|
|
6542
6877
|
? parsePrivateIdentifier(parser, context, privateScope, 0)
|
|
6543
6878
|
: parseIdentifier(parser, context);
|
|
6544
6879
|
}
|
|
@@ -6587,10 +6922,10 @@
|
|
|
6587
6922
|
!(context & 32768) &&
|
|
6588
6923
|
!(context & 8192) &&
|
|
6589
6924
|
parser.tokenValue === 'arguments')
|
|
6590
|
-
parser.report(
|
|
6925
|
+
parser.report(132);
|
|
6591
6926
|
if ((token & 255) === (241737 & 255)) {
|
|
6592
6927
|
if (context & 1)
|
|
6593
|
-
parser.report(
|
|
6928
|
+
parser.report(115);
|
|
6594
6929
|
if (kind & (8 | 16))
|
|
6595
6930
|
parser.report(100);
|
|
6596
6931
|
}
|
|
@@ -6631,7 +6966,10 @@
|
|
|
6631
6966
|
return parseThisExpression(parser, context);
|
|
6632
6967
|
case 65540:
|
|
6633
6968
|
return parseRegExpLiteral(parser, context);
|
|
6634
|
-
case
|
|
6969
|
+
case 133:
|
|
6970
|
+
if (!(parser.features & 1)) {
|
|
6971
|
+
parser.report(30, '@');
|
|
6972
|
+
}
|
|
6635
6973
|
case 86094:
|
|
6636
6974
|
return parseClassExpression(parser, context, privateScope, inGroup, start);
|
|
6637
6975
|
case 86109:
|
|
@@ -6642,9 +6980,9 @@
|
|
|
6642
6980
|
return parseTemplate(parser, context, privateScope);
|
|
6643
6981
|
case 86107:
|
|
6644
6982
|
return parseNewExpression(parser, context, privateScope, inGroup);
|
|
6645
|
-
case
|
|
6983
|
+
case 134283389:
|
|
6646
6984
|
return parseBigIntLiteral(parser, context);
|
|
6647
|
-
case
|
|
6985
|
+
case 131:
|
|
6648
6986
|
return parsePrivateIdentifier(parser, context, privateScope, 0);
|
|
6649
6987
|
case 86106:
|
|
6650
6988
|
return parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start);
|
|
@@ -6660,24 +6998,37 @@
|
|
|
6660
6998
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6661
6999
|
let expr = parseIdentifier(parser, context);
|
|
6662
7000
|
if (parser.getToken() === 67108877) {
|
|
6663
|
-
return parseImportMetaExpression(parser, context, expr, start);
|
|
7001
|
+
return parseImportMetaExpression(parser, context, expr, start, privateScope, inGroup, inNew);
|
|
6664
7002
|
}
|
|
6665
7003
|
if (inNew)
|
|
6666
|
-
parser.report(
|
|
7004
|
+
parser.report(144);
|
|
6667
7005
|
expr = parseImportExpression(parser, context, privateScope, inGroup, start);
|
|
6668
7006
|
parser.assignable = 2;
|
|
6669
7007
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6670
7008
|
}
|
|
6671
|
-
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6672
|
-
|
|
6673
|
-
|
|
7009
|
+
function parseImportMetaExpression(parser, context, meta, start, privateScope, inGroup = 0, inNew = 0) {
|
|
7010
|
+
const propertyStart = parser.tokenStart;
|
|
7011
|
+
const propertyEnd = parser.currentLocation;
|
|
6674
7012
|
nextToken(parser, context);
|
|
6675
7013
|
const token = parser.getToken();
|
|
6676
|
-
|
|
6677
|
-
|
|
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
|
+
}
|
|
7027
|
+
if (token !== 209031 && parser.tokenValue !== 'meta') {
|
|
7028
|
+
parser.report(176);
|
|
6678
7029
|
}
|
|
6679
7030
|
else if (token & -2147483648) {
|
|
6680
|
-
parser.report(
|
|
7031
|
+
parser.report(177);
|
|
6681
7032
|
}
|
|
6682
7033
|
parser.assignable = 2;
|
|
6683
7034
|
return parser.finishNode({
|
|
@@ -6686,10 +7037,10 @@
|
|
|
6686
7037
|
property: parseIdentifier(parser, context),
|
|
6687
7038
|
}, start);
|
|
6688
7039
|
}
|
|
6689
|
-
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
7040
|
+
function parseImportExpression(parser, context, privateScope, inGroup, start, phase = null) {
|
|
6690
7041
|
consume(parser, context | 32, 67174411);
|
|
6691
7042
|
if (parser.getToken() === 14)
|
|
6692
|
-
parser.report(
|
|
7043
|
+
parser.report(145);
|
|
6693
7044
|
const source = parseExpression(parser, context, privateScope, 1, inGroup, parser.tokenStart);
|
|
6694
7045
|
let options = null;
|
|
6695
7046
|
if (parser.getToken() === 18) {
|
|
@@ -6704,6 +7055,7 @@
|
|
|
6704
7055
|
type: 'ImportExpression',
|
|
6705
7056
|
source,
|
|
6706
7057
|
options,
|
|
7058
|
+
...(parser.features & 2 || parser.features & 4 ? { phase } : null),
|
|
6707
7059
|
};
|
|
6708
7060
|
consume(parser, context, 16);
|
|
6709
7061
|
return parser.finishNode(node, start);
|
|
@@ -6721,7 +7073,7 @@
|
|
|
6721
7073
|
const value = parseStringLiteral(parser, context);
|
|
6722
7074
|
const keyContent = key.type === 'Literal' ? key.value : key.name;
|
|
6723
7075
|
if (keysContent.has(keyContent)) {
|
|
6724
|
-
parser.report(
|
|
7076
|
+
parser.report(147, keyContent);
|
|
6725
7077
|
}
|
|
6726
7078
|
keysContent.add(keyContent);
|
|
6727
7079
|
attributes.push(parser.finishNode({
|
|
@@ -6759,7 +7111,7 @@
|
|
|
6759
7111
|
if (parser.getToken() === 134283267) {
|
|
6760
7112
|
const value = parser.tokenValue;
|
|
6761
7113
|
if (!value.isWellFormed()) {
|
|
6762
|
-
parser.report(
|
|
7114
|
+
parser.report(173);
|
|
6763
7115
|
}
|
|
6764
7116
|
return parseLiteral(parser, context);
|
|
6765
7117
|
}
|
|
@@ -6897,7 +7249,7 @@
|
|
|
6897
7249
|
}
|
|
6898
7250
|
function parseLiteral(parser, context) {
|
|
6899
7251
|
const { tokenValue, tokenRaw, tokenStart } = parser;
|
|
6900
|
-
if (parser.getToken() ===
|
|
7252
|
+
if (parser.getToken() === 134283389) {
|
|
6901
7253
|
return parseBigIntLiteral(parser, context);
|
|
6902
7254
|
}
|
|
6903
7255
|
const node = {
|
|
@@ -7320,7 +7672,7 @@
|
|
|
7320
7672
|
}
|
|
7321
7673
|
parser.destructible = destructible;
|
|
7322
7674
|
if (parser.getToken() !== closingToken && parser.getToken() !== 18)
|
|
7323
|
-
parser.report(
|
|
7675
|
+
parser.report(163);
|
|
7324
7676
|
return parser.finishNode({
|
|
7325
7677
|
type: isPattern ? 'RestElement' : 'SpreadElement',
|
|
7326
7678
|
argument: argument,
|
|
@@ -7414,9 +7766,9 @@
|
|
|
7414
7766
|
let key = null;
|
|
7415
7767
|
let value;
|
|
7416
7768
|
if (parser.getToken() & 143360 ||
|
|
7417
|
-
parser.getToken() === -
|
|
7418
|
-
parser.getToken() === -
|
|
7419
|
-
if (parser.getToken() === -
|
|
7769
|
+
parser.getToken() === -2147483527 ||
|
|
7770
|
+
parser.getToken() === -2147483526) {
|
|
7771
|
+
if (parser.getToken() === -2147483526)
|
|
7420
7772
|
destructible |= 16;
|
|
7421
7773
|
key = parseIdentifier(parser, context);
|
|
7422
7774
|
if (parser.getToken() === 18 ||
|
|
@@ -7448,7 +7800,7 @@
|
|
|
7448
7800
|
else {
|
|
7449
7801
|
destructible |=
|
|
7450
7802
|
(token === 209006 ? 128 : 0) |
|
|
7451
|
-
(token === -
|
|
7803
|
+
(token === -2147483527 ? 16 : 0);
|
|
7452
7804
|
value = parser.cloneIdentifier(key);
|
|
7453
7805
|
}
|
|
7454
7806
|
}
|
|
@@ -7575,11 +7927,11 @@
|
|
|
7575
7927
|
}
|
|
7576
7928
|
else if (parser.getToken() & 143360) {
|
|
7577
7929
|
destructible |= 16;
|
|
7578
|
-
if (token === -
|
|
7930
|
+
if (token === -2147483527)
|
|
7579
7931
|
parser.report(95);
|
|
7580
7932
|
if (token === 209005) {
|
|
7581
7933
|
if (parser.flags & 1)
|
|
7582
|
-
parser.report(
|
|
7934
|
+
parser.report(134);
|
|
7583
7935
|
state |= 16 | 1;
|
|
7584
7936
|
}
|
|
7585
7937
|
else if (token === 209008) {
|
|
@@ -7643,7 +7995,7 @@
|
|
|
7643
7995
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7644
7996
|
}
|
|
7645
7997
|
else {
|
|
7646
|
-
parser.report(
|
|
7998
|
+
parser.report(135);
|
|
7647
7999
|
}
|
|
7648
8000
|
}
|
|
7649
8001
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -7747,7 +8099,7 @@
|
|
|
7747
8099
|
destructible = 16;
|
|
7748
8100
|
}
|
|
7749
8101
|
else {
|
|
7750
|
-
parser.report(
|
|
8102
|
+
parser.report(136);
|
|
7751
8103
|
}
|
|
7752
8104
|
}
|
|
7753
8105
|
else if (parser.getToken() === 69271571) {
|
|
@@ -7894,7 +8246,7 @@
|
|
|
7894
8246
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7895
8247
|
}
|
|
7896
8248
|
else {
|
|
7897
|
-
parser.report(
|
|
8249
|
+
parser.report(128);
|
|
7898
8250
|
}
|
|
7899
8251
|
}
|
|
7900
8252
|
else {
|
|
@@ -8072,7 +8424,7 @@
|
|
|
8072
8424
|
parser.assignable = 2;
|
|
8073
8425
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8074
8426
|
if (destructible & 8)
|
|
8075
|
-
parser.report(
|
|
8427
|
+
parser.report(124);
|
|
8076
8428
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8077
8429
|
destructible |= 16;
|
|
8078
8430
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
@@ -8145,7 +8497,7 @@
|
|
|
8145
8497
|
}
|
|
8146
8498
|
consume(parser, context, 16);
|
|
8147
8499
|
if (destructible & 16 && destructible & 8)
|
|
8148
|
-
parser.report(
|
|
8500
|
+
parser.report(153);
|
|
8149
8501
|
destructible |=
|
|
8150
8502
|
parser.destructible & 256
|
|
8151
8503
|
? 256
|
|
@@ -8170,7 +8522,7 @@
|
|
|
8170
8522
|
parser.report(63);
|
|
8171
8523
|
}
|
|
8172
8524
|
if (destructible & 8) {
|
|
8173
|
-
parser.report(
|
|
8525
|
+
parser.report(146);
|
|
8174
8526
|
}
|
|
8175
8527
|
parser.destructible = ((parser.destructible | 256) ^ 256) | destructible;
|
|
8176
8528
|
return parser.options.preserveParens
|
|
@@ -8241,17 +8593,17 @@
|
|
|
8241
8593
|
switch (parser.getToken()) {
|
|
8242
8594
|
case 69271571:
|
|
8243
8595
|
if ((parser.flags & 1) === 0) {
|
|
8244
|
-
parser.report(
|
|
8596
|
+
parser.report(118);
|
|
8245
8597
|
}
|
|
8246
8598
|
parser.flags |= 8192;
|
|
8247
8599
|
break;
|
|
8248
8600
|
case 67108877:
|
|
8249
8601
|
case 67174409:
|
|
8250
8602
|
case 22:
|
|
8251
|
-
parser.report(
|
|
8603
|
+
parser.report(119);
|
|
8252
8604
|
case 67174411:
|
|
8253
8605
|
if ((parser.flags & 1) === 0) {
|
|
8254
|
-
parser.report(
|
|
8606
|
+
parser.report(118);
|
|
8255
8607
|
}
|
|
8256
8608
|
parser.flags |= 1024;
|
|
8257
8609
|
break;
|
|
@@ -8259,7 +8611,7 @@
|
|
|
8259
8611
|
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0)
|
|
8260
8612
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
8261
8613
|
if ((parser.getToken() & 33619968) === 33619968)
|
|
8262
|
-
parser.report(
|
|
8614
|
+
parser.report(127);
|
|
8263
8615
|
}
|
|
8264
8616
|
parser.assignable = 2;
|
|
8265
8617
|
return parser.finishNode({
|
|
@@ -8386,7 +8738,7 @@
|
|
|
8386
8738
|
const id = parseIdentifier(parser, context | 32);
|
|
8387
8739
|
const { tokenStart } = parser;
|
|
8388
8740
|
if (consumeOpt(parser, context, 67108877)) {
|
|
8389
|
-
if (context & 65536 && parser.getToken() ===
|
|
8741
|
+
if (context & 65536 && parser.getToken() === 209030) {
|
|
8390
8742
|
parser.assignable = 2;
|
|
8391
8743
|
return parseMetaProperty(parser, context, id, start);
|
|
8392
8744
|
}
|
|
@@ -8398,8 +8750,8 @@
|
|
|
8398
8750
|
}
|
|
8399
8751
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
8400
8752
|
context = (context | 131072) ^ 131072;
|
|
8401
|
-
if (parser.getToken() ===
|
|
8402
|
-
parser.report(
|
|
8753
|
+
if (parser.getToken() === 67108991)
|
|
8754
|
+
parser.report(170);
|
|
8403
8755
|
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
8404
8756
|
parser.assignable = 2;
|
|
8405
8757
|
return parser.finishNode({
|
|
@@ -8498,7 +8850,7 @@
|
|
|
8498
8850
|
isNonSimpleParameterList = 1;
|
|
8499
8851
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
8500
8852
|
if (destructible & 8)
|
|
8501
|
-
parser.report(
|
|
8853
|
+
parser.report(124);
|
|
8502
8854
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, tokenStart);
|
|
8503
8855
|
destructible |= 16;
|
|
8504
8856
|
if ((parser.getToken() & 8388608) === 8388608) {
|
|
@@ -8599,9 +8951,6 @@
|
|
|
8599
8951
|
let start;
|
|
8600
8952
|
let decorators;
|
|
8601
8953
|
if (parser.leadingDecorators.decorators.length) {
|
|
8602
|
-
if (parser.getToken() === 132) {
|
|
8603
|
-
parser.report(30, '@');
|
|
8604
|
-
}
|
|
8605
8954
|
start = parser.leadingDecorators.start;
|
|
8606
8955
|
decorators = [...parser.leadingDecorators.decorators];
|
|
8607
8956
|
parser.leadingDecorators.decorators.length = 0;
|
|
@@ -8611,16 +8960,16 @@
|
|
|
8611
8960
|
decorators = parseDecorators(parser, context, privateScope);
|
|
8612
8961
|
}
|
|
8613
8962
|
context = (context | 16384 | 1) ^ 16384;
|
|
8614
|
-
|
|
8963
|
+
consume(parser, context, 86094);
|
|
8615
8964
|
let id = null;
|
|
8616
8965
|
let superClass = null;
|
|
8617
8966
|
const { tokenValue } = parser;
|
|
8618
8967
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8619
8968
|
if (isStrictReservedWord(parser, context, parser.getToken())) {
|
|
8620
|
-
parser.report(
|
|
8969
|
+
parser.report(120);
|
|
8621
8970
|
}
|
|
8622
8971
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8623
|
-
parser.report(
|
|
8972
|
+
parser.report(121);
|
|
8624
8973
|
}
|
|
8625
8974
|
if (scope) {
|
|
8626
8975
|
scope.addBlockName(context, tokenValue, 32, 0);
|
|
@@ -8650,7 +8999,7 @@
|
|
|
8650
8999
|
id,
|
|
8651
9000
|
superClass,
|
|
8652
9001
|
body,
|
|
8653
|
-
...(parser.
|
|
9002
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8654
9003
|
}, start);
|
|
8655
9004
|
}
|
|
8656
9005
|
function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
@@ -8658,12 +9007,12 @@
|
|
|
8658
9007
|
let superClass = null;
|
|
8659
9008
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8660
9009
|
context = (context | 1 | 16384) ^ 16384;
|
|
8661
|
-
|
|
9010
|
+
consume(parser, context, 86094);
|
|
8662
9011
|
if (parser.getToken() & 4096 && parser.getToken() !== 20565) {
|
|
8663
9012
|
if (isStrictReservedWord(parser, context, parser.getToken()))
|
|
8664
|
-
parser.report(
|
|
9013
|
+
parser.report(120);
|
|
8665
9014
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
8666
|
-
parser.report(
|
|
9015
|
+
parser.report(121);
|
|
8667
9016
|
}
|
|
8668
9017
|
id = parseIdentifier(parser, context);
|
|
8669
9018
|
}
|
|
@@ -8682,24 +9031,61 @@
|
|
|
8682
9031
|
id,
|
|
8683
9032
|
superClass,
|
|
8684
9033
|
body,
|
|
8685
|
-
...(parser.
|
|
9034
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8686
9035
|
}, start);
|
|
8687
9036
|
}
|
|
8688
9037
|
function parseDecorators(parser, context, privateScope) {
|
|
8689
9038
|
const list = [];
|
|
8690
|
-
if (parser.
|
|
8691
|
-
while (parser.getToken() ===
|
|
8692
|
-
list.push(
|
|
9039
|
+
if (parser.features & 1) {
|
|
9040
|
+
while (parser.getToken() === 133) {
|
|
9041
|
+
list.push(parseDecorator(parser, context, privateScope));
|
|
8693
9042
|
}
|
|
8694
9043
|
}
|
|
8695
9044
|
return list;
|
|
8696
9045
|
}
|
|
8697
|
-
function
|
|
9046
|
+
function parseDecorator(parser, context, privateScope) {
|
|
8698
9047
|
const start = parser.tokenStart;
|
|
8699
9048
|
nextToken(parser, context | 32);
|
|
8700
9049
|
const expressionStart = parser.tokenStart;
|
|
8701
|
-
let expression
|
|
8702
|
-
|
|
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
|
+
}
|
|
8703
9089
|
return parser.finishNode({
|
|
8704
9090
|
type: 'Decorator',
|
|
8705
9091
|
expression,
|
|
@@ -8718,13 +9104,13 @@
|
|
|
8718
9104
|
const decoratorStart = parser.tokenStart;
|
|
8719
9105
|
const decorators = parseDecorators(parser, context, privateScope);
|
|
8720
9106
|
if (decorators.length > 0 && parser.tokenValue === 'constructor') {
|
|
8721
|
-
parser.report(
|
|
9107
|
+
parser.report(111);
|
|
8722
9108
|
}
|
|
8723
9109
|
if (parser.getToken() === 1074790415)
|
|
8724
|
-
parser.report(
|
|
9110
|
+
parser.report(110);
|
|
8725
9111
|
if (consumeOpt(parser, context, 1074790417)) {
|
|
8726
9112
|
if (decorators.length > 0)
|
|
8727
|
-
parser.report(
|
|
9113
|
+
parser.report(122);
|
|
8728
9114
|
continue;
|
|
8729
9115
|
}
|
|
8730
9116
|
body.push(parseClassElementList(parser, context, scope, privateScope, inheritedContext, kind, decorators, 0, inGroup, decorators.length > 0 ? decoratorStart : parser.tokenStart));
|
|
@@ -8741,7 +9127,7 @@
|
|
|
8741
9127
|
let kind = isStatic ? 32 : 0;
|
|
8742
9128
|
let key = null;
|
|
8743
9129
|
const token = parser.getToken();
|
|
8744
|
-
if (token & (143360 | 36864) || token === -
|
|
9130
|
+
if (token & (143360 | 36864) || token === -2147483527) {
|
|
8745
9131
|
key = parseIdentifier(parser, context);
|
|
8746
9132
|
switch (token) {
|
|
8747
9133
|
case 36970:
|
|
@@ -8787,7 +9173,7 @@
|
|
|
8787
9173
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
8788
9174
|
return parsePropertyDefinition(parser, context, privateScope, key, kind, decorators, start);
|
|
8789
9175
|
}
|
|
8790
|
-
if (parser.
|
|
9176
|
+
if (parser.features & 1)
|
|
8791
9177
|
kind |= 1024;
|
|
8792
9178
|
}
|
|
8793
9179
|
break;
|
|
@@ -8804,7 +9190,7 @@
|
|
|
8804
9190
|
kind |= 8;
|
|
8805
9191
|
nextToken(parser, context);
|
|
8806
9192
|
}
|
|
8807
|
-
else if (parser.getToken() ===
|
|
9193
|
+
else if (parser.getToken() === 131) {
|
|
8808
9194
|
kind |= 8192;
|
|
8809
9195
|
key = parsePrivateIdentifier(parser, context | 16, privateScope, 768);
|
|
8810
9196
|
}
|
|
@@ -8814,7 +9200,7 @@
|
|
|
8814
9200
|
else if (isStatic && token === 2162700) {
|
|
8815
9201
|
return parseStaticBlock(parser, context | 16, scope, privateScope, start);
|
|
8816
9202
|
}
|
|
8817
|
-
else if (token === -
|
|
9203
|
+
else if (token === -2147483526) {
|
|
8818
9204
|
key = parseIdentifier(parser, context);
|
|
8819
9205
|
if (parser.getToken() !== 67174411)
|
|
8820
9206
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -8824,8 +9210,8 @@
|
|
|
8824
9210
|
}
|
|
8825
9211
|
if (kind & (8 | 16 | 768 | 1024)) {
|
|
8826
9212
|
if (parser.getToken() & 143360 ||
|
|
8827
|
-
parser.getToken() === -
|
|
8828
|
-
parser.getToken() === -
|
|
9213
|
+
parser.getToken() === -2147483527 ||
|
|
9214
|
+
parser.getToken() === -2147483526) {
|
|
8829
9215
|
key = parseIdentifier(parser, context);
|
|
8830
9216
|
}
|
|
8831
9217
|
else if ((parser.getToken() & 134217728) === 134217728) {
|
|
@@ -8835,17 +9221,17 @@
|
|
|
8835
9221
|
kind |= 2;
|
|
8836
9222
|
key = parseComputedPropertyName(parser, context, privateScope, 0);
|
|
8837
9223
|
}
|
|
8838
|
-
else if (parser.getToken() ===
|
|
9224
|
+
else if (parser.getToken() === 131) {
|
|
8839
9225
|
kind |= 8192;
|
|
8840
9226
|
key = parsePrivateIdentifier(parser, context, privateScope, kind);
|
|
8841
9227
|
}
|
|
8842
9228
|
else
|
|
8843
|
-
parser.report(
|
|
9229
|
+
parser.report(137);
|
|
8844
9230
|
}
|
|
8845
9231
|
if ((kind & 2) === 0) {
|
|
8846
9232
|
if (parser.tokenValue === 'constructor') {
|
|
8847
9233
|
if ((parser.getToken() & 1073741824) === 1073741824) {
|
|
8848
|
-
parser.report(
|
|
9234
|
+
parser.report(131);
|
|
8849
9235
|
}
|
|
8850
9236
|
else if ((kind & 32) === 0 && parser.getToken() === 67174411) {
|
|
8851
9237
|
if (kind & (768 | 16 | 128 | 8)) {
|
|
@@ -8883,7 +9269,7 @@
|
|
|
8883
9269
|
computed: (kind & 2) > 0,
|
|
8884
9270
|
key,
|
|
8885
9271
|
value,
|
|
8886
|
-
...(parser.
|
|
9272
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8887
9273
|
}, start);
|
|
8888
9274
|
}
|
|
8889
9275
|
function parsePrivateIdentifier(parser, context, privateScope, kind) {
|
|
@@ -8891,7 +9277,7 @@
|
|
|
8891
9277
|
nextToken(parser, context);
|
|
8892
9278
|
const { tokenValue } = parser;
|
|
8893
9279
|
if (tokenValue === 'constructor')
|
|
8894
|
-
parser.report(
|
|
9280
|
+
parser.report(130);
|
|
8895
9281
|
if (parser.options.lexical) {
|
|
8896
9282
|
if (!privateScope)
|
|
8897
9283
|
parser.report(4, tokenValue);
|
|
@@ -8915,8 +9301,8 @@
|
|
|
8915
9301
|
if (parser.getToken() === 1077936155) {
|
|
8916
9302
|
nextToken(parser, context | 32);
|
|
8917
9303
|
const { tokenStart } = parser;
|
|
8918
|
-
if (parser.getToken() ===
|
|
8919
|
-
parser.report(
|
|
9304
|
+
if (parser.getToken() === 537079928)
|
|
9305
|
+
parser.report(121);
|
|
8920
9306
|
const modifierFlags = 1024 |
|
|
8921
9307
|
2048 |
|
|
8922
9308
|
8192 |
|
|
@@ -8942,12 +9328,12 @@
|
|
|
8942
9328
|
value,
|
|
8943
9329
|
static: (state & 32) > 0,
|
|
8944
9330
|
computed: (state & 2) > 0,
|
|
8945
|
-
...(parser.
|
|
9331
|
+
...(parser.features & 1 ? { decorators } : null),
|
|
8946
9332
|
}, start);
|
|
8947
9333
|
}
|
|
8948
9334
|
function parseBindingPattern(parser, context, scope, privateScope, type, origin) {
|
|
8949
9335
|
if (parser.getToken() & 143360 ||
|
|
8950
|
-
((context & 1) === 0 && parser.getToken() === -
|
|
9336
|
+
((context & 1) === 0 && parser.getToken() === -2147483526))
|
|
8951
9337
|
return parseAndClassifyIdentifier(parser, context, scope, type, origin);
|
|
8952
9338
|
if ((parser.getToken() & 2097152) !== 2097152)
|
|
8953
9339
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -8964,10 +9350,10 @@
|
|
|
8964
9350
|
const token = parser.getToken();
|
|
8965
9351
|
if (context & 1) {
|
|
8966
9352
|
if ((token & 537079808) === 537079808) {
|
|
8967
|
-
parser.report(
|
|
9353
|
+
parser.report(121);
|
|
8968
9354
|
}
|
|
8969
|
-
else if ((token & 36864) === 36864 || token === -
|
|
8970
|
-
parser.report(
|
|
9355
|
+
else if ((token & 36864) === 36864 || token === -2147483526) {
|
|
9356
|
+
parser.report(120);
|
|
8971
9357
|
}
|
|
8972
9358
|
}
|
|
8973
9359
|
if ((token & 20480) === 20480) {
|
|
@@ -8977,7 +9363,7 @@
|
|
|
8977
9363
|
if (context & 1024)
|
|
8978
9364
|
parser.report(32);
|
|
8979
9365
|
if (context & 2)
|
|
8980
|
-
parser.report(
|
|
9366
|
+
parser.report(113);
|
|
8981
9367
|
}
|
|
8982
9368
|
if ((token & 255) === (241737 & 255)) {
|
|
8983
9369
|
if (kind & (8 | 16))
|
|
@@ -8985,9 +9371,9 @@
|
|
|
8985
9371
|
}
|
|
8986
9372
|
if (token === 209006) {
|
|
8987
9373
|
if (context & 2048)
|
|
8988
|
-
parser.report(
|
|
9374
|
+
parser.report(178);
|
|
8989
9375
|
if (context & 2)
|
|
8990
|
-
parser.report(
|
|
9376
|
+
parser.report(112);
|
|
8991
9377
|
}
|
|
8992
9378
|
const { tokenValue, tokenStart: start } = parser;
|
|
8993
9379
|
nextToken(parser, context);
|
|
@@ -9019,7 +9405,7 @@
|
|
|
9019
9405
|
[children, closingElement] = parseJSXChildrenAndClosingElement(parser, context, privateScope, inJSXChild);
|
|
9020
9406
|
const close = isEqualTagName(closingElement.name);
|
|
9021
9407
|
if (isEqualTagName(openingElement.name) !== close)
|
|
9022
|
-
parser.report(
|
|
9408
|
+
parser.report(157, close);
|
|
9023
9409
|
}
|
|
9024
9410
|
return parser.finishNode({
|
|
9025
9411
|
type: 'JSXElement',
|
|
@@ -9087,7 +9473,7 @@
|
|
|
9087
9473
|
}
|
|
9088
9474
|
}
|
|
9089
9475
|
function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild) {
|
|
9090
|
-
if (parser.getToken() ===
|
|
9476
|
+
if (parser.getToken() === 138)
|
|
9091
9477
|
return parseJSXText(parser, context);
|
|
9092
9478
|
if (parser.getToken() === 2162700)
|
|
9093
9479
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
@@ -9101,7 +9487,7 @@
|
|
|
9101
9487
|
parser.report(0);
|
|
9102
9488
|
}
|
|
9103
9489
|
function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChild) {
|
|
9104
|
-
if (parser.getToken() ===
|
|
9490
|
+
if (parser.getToken() === 138)
|
|
9105
9491
|
return parseJSXText(parser, context);
|
|
9106
9492
|
if (parser.getToken() === 2162700)
|
|
9107
9493
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
@@ -9214,7 +9600,7 @@
|
|
|
9214
9600
|
value = parseJSXExpressionContainer(parser, context, privateScope, 0, 1);
|
|
9215
9601
|
break;
|
|
9216
9602
|
default:
|
|
9217
|
-
parser.report(
|
|
9603
|
+
parser.report(156);
|
|
9218
9604
|
}
|
|
9219
9605
|
}
|
|
9220
9606
|
return parser.finishNode({
|
|
@@ -9241,7 +9627,7 @@
|
|
|
9241
9627
|
let expression;
|
|
9242
9628
|
if (parser.getToken() === 1074790415) {
|
|
9243
9629
|
if (isAttr)
|
|
9244
|
-
parser.report(
|
|
9630
|
+
parser.report(159);
|
|
9245
9631
|
expression = parseJSXEmptyExpression(parser, {
|
|
9246
9632
|
index: parser.startIndex,
|
|
9247
9633
|
line: parser.startLine,
|