Skip to content

Commit 59fca4e

Browse files
nodejs-github-botruyadorno
authored andcommitted
deps: update acorn to 8.10.0
PR-URL: #48713 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 01eaccc commit 59fca4e

File tree

7 files changed

+39
-15
lines changed

7 files changed

+39
-15
lines changed

deps/acorn/acorn/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 8.10.0 (2023-07-05)
2+
3+
### New features
4+
5+
Add a `checkPrivateFields` option that disables strict checking of private property use.
6+
17
## 8.9.0 (2023-06-16)
28

39
### Bug fixes

deps/acorn/acorn/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ required):
109109
characters `#!` (as in a shellscript), the first line will be
110110
treated as a comment. Defaults to true when `ecmaVersion` >= 2023.
111111

112+
- **checkPrivateFields**: By default, the parser will verify that
113+
private properties are only used in places where they are valid and
114+
have been declared. Set this to false to turn such checks off.
115+
112116
- **locations**: When `true`, each node has a `loc` object attached
113117
with `start` and `end` subobjects, each of which contains the
114118
one-based line and zero-based column numbers in `{line, column}`

deps/acorn/acorn/dist/acorn.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ declare namespace acorn {
1111
[Symbol.iterator](): Iterator<Token>
1212
}
1313

14-
type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 'latest'
14+
type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 'latest'
1515

1616
interface Options {
1717
ecmaVersion: ecmaVersion

deps/acorn/acorn/dist/acorn.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@
372372
// allowed and treated as a line comment. Enabled by default when
373373
// `ecmaVersion` >= 2023.
374374
allowHashBang: false,
375+
// By default, the parser will verify that private properties are
376+
// only used in places where they are valid and have been declared.
377+
// Set this to false to turn such checks off.
378+
checkPrivateFields: true,
375379
// When `locations` is on, `loc` properties holding objects with
376380
// `start` and `end` properties in `{line, column}` form (with
377381
// line being 1-based and column 0-based) will be attached to the
@@ -1600,6 +1604,7 @@
16001604
var ref = this.privateNameStack.pop();
16011605
var declared = ref.declared;
16021606
var used = ref.used;
1607+
if (!this.options.checkPrivateFields) { return }
16031608
var len = this.privateNameStack.length;
16041609
var parent = len === 0 ? null : this.privateNameStack[len - 1];
16051610
for (var i = 0; i < used.length; ++i) {
@@ -2661,7 +2666,7 @@
26612666
else { sawUnary = true; }
26622667
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
26632668
} else if (!sawUnary && this.type === types$1.privateId) {
2664-
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
2669+
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }
26652670
expr = this.parsePrivateIdent();
26662671
// only could be private fields in 'in', such as #x in obj
26672672
if (this.type !== types$1._in) { this.unexpected(); }
@@ -3504,10 +3509,12 @@
35043509
this.finishNode(node, "PrivateIdentifier");
35053510

35063511
// For validating existence
3507-
if (this.privateNameStack.length === 0) {
3508-
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
3509-
} else {
3510-
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
3512+
if (this.options.checkPrivateFields) {
3513+
if (this.privateNameStack.length === 0) {
3514+
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
3515+
} else {
3516+
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
3517+
}
35113518
}
35123519

35133520
return node
@@ -5907,7 +5914,7 @@
59075914
// [walk]: util/walk.js
59085915

59095916

5910-
var version = "8.9.0";
5917+
var version = "8.10.0";
59115918

59125919
Parser.acorn = {
59135920
Parser: Parser,

deps/acorn/acorn/dist/acorn.mjs

+13-6
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ var defaultOptions = {
366366
// allowed and treated as a line comment. Enabled by default when
367367
// `ecmaVersion` >= 2023.
368368
allowHashBang: false,
369+
// By default, the parser will verify that private properties are
370+
// only used in places where they are valid and have been declared.
371+
// Set this to false to turn such checks off.
372+
checkPrivateFields: true,
369373
// When `locations` is on, `loc` properties holding objects with
370374
// `start` and `end` properties in `{line, column}` form (with
371375
// line being 1-based and column 0-based) will be attached to the
@@ -1594,6 +1598,7 @@ pp$8.exitClassBody = function() {
15941598
var ref = this.privateNameStack.pop();
15951599
var declared = ref.declared;
15961600
var used = ref.used;
1601+
if (!this.options.checkPrivateFields) { return }
15971602
var len = this.privateNameStack.length;
15981603
var parent = len === 0 ? null : this.privateNameStack[len - 1];
15991604
for (var i = 0; i < used.length; ++i) {
@@ -2655,7 +2660,7 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
26552660
else { sawUnary = true; }
26562661
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
26572662
} else if (!sawUnary && this.type === types$1.privateId) {
2658-
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
2663+
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }
26592664
expr = this.parsePrivateIdent();
26602665
// only could be private fields in 'in', such as #x in obj
26612666
if (this.type !== types$1._in) { this.unexpected(); }
@@ -3498,10 +3503,12 @@ pp$5.parsePrivateIdent = function() {
34983503
this.finishNode(node, "PrivateIdentifier");
34993504

35003505
// For validating existence
3501-
if (this.privateNameStack.length === 0) {
3502-
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
3503-
} else {
3504-
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
3506+
if (this.options.checkPrivateFields) {
3507+
if (this.privateNameStack.length === 0) {
3508+
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
3509+
} else {
3510+
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
3511+
}
35053512
}
35063513

35073514
return node
@@ -5901,7 +5908,7 @@ pp.readWord = function() {
59015908
// [walk]: util/walk.js
59025909

59035910

5904-
var version = "8.9.0";
5911+
var version = "8.10.0";
59055912

59065913
Parser.acorn = {
59075914
Parser: Parser,

deps/acorn/acorn/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"./package.json": "./package.json"
1818
},
19-
"version": "8.9.0",
19+
"version": "8.10.0",
2020
"engines": {
2121
"node": ">=0.4.0"
2222
},

src/acorn_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/update-acorn.sh
33
#ifndef SRC_ACORN_VERSION_H_
44
#define SRC_ACORN_VERSION_H_
5-
#define ACORN_VERSION "8.9.0"
5+
#define ACORN_VERSION "8.10.0"
66
#endif // SRC_ACORN_VERSION_H_

0 commit comments

Comments
 (0)