Skip to content

Commit

Permalink
deps: update acorn to 8.10.0
Browse files Browse the repository at this point in the history
PR-URL: #48713
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
  • Loading branch information
nodejs-github-bot authored and ruyadorno committed Sep 16, 2023
1 parent 01eaccc commit 59fca4e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 15 deletions.
6 changes: 6 additions & 0 deletions deps/acorn/acorn/CHANGELOG.md
@@ -1,3 +1,9 @@
## 8.10.0 (2023-07-05)

### New features

Add a `checkPrivateFields` option that disables strict checking of private property use.

## 8.9.0 (2023-06-16)

### Bug fixes
Expand Down
4 changes: 4 additions & 0 deletions deps/acorn/acorn/README.md
Expand Up @@ -109,6 +109,10 @@ required):
characters `#!` (as in a shellscript), the first line will be
treated as a comment. Defaults to true when `ecmaVersion` >= 2023.

- **checkPrivateFields**: By default, the parser will verify that
private properties are only used in places where they are valid and
have been declared. Set this to false to turn such checks off.

- **locations**: When `true`, each node has a `loc` object attached
with `start` and `end` subobjects, each of which contains the
one-based line and zero-based column numbers in `{line, column}`
Expand Down
2 changes: 1 addition & 1 deletion deps/acorn/acorn/dist/acorn.d.ts
Expand Up @@ -11,7 +11,7 @@ declare namespace acorn {
[Symbol.iterator](): Iterator<Token>
}

type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 'latest'
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'

interface Options {
ecmaVersion: ecmaVersion
Expand Down
19 changes: 13 additions & 6 deletions deps/acorn/acorn/dist/acorn.js
Expand Up @@ -372,6 +372,10 @@
// allowed and treated as a line comment. Enabled by default when
// `ecmaVersion` >= 2023.
allowHashBang: false,
// By default, the parser will verify that private properties are
// only used in places where they are valid and have been declared.
// Set this to false to turn such checks off.
checkPrivateFields: true,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
Expand Down Expand Up @@ -1600,6 +1604,7 @@
var ref = this.privateNameStack.pop();
var declared = ref.declared;
var used = ref.used;
if (!this.options.checkPrivateFields) { return }
var len = this.privateNameStack.length;
var parent = len === 0 ? null : this.privateNameStack[len - 1];
for (var i = 0; i < used.length; ++i) {
Expand Down Expand Up @@ -2661,7 +2666,7 @@
else { sawUnary = true; }
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (!sawUnary && this.type === types$1.privateId) {
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }
expr = this.parsePrivateIdent();
// only could be private fields in 'in', such as #x in obj
if (this.type !== types$1._in) { this.unexpected(); }
Expand Down Expand Up @@ -3504,10 +3509,12 @@
this.finishNode(node, "PrivateIdentifier");

// For validating existence
if (this.privateNameStack.length === 0) {
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
} else {
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
if (this.options.checkPrivateFields) {
if (this.privateNameStack.length === 0) {
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
} else {
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
}
}

return node
Expand Down Expand Up @@ -5907,7 +5914,7 @@
// [walk]: util/walk.js


var version = "8.9.0";
var version = "8.10.0";

Parser.acorn = {
Parser: Parser,
Expand Down
19 changes: 13 additions & 6 deletions deps/acorn/acorn/dist/acorn.mjs
Expand Up @@ -366,6 +366,10 @@ var defaultOptions = {
// allowed and treated as a line comment. Enabled by default when
// `ecmaVersion` >= 2023.
allowHashBang: false,
// By default, the parser will verify that private properties are
// only used in places where they are valid and have been declared.
// Set this to false to turn such checks off.
checkPrivateFields: true,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
Expand Down Expand Up @@ -1594,6 +1598,7 @@ pp$8.exitClassBody = function() {
var ref = this.privateNameStack.pop();
var declared = ref.declared;
var used = ref.used;
if (!this.options.checkPrivateFields) { return }
var len = this.privateNameStack.length;
var parent = len === 0 ? null : this.privateNameStack[len - 1];
for (var i = 0; i < used.length; ++i) {
Expand Down Expand Up @@ -2655,7 +2660,7 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
else { sawUnary = true; }
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (!sawUnary && this.type === types$1.privateId) {
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }
expr = this.parsePrivateIdent();
// only could be private fields in 'in', such as #x in obj
if (this.type !== types$1._in) { this.unexpected(); }
Expand Down Expand Up @@ -3498,10 +3503,12 @@ pp$5.parsePrivateIdent = function() {
this.finishNode(node, "PrivateIdentifier");

// For validating existence
if (this.privateNameStack.length === 0) {
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
} else {
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
if (this.options.checkPrivateFields) {
if (this.privateNameStack.length === 0) {
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
} else {
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
}
}

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


var version = "8.9.0";
var version = "8.10.0";

Parser.acorn = {
Parser: Parser,
Expand Down
2 changes: 1 addition & 1 deletion deps/acorn/acorn/package.json
Expand Up @@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
"version": "8.9.0",
"version": "8.10.0",
"engines": {
"node": ">=0.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/acorn_version.h
Expand Up @@ -2,5 +2,5 @@
// Refer to tools/update-acorn.sh
#ifndef SRC_ACORN_VERSION_H_
#define SRC_ACORN_VERSION_H_
#define ACORN_VERSION "8.9.0"
#define ACORN_VERSION "8.10.0"
#endif // SRC_ACORN_VERSION_H_

0 comments on commit 59fca4e

Please sign in to comment.