meriyah 7.0.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +22 -3
- package/dist/meriyah.cjs +147 -60
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +147 -61
- package/dist/meriyah.umd.js +147 -60
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +6 -4
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/meriyah.d.ts +1 -0
- package/dist/types/options.d.ts +12 -2
- package/dist/types/parser/parser.d.ts +4 -3
- package/dist/types/token.d.ts +3 -3
- package/package.json +1 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [7.1.1](https://github.com/meriyah/meriyah/compare/v7.1.0...v7.1.1) (2026-07-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **lexer:** accept \8 and \9 escapes in sloppy mode ([#559](https://github.com/meriyah/meriyah/issues/559)) ([8938494](https://github.com/meriyah/meriyah/commit/893849491bb493cd7e72280e82c4fb344915a4cb))
|
|
7
|
+
* **parser:** fix for-of initializer check ([#549](https://github.com/meriyah/meriyah/issues/549)) ([72952d1](https://github.com/meriyah/meriyah/commit/72952d144b5f8a2715c72ba54c50e42e987dc4a8)), closes [#548](https://github.com/meriyah/meriyah/issues/548)
|
|
8
|
+
* **parser:** fix the invoke check after arrow function when newline is involved ([#551](https://github.com/meriyah/meriyah/issues/551)) ([c6904bc](https://github.com/meriyah/meriyah/commit/c6904bce68ec824ca7dc9a42a7e5eb6352eddd47))
|
|
9
|
+
* **parser:** report strict reserved parameters at their original range ([#558](https://github.com/meriyah/meriyah/issues/558)) ([842e276](https://github.com/meriyah/meriyah/commit/842e2768bf76f920a303df375e07eb6dcd085fb1)), closes [#470](https://github.com/meriyah/meriyah/issues/470)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [7.1.0](https://github.com/meriyah/meriyah/compare/v7.0.0...v7.1.0) (2026-02-04)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* add `isParseError()` for brand check ([#541](https://github.com/meriyah/meriyah/issues/541)) ([c5443c4](https://github.com/meriyah/meriyah/commit/c5443c4ac0abb9f25e6f176a7947f9b61e299c5d))
|
|
19
|
+
* assign to CallExpression is now runtime error in annexB ([#546](https://github.com/meriyah/meriyah/issues/546)) ([5835016](https://github.com/meriyah/meriyah/commit/5835016ddcf3f16807ef87c41661a18c3038f131))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
# [7.0.0](https://github.com/meriyah/meriyah/compare/v6.1.4...v7.0.0) (2025-11-27)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -15,6 +37,15 @@
|
|
|
15
37
|
* support unicode 17 ([#532](https://github.com/meriyah/meriyah/issues/532)) ([de36a18](https://github.com/meriyah/meriyah/commit/de36a1894c8098695f2a80bd1092dc627ded6dec))
|
|
16
38
|
|
|
17
39
|
|
|
40
|
+
### BREAKING CHANGES
|
|
41
|
+
|
|
42
|
+
- drop support of Node.js below v20 (#518)
|
|
43
|
+
- remove `uniqueKeyInpattern` option, nodes are always unique in shorthand pattern (#519)
|
|
44
|
+
- add `sourceType`, deprecate `module` option (#521)
|
|
45
|
+
- add `sourceType: 'commonjs'`, deprecate `globalReturn` option (#523)
|
|
46
|
+
- forbid passing option `sourceType` in `parseScript` and `parseModule` APIs (#465)
|
|
47
|
+
|
|
48
|
+
|
|
18
49
|
|
|
19
50
|
## [6.1.4](https://github.com/meriyah/meriyah/compare/v6.1.3...v6.1.4) (2025-07-02)
|
|
20
51
|
|
package/README.md
CHANGED
|
@@ -66,7 +66,6 @@ Meriyah generates `AST` according to [ESTree AST format](https://github.com/estr
|
|
|
66
66
|
The `parse` method exposed by meriyah takes an optional `options` object which allows you to specify whether to parse in [`script`](https://tc39.github.io/ecma262/#sec-parse-script) mode (the default) or in [`module`](https://tc39.github.io/ecma262/#sec-parsemodule) mode.
|
|
67
67
|
|
|
68
68
|
```js
|
|
69
|
-
// There are also "parseScript" and "parseModule" exported.
|
|
70
69
|
import { parse } from 'meriyah';
|
|
71
70
|
const result = parse('let some = "code";', { ranges: true });
|
|
72
71
|
```
|
|
@@ -81,8 +80,10 @@ The available options:
|
|
|
81
80
|
// The flag to enable stage 3 support (ESNext), default `false`
|
|
82
81
|
next: boolean;
|
|
83
82
|
|
|
84
|
-
//
|
|
85
|
-
|
|
83
|
+
// Enable start/end offsets to each node, default `false`
|
|
84
|
+
// true: emit start, end, and range: [start, end] (backwards compatible)
|
|
85
|
+
// object: selectively enable { start, end, range } — e.g. { start: true, end: true }
|
|
86
|
+
ranges: boolean | { start?: boolean; end?: boolean; range?: boolean };
|
|
86
87
|
|
|
87
88
|
// Enable web compatibility, default `false`
|
|
88
89
|
webcompat: boolean;
|
|
@@ -144,6 +145,24 @@ If a function callback is supplied, the signature must be
|
|
|
144
145
|
declare function onInsertedSemicolon(position: number): void;
|
|
145
146
|
```
|
|
146
147
|
|
|
148
|
+
### `isParseError`
|
|
149
|
+
|
|
150
|
+
Exposed for error instance checking.
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
import { parse, isParseError } from './meriyah';
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
parse('invalid code');
|
|
157
|
+
} catch (error) {
|
|
158
|
+
if (isParseError(error)) {
|
|
159
|
+
console.error(error.description);
|
|
160
|
+
} else {
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
147
166
|
## Example usage
|
|
148
167
|
|
|
149
168
|
```js
|
package/dist/meriyah.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version$1 = "7.
|
|
3
|
+
var version$1 = "7.1.1";
|
|
4
4
|
|
|
5
5
|
const unicodeLookup = ((compressed, lookup) => {
|
|
6
6
|
const result = new Uint32Array(69632);
|
|
@@ -807,6 +807,7 @@ class ParseError extends SyntaxError {
|
|
|
807
807
|
this.description = description;
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
|
+
const isParseError = (error) => error instanceof ParseError;
|
|
810
811
|
|
|
811
812
|
function getOwnProperty(object, key) {
|
|
812
813
|
return Object.hasOwn(object, key) ? object[key] : undefined;
|
|
@@ -1549,7 +1550,7 @@ function parseEscape(parser, context, first, isTemplate = 0) {
|
|
|
1549
1550
|
}
|
|
1550
1551
|
case 56:
|
|
1551
1552
|
case 57:
|
|
1552
|
-
if (isTemplate ||
|
|
1553
|
+
if (isTemplate || context & 1)
|
|
1553
1554
|
return -3;
|
|
1554
1555
|
parser.flags |= 4096;
|
|
1555
1556
|
default:
|
|
@@ -2005,7 +2006,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2005
2006
|
advanceChar(parser);
|
|
2006
2007
|
if (parser.currentChar === 61) {
|
|
2007
2008
|
advanceChar(parser);
|
|
2008
|
-
return
|
|
2009
|
+
return 4718632;
|
|
2009
2010
|
}
|
|
2010
2011
|
return 8913465;
|
|
2011
2012
|
}
|
|
@@ -2048,7 +2049,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2048
2049
|
advanceChar(parser);
|
|
2049
2050
|
if (parser.currentChar === 61) {
|
|
2050
2051
|
advanceChar(parser);
|
|
2051
|
-
return
|
|
2052
|
+
return 4718633;
|
|
2052
2053
|
}
|
|
2053
2054
|
return 8913720;
|
|
2054
2055
|
}
|
|
@@ -2064,7 +2065,7 @@ function scanSingleToken(parser, context, state) {
|
|
|
2064
2065
|
advanceChar(parser);
|
|
2065
2066
|
if (parser.currentChar === 61) {
|
|
2066
2067
|
advanceChar(parser);
|
|
2067
|
-
return
|
|
2068
|
+
return 4718634;
|
|
2068
2069
|
}
|
|
2069
2070
|
return 276824445;
|
|
2070
2071
|
}
|
|
@@ -4543,10 +4544,22 @@ function rescanJSXIdentifier(parser) {
|
|
|
4543
4544
|
return parser.getToken();
|
|
4544
4545
|
}
|
|
4545
4546
|
|
|
4547
|
+
function normalizeRanges(ranges) {
|
|
4548
|
+
if (!ranges)
|
|
4549
|
+
return undefined;
|
|
4550
|
+
if (ranges === true)
|
|
4551
|
+
return { start: true, end: true, range: true };
|
|
4552
|
+
return {
|
|
4553
|
+
start: ranges.start ?? false,
|
|
4554
|
+
end: ranges.end ?? false,
|
|
4555
|
+
range: ranges.range ?? false,
|
|
4556
|
+
};
|
|
4557
|
+
}
|
|
4546
4558
|
function normalizeOptions(rawOptions) {
|
|
4547
4559
|
const options = {
|
|
4548
4560
|
validateRegex: true,
|
|
4549
4561
|
...rawOptions,
|
|
4562
|
+
ranges: normalizeRanges(rawOptions.ranges),
|
|
4550
4563
|
};
|
|
4551
4564
|
if (options.module && !options.sourceType) {
|
|
4552
4565
|
options.sourceType = 'module';
|
|
@@ -4730,8 +4743,9 @@ class Parser {
|
|
|
4730
4743
|
currentChar = 0;
|
|
4731
4744
|
exportedNames = new Set();
|
|
4732
4745
|
exportedBindings = new Set();
|
|
4733
|
-
assignable =
|
|
4746
|
+
assignable = 0;
|
|
4734
4747
|
destructible = 0;
|
|
4748
|
+
strictReservedRange = null;
|
|
4735
4749
|
leadingDecorators = { decorators: [] };
|
|
4736
4750
|
constructor(source, rawOptions = {}) {
|
|
4737
4751
|
this.source = source;
|
|
@@ -4788,11 +4802,15 @@ class Parser {
|
|
|
4788
4802
|
return { index: this.index, line: this.line, column: this.column };
|
|
4789
4803
|
}
|
|
4790
4804
|
finishNode(node, start, end) {
|
|
4791
|
-
|
|
4792
|
-
|
|
4805
|
+
const { ranges } = this.options;
|
|
4806
|
+
if (ranges) {
|
|
4793
4807
|
const endIndex = end ? end.index : this.startIndex;
|
|
4794
|
-
|
|
4795
|
-
|
|
4808
|
+
if (ranges.start)
|
|
4809
|
+
node.start = start.index;
|
|
4810
|
+
if (ranges.end)
|
|
4811
|
+
node.end = endIndex;
|
|
4812
|
+
if (ranges.range)
|
|
4813
|
+
node.range = [start.index, endIndex];
|
|
4796
4814
|
}
|
|
4797
4815
|
if (this.options.loc) {
|
|
4798
4816
|
node.loc = {
|
|
@@ -4843,8 +4861,14 @@ class Parser {
|
|
|
4843
4861
|
return this.cloneLocationInformation({ ...original }, original);
|
|
4844
4862
|
}
|
|
4845
4863
|
cloneLocationInformation(node, original) {
|
|
4846
|
-
|
|
4847
|
-
|
|
4864
|
+
const { ranges } = this.options;
|
|
4865
|
+
if (ranges) {
|
|
4866
|
+
if (ranges.start)
|
|
4867
|
+
node.start = original.start;
|
|
4868
|
+
if (ranges.end)
|
|
4869
|
+
node.end = original.end;
|
|
4870
|
+
if (ranges.range)
|
|
4871
|
+
node.range = [...original.range];
|
|
4848
4872
|
}
|
|
4849
4873
|
if (this.options.loc) {
|
|
4850
4874
|
node.loc = {
|
|
@@ -4862,10 +4886,14 @@ function pushComment(comments, options) {
|
|
|
4862
4886
|
type,
|
|
4863
4887
|
value,
|
|
4864
4888
|
};
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4889
|
+
const { ranges } = options;
|
|
4890
|
+
if (ranges) {
|
|
4891
|
+
if (ranges.start)
|
|
4892
|
+
comment.start = start;
|
|
4893
|
+
if (ranges.end)
|
|
4894
|
+
comment.end = end;
|
|
4895
|
+
if (ranges.range)
|
|
4896
|
+
comment.range = [start, end];
|
|
4869
4897
|
}
|
|
4870
4898
|
if (options.loc) {
|
|
4871
4899
|
comment.loc = loc;
|
|
@@ -4878,10 +4906,14 @@ function pushToken(tokens, options) {
|
|
|
4878
4906
|
const token = {
|
|
4879
4907
|
token: type,
|
|
4880
4908
|
};
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4909
|
+
const { ranges } = options;
|
|
4910
|
+
if (ranges) {
|
|
4911
|
+
if (ranges.start)
|
|
4912
|
+
token.start = start;
|
|
4913
|
+
if (ranges.end)
|
|
4914
|
+
token.end = end;
|
|
4915
|
+
if (ranges.range)
|
|
4916
|
+
token.range = [start, end];
|
|
4885
4917
|
}
|
|
4886
4918
|
if (options.loc) {
|
|
4887
4919
|
token.loc = loc;
|
|
@@ -5520,7 +5552,7 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
5520
5552
|
if (parser.getToken() === 1077936155) {
|
|
5521
5553
|
nextToken(parser, context | 32);
|
|
5522
5554
|
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5523
|
-
if (origin & 32
|
|
5555
|
+
if (origin & 32) {
|
|
5524
5556
|
if (parser.getToken() === 471156 ||
|
|
5525
5557
|
(parser.getToken() === 8673330 &&
|
|
5526
5558
|
(token & 2097152 || (kind & 4) === 0 || context & 1))) {
|
|
@@ -6019,6 +6051,8 @@ function parseAssignmentExpression(parser, context, privateScope, inGroup, isPat
|
|
|
6019
6051
|
if ((token & 4194304) === 4194304) {
|
|
6020
6052
|
if (parser.assignable & 2)
|
|
6021
6053
|
parser.report(26);
|
|
6054
|
+
if ((token & 524288) === 524288 && parser.assignable & 4)
|
|
6055
|
+
parser.report(26);
|
|
6022
6056
|
if ((!isPattern && token === 1077936155 && left.type === 'ArrayExpression') ||
|
|
6023
6057
|
left.type === 'ObjectExpression') {
|
|
6024
6058
|
reinterpretToPattern(parser, left);
|
|
@@ -6265,8 +6299,12 @@ function parseFunctionBody(parser, context, scope, privateScope, origin, funcNam
|
|
|
6265
6299
|
}
|
|
6266
6300
|
if (parser.flags & 512)
|
|
6267
6301
|
parser.report(119);
|
|
6268
|
-
if (parser.flags & 256)
|
|
6302
|
+
if (parser.flags & 256) {
|
|
6303
|
+
if (parser.strictReservedRange) {
|
|
6304
|
+
throw new ParseError(parser.strictReservedRange[0], parser.strictReservedRange[1], 118);
|
|
6305
|
+
}
|
|
6269
6306
|
parser.report(118);
|
|
6307
|
+
}
|
|
6270
6308
|
}
|
|
6271
6309
|
}
|
|
6272
6310
|
parser.flags =
|
|
@@ -6351,6 +6389,10 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6351
6389
|
break;
|
|
6352
6390
|
}
|
|
6353
6391
|
case 69271571: {
|
|
6392
|
+
if ((parser.flags & 8192) === 8192) {
|
|
6393
|
+
parser.flags = (parser.flags | 8192) ^ 8192;
|
|
6394
|
+
return expr;
|
|
6395
|
+
}
|
|
6354
6396
|
let restoreHasOptionalChaining = false;
|
|
6355
6397
|
if ((parser.flags & 2048) === 2048) {
|
|
6356
6398
|
restoreHasOptionalChaining = true;
|
|
@@ -6384,7 +6426,12 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
6384
6426
|
parser.flags = (parser.flags | 2048) ^ 2048;
|
|
6385
6427
|
}
|
|
6386
6428
|
const args = parseArguments(parser, context, privateScope, inGroup);
|
|
6387
|
-
parser.
|
|
6429
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
6430
|
+
parser.assignable = 4;
|
|
6431
|
+
}
|
|
6432
|
+
else {
|
|
6433
|
+
parser.assignable = 2;
|
|
6434
|
+
}
|
|
6388
6435
|
expr = parser.finishNode({
|
|
6389
6436
|
type: 'CallExpression',
|
|
6390
6437
|
callee: expr,
|
|
@@ -6452,7 +6499,12 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
|
|
|
6452
6499
|
}
|
|
6453
6500
|
else if (parser.getToken() === 67174411) {
|
|
6454
6501
|
const args = parseArguments(parser, context, privateScope, 0);
|
|
6455
|
-
parser.
|
|
6502
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
6503
|
+
parser.assignable = 4;
|
|
6504
|
+
}
|
|
6505
|
+
else {
|
|
6506
|
+
parser.assignable = 2;
|
|
6507
|
+
}
|
|
6456
6508
|
node = parser.finishNode({
|
|
6457
6509
|
type: 'CallExpression',
|
|
6458
6510
|
callee: expr,
|
|
@@ -6779,11 +6831,16 @@ function parseTemplateElement(parser, cooked, raw, start, tail) {
|
|
|
6779
6831
|
tail,
|
|
6780
6832
|
}, start);
|
|
6781
6833
|
const tailSize = tail ? 1 : 2;
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6834
|
+
const { ranges } = parser.options;
|
|
6835
|
+
if (ranges) {
|
|
6836
|
+
if (ranges.start)
|
|
6837
|
+
node.start += 1;
|
|
6838
|
+
if (ranges.end)
|
|
6839
|
+
node.end -= tailSize;
|
|
6840
|
+
if (ranges.range) {
|
|
6841
|
+
node.range[0] += 1;
|
|
6842
|
+
node.range[1] -= tailSize;
|
|
6843
|
+
}
|
|
6787
6844
|
}
|
|
6788
6845
|
if (parser.options.loc) {
|
|
6789
6846
|
node.loc.start.column += 1;
|
|
@@ -7057,9 +7114,9 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
7057
7114
|
}
|
|
7058
7115
|
else if (parser.getToken() !== 1077936155) {
|
|
7059
7116
|
destructible |=
|
|
7060
|
-
parser.assignable &
|
|
7061
|
-
?
|
|
7062
|
-
:
|
|
7117
|
+
parser.assignable & 1
|
|
7118
|
+
? 32
|
|
7119
|
+
: 16;
|
|
7063
7120
|
}
|
|
7064
7121
|
}
|
|
7065
7122
|
}
|
|
@@ -7089,9 +7146,9 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
7089
7146
|
}
|
|
7090
7147
|
else if (parser.getToken() !== 1077936155) {
|
|
7091
7148
|
destructible |=
|
|
7092
|
-
parser.assignable &
|
|
7093
|
-
?
|
|
7094
|
-
:
|
|
7149
|
+
parser.assignable & 1
|
|
7150
|
+
? 32
|
|
7151
|
+
: 16;
|
|
7095
7152
|
}
|
|
7096
7153
|
}
|
|
7097
7154
|
}
|
|
@@ -7208,7 +7265,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7208
7265
|
if (parser.destructible & 8)
|
|
7209
7266
|
parser.report(71);
|
|
7210
7267
|
argument = parseMemberOrUpdateExpression(parser, context, privateScope, argument, inGroup, 0, tokenStart);
|
|
7211
|
-
destructible |= parser.assignable &
|
|
7268
|
+
destructible |= parser.assignable & 1 ? 0 : 16;
|
|
7212
7269
|
if ((parser.getToken() & 4194304) === 4194304) {
|
|
7213
7270
|
if (parser.getToken() !== 1077936155)
|
|
7214
7271
|
destructible |= 16;
|
|
@@ -7222,9 +7279,9 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7222
7279
|
argument = parseConditionalExpression(parser, context, privateScope, argument, tokenStart);
|
|
7223
7280
|
}
|
|
7224
7281
|
destructible |=
|
|
7225
|
-
parser.assignable &
|
|
7226
|
-
?
|
|
7227
|
-
:
|
|
7282
|
+
parser.assignable & 1
|
|
7283
|
+
? 32
|
|
7284
|
+
: 16;
|
|
7228
7285
|
}
|
|
7229
7286
|
}
|
|
7230
7287
|
else {
|
|
@@ -7253,7 +7310,9 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
7253
7310
|
argument = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, argument);
|
|
7254
7311
|
}
|
|
7255
7312
|
destructible |=
|
|
7256
|
-
parser.assignable & 1
|
|
7313
|
+
parser.assignable & 1
|
|
7314
|
+
? 32
|
|
7315
|
+
: 16;
|
|
7257
7316
|
}
|
|
7258
7317
|
parser.destructible = destructible;
|
|
7259
7318
|
if (parser.getToken() !== closingToken && parser.getToken() !== 18)
|
|
@@ -7445,7 +7504,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7445
7504
|
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, inGroup, isPattern, kind, origin);
|
|
7446
7505
|
destructible = parser.destructible;
|
|
7447
7506
|
parser.assignable =
|
|
7448
|
-
destructible & 16
|
|
7507
|
+
destructible & 16
|
|
7508
|
+
? 2
|
|
7509
|
+
: 1;
|
|
7449
7510
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
7450
7511
|
if (parser.assignable & 2)
|
|
7451
7512
|
destructible |= 16;
|
|
@@ -7467,9 +7528,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7467
7528
|
value = parseConditionalExpression(parser, context, privateScope, value, tokenStart);
|
|
7468
7529
|
}
|
|
7469
7530
|
destructible |=
|
|
7470
|
-
parser.assignable &
|
|
7471
|
-
?
|
|
7472
|
-
:
|
|
7531
|
+
parser.assignable & 1
|
|
7532
|
+
? 32
|
|
7533
|
+
: 16;
|
|
7473
7534
|
}
|
|
7474
7535
|
}
|
|
7475
7536
|
}
|
|
@@ -7626,7 +7687,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7626
7687
|
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, inGroup, isPattern, kind, origin);
|
|
7627
7688
|
destructible = parser.destructible;
|
|
7628
7689
|
parser.assignable =
|
|
7629
|
-
destructible & 16
|
|
7690
|
+
destructible & 16
|
|
7691
|
+
? 2
|
|
7692
|
+
: 1;
|
|
7630
7693
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
7631
7694
|
if (parser.assignable & 2) {
|
|
7632
7695
|
destructible |= 16;
|
|
@@ -7646,9 +7709,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7646
7709
|
value = parseConditionalExpression(parser, context, privateScope, value, tokenStart);
|
|
7647
7710
|
}
|
|
7648
7711
|
destructible |=
|
|
7649
|
-
parser.assignable &
|
|
7650
|
-
?
|
|
7651
|
-
:
|
|
7712
|
+
parser.assignable & 1
|
|
7713
|
+
? 32
|
|
7714
|
+
: 16;
|
|
7652
7715
|
}
|
|
7653
7716
|
}
|
|
7654
7717
|
}
|
|
@@ -7677,7 +7740,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7677
7740
|
else if (parser.getToken() === 67174411) {
|
|
7678
7741
|
state |= 1;
|
|
7679
7742
|
value = parseMethodDefinition(parser, context, privateScope, state, inGroup, parser.tokenStart);
|
|
7680
|
-
destructible =
|
|
7743
|
+
destructible = 16;
|
|
7681
7744
|
}
|
|
7682
7745
|
else {
|
|
7683
7746
|
parser.report(134);
|
|
@@ -7697,11 +7760,11 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7697
7760
|
value = parseMemberOrUpdateExpression(parser, context, privateScope, value, inGroup, 0, tokenStart);
|
|
7698
7761
|
if ((parser.getToken() & 4194304) === 4194304) {
|
|
7699
7762
|
destructible |=
|
|
7700
|
-
parser.assignable &
|
|
7701
|
-
?
|
|
7702
|
-
: token === 1077936155
|
|
7763
|
+
parser.assignable & 1
|
|
7764
|
+
? token === 1077936155
|
|
7703
7765
|
? 0
|
|
7704
|
-
: 32
|
|
7766
|
+
: 32
|
|
7767
|
+
: 16;
|
|
7705
7768
|
value = parseAssignmentExpressionOrPattern(parser, context, privateScope, inGroup, isPattern, tokenStart, value);
|
|
7706
7769
|
}
|
|
7707
7770
|
else if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
@@ -7732,7 +7795,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7732
7795
|
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, inGroup, isPattern, kind, origin);
|
|
7733
7796
|
destructible = parser.destructible;
|
|
7734
7797
|
parser.assignable =
|
|
7735
|
-
destructible & 16
|
|
7798
|
+
destructible & 16
|
|
7799
|
+
? 2
|
|
7800
|
+
: 1;
|
|
7736
7801
|
if (parser.getToken() === 18 || parser.getToken() === 1074790415) {
|
|
7737
7802
|
if (parser.assignable & 2)
|
|
7738
7803
|
destructible |= 16;
|
|
@@ -7757,9 +7822,9 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7757
7822
|
value = parseConditionalExpression(parser, context, privateScope, value, tokenStart);
|
|
7758
7823
|
}
|
|
7759
7824
|
destructible |=
|
|
7760
|
-
parser.assignable &
|
|
7761
|
-
?
|
|
7762
|
-
:
|
|
7825
|
+
parser.assignable & 1
|
|
7826
|
+
? 32
|
|
7827
|
+
: 16;
|
|
7763
7828
|
}
|
|
7764
7829
|
}
|
|
7765
7830
|
}
|
|
@@ -7865,6 +7930,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
7865
7930
|
consume(parser, context, 67174411);
|
|
7866
7931
|
const params = [];
|
|
7867
7932
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
7933
|
+
parser.strictReservedRange = null;
|
|
7868
7934
|
if (parser.getToken() === 16) {
|
|
7869
7935
|
if (kind & 512) {
|
|
7870
7936
|
parser.report(37, 'Setter', 'one', '');
|
|
@@ -7888,6 +7954,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
7888
7954
|
if ((context & 1) === 0) {
|
|
7889
7955
|
if ((parser.getToken() & 36864) === 36864) {
|
|
7890
7956
|
parser.flags |= 256;
|
|
7957
|
+
parser.strictReservedRange ??= [tokenStart, parser.currentLocation];
|
|
7891
7958
|
}
|
|
7892
7959
|
if ((parser.getToken() & 537079808) === 537079808) {
|
|
7893
7960
|
parser.flags |= 512;
|
|
@@ -8172,6 +8239,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
8172
8239
|
if ((parser.flags & 1) === 0) {
|
|
8173
8240
|
parser.report(116);
|
|
8174
8241
|
}
|
|
8242
|
+
parser.flags |= 8192;
|
|
8175
8243
|
break;
|
|
8176
8244
|
case 67108877:
|
|
8177
8245
|
case 67174409:
|
|
@@ -8202,6 +8270,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
8202
8270
|
function parseFormalParametersOrFormalList(parser, context, scope, privateScope, inGroup, kind) {
|
|
8203
8271
|
consume(parser, context, 67174411);
|
|
8204
8272
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8273
|
+
parser.strictReservedRange = null;
|
|
8205
8274
|
const params = [];
|
|
8206
8275
|
if (consumeOpt(parser, context, 16))
|
|
8207
8276
|
return params;
|
|
@@ -8215,6 +8284,7 @@ function parseFormalParametersOrFormalList(parser, context, scope, privateScope,
|
|
|
8215
8284
|
if ((context & 1) === 0) {
|
|
8216
8285
|
if ((token & 36864) === 36864) {
|
|
8217
8286
|
parser.flags |= 256;
|
|
8287
|
+
parser.strictReservedRange ??= [tokenStart, parser.currentLocation];
|
|
8218
8288
|
}
|
|
8219
8289
|
if ((token & 537079808) === 537079808) {
|
|
8220
8290
|
parser.flags |= 512;
|
|
@@ -8364,6 +8434,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8364
8434
|
parser.report(48);
|
|
8365
8435
|
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 1, start);
|
|
8366
8436
|
}
|
|
8437
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
8438
|
+
parser.assignable = 4;
|
|
8439
|
+
}
|
|
8440
|
+
else {
|
|
8441
|
+
parser.assignable = 2;
|
|
8442
|
+
}
|
|
8367
8443
|
return parser.finishNode({
|
|
8368
8444
|
type: 'CallExpression',
|
|
8369
8445
|
callee,
|
|
@@ -8437,7 +8513,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8437
8513
|
}
|
|
8438
8514
|
else {
|
|
8439
8515
|
expr = parseExpression(parser, context, privateScope, 1, 0, tokenStart);
|
|
8440
|
-
destructible =
|
|
8516
|
+
destructible = 0;
|
|
8441
8517
|
params.push(expr);
|
|
8442
8518
|
while (consumeOpt(parser, context | 32, 18)) {
|
|
8443
8519
|
params.push(parseExpression(parser, context, privateScope, 1, 0, tokenStart));
|
|
@@ -8445,7 +8521,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8445
8521
|
destructible |= parser.assignable;
|
|
8446
8522
|
consume(parser, context, 16);
|
|
8447
8523
|
parser.destructible = destructible | 16;
|
|
8448
|
-
parser.
|
|
8524
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
8525
|
+
parser.assignable = 4;
|
|
8526
|
+
}
|
|
8527
|
+
else {
|
|
8528
|
+
parser.assignable = 2;
|
|
8529
|
+
}
|
|
8449
8530
|
return parser.finishNode({
|
|
8450
8531
|
type: 'CallExpression',
|
|
8451
8532
|
callee,
|
|
@@ -8483,7 +8564,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8483
8564
|
if (destructible & 8) {
|
|
8484
8565
|
parser.report(62);
|
|
8485
8566
|
}
|
|
8486
|
-
parser.
|
|
8567
|
+
if (!(context & 1) && parser.options.webcompat) {
|
|
8568
|
+
parser.assignable = 4;
|
|
8569
|
+
}
|
|
8570
|
+
else {
|
|
8571
|
+
parser.assignable = 2;
|
|
8572
|
+
}
|
|
8487
8573
|
return parser.finishNode({
|
|
8488
8574
|
type: 'CallExpression',
|
|
8489
8575
|
callee,
|
|
@@ -9207,6 +9293,7 @@ function parse(source, options) {
|
|
|
9207
9293
|
return parseSource(source, options);
|
|
9208
9294
|
}
|
|
9209
9295
|
|
|
9296
|
+
exports.isParseError = isParseError;
|
|
9210
9297
|
exports.parse = parse;
|
|
9211
9298
|
exports.parseModule = parseModule;
|
|
9212
9299
|
exports.parseScript = parseScript;
|