Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 573467c

Browse filesBrowse files
nodejs-github-botaduh95
authored andcommitted
deps: update acorn to 8.14.1
PR-URL: #57382 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 0ca362f commit 573467c
Copy full SHA for 573467c

File tree

Expand file treeCollapse file tree

5 files changed

+80
-50
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+80
-50
lines changed
Open diff view settings
Collapse file

‎deps/acorn/acorn/CHANGELOG.md‎

Copy file name to clipboardExpand all lines: deps/acorn/acorn/CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 8.14.1 (2025-03-05)
2+
3+
### Bug fixes
4+
5+
Fix an issue where `await` expressions in class field initializers were inappropriately allowed.
6+
7+
Properly allow await inside an async arrow function inside a class field initializer.
8+
9+
Mention the source file name in syntax error messages when given.
10+
11+
Properly add an empty `attributes` property to every form of `ExportNamedDeclaration`.
12+
113
## 8.14.0 (2024-10-27)
214

315
### New features
Collapse file

‎deps/acorn/acorn/dist/acorn.js‎

Copy file name to clipboardExpand all lines: deps/acorn/acorn/dist/acorn.js
+33-24Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@
493493
SCOPE_SUPER = 64,
494494
SCOPE_DIRECT_SUPER = 128,
495495
SCOPE_CLASS_STATIC_BLOCK = 256,
496+
SCOPE_CLASS_FIELD_INIT = 512,
496497
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
497498

498499
function functionFlags(async, generator) {
@@ -603,35 +604,38 @@
603604

604605
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
605606

606-
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
607+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
607608

608-
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
609+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
609610

610611
prototypeAccessors.canAwait.get = function () {
611612
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
612-
var scope = this.scopeStack[i];
613-
if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false }
614-
if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 }
613+
var ref = this.scopeStack[i];
614+
var flags = ref.flags;
615+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { return false }
616+
if (flags & SCOPE_FUNCTION) { return (flags & SCOPE_ASYNC) > 0 }
615617
}
616618
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
617619
};
618620

619621
prototypeAccessors.allowSuper.get = function () {
620622
var ref = this.currentThisScope();
621623
var flags = ref.flags;
622-
var inClassFieldInit = ref.inClassFieldInit;
623-
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
624+
return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod
624625
};
625626

626627
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
627628

628629
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
629630

630631
prototypeAccessors.allowNewDotTarget.get = function () {
631-
var ref = this.currentThisScope();
632-
var flags = ref.flags;
633-
var inClassFieldInit = ref.inClassFieldInit;
634-
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
632+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
633+
var ref = this.scopeStack[i];
634+
var flags = ref.flags;
635+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||
636+
((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) { return true }
637+
}
638+
return false
635639
};
636640

637641
prototypeAccessors.inClassStaticBlock.get = function () {
@@ -1558,11 +1562,9 @@
15581562

15591563
if (this.eat(types$1.eq)) {
15601564
// To raise SyntaxError if 'arguments' exists in the initializer.
1561-
var scope = this.currentThisScope();
1562-
var inClassFieldInit = scope.inClassFieldInit;
1563-
scope.inClassFieldInit = true;
1565+
this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
15641566
field.value = this.parseMaybeAssign();
1565-
scope.inClassFieldInit = inClassFieldInit;
1567+
this.exitScope();
15661568
} else {
15671569
field.value = null;
15681570
}
@@ -1704,6 +1706,8 @@
17041706
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
17051707
node.specifiers = [];
17061708
node.source = null;
1709+
if (this.options.ecmaVersion >= 16)
1710+
{ node.attributes = []; }
17071711
} else { // export { x, y as z } [from '...']
17081712
node.declaration = null;
17091713
node.specifiers = this.parseExportSpecifiers(exports);
@@ -1727,6 +1731,8 @@
17271731
}
17281732

17291733
node.source = null;
1734+
if (this.options.ecmaVersion >= 16)
1735+
{ node.attributes = []; }
17301736
}
17311737
this.semicolon();
17321738
}
@@ -3306,9 +3312,10 @@
33063312
};
33073313

33083314
pp$5.parseGetterSetter = function(prop) {
3309-
prop.kind = prop.key.name;
3315+
var kind = prop.key.name;
33103316
this.parsePropertyName(prop);
33113317
prop.value = this.parseMethod(false);
3318+
prop.kind = kind;
33123319
var paramCount = prop.kind === "get" ? 0 : 1;
33133320
if (prop.value.params.length !== paramCount) {
33143321
var start = prop.value.start;
@@ -3331,9 +3338,9 @@
33313338
prop.kind = "init";
33323339
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
33333340
if (isPattern) { this.unexpected(); }
3334-
prop.kind = "init";
33353341
prop.method = true;
33363342
prop.value = this.parseMethod(isGenerator, isAsync);
3343+
prop.kind = "init";
33373344
} else if (!isPattern && !containsEsc &&
33383345
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
33393346
(prop.key.name === "get" || prop.key.name === "set") &&
@@ -3345,7 +3352,6 @@
33453352
this.checkUnreserved(prop.key);
33463353
if (prop.key.name === "await" && !this.awaitIdentPos)
33473354
{ this.awaitIdentPos = startPos; }
3348-
prop.kind = "init";
33493355
if (isPattern) {
33503356
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
33513357
} else if (this.type === types$1.eq && refDestructuringErrors) {
@@ -3355,6 +3361,7 @@
33553361
} else {
33563362
prop.value = this.copyNode(prop.key);
33573363
}
3364+
prop.kind = "init";
33583365
prop.shorthand = true;
33593366
} else { this.unexpected(); }
33603367
};
@@ -3530,7 +3537,7 @@
35303537
{ this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
35313538
if (this.inAsync && name === "await")
35323539
{ this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
3533-
if (this.currentThisScope().inClassFieldInit && name === "arguments")
3540+
if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments")
35343541
{ this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
35353542
if (this.inClassStaticBlock && (name === "arguments" || name === "await"))
35363543
{ this.raise(start, ("Cannot use " + name + " in class static initialization block")); }
@@ -3643,6 +3650,9 @@
36433650
pp$4.raise = function(pos, message) {
36443651
var loc = getLineInfo(this.input, pos);
36453652
message += " (" + loc.line + ":" + loc.column + ")";
3653+
if (this.sourceFile) {
3654+
message += " in " + this.sourceFile;
3655+
}
36463656
var err = new SyntaxError(message);
36473657
err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
36483658
throw err
@@ -3666,8 +3676,6 @@
36663676
this.lexical = [];
36673677
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
36683678
this.functions = [];
3669-
// A switch to disallow the identifier reference 'arguments'
3670-
this.inClassFieldInit = false;
36713679
};
36723680

36733681
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
@@ -3737,15 +3745,16 @@
37373745
pp$3.currentVarScope = function() {
37383746
for (var i = this.scopeStack.length - 1;; i--) {
37393747
var scope = this.scopeStack[i];
3740-
if (scope.flags & SCOPE_VAR) { return scope }
3748+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { return scope }
37413749
}
37423750
};
37433751

37443752
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
37453753
pp$3.currentThisScope = function() {
37463754
for (var i = this.scopeStack.length - 1;; i--) {
37473755
var scope = this.scopeStack[i];
3748-
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
3756+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&
3757+
!(scope.flags & SCOPE_ARROW)) { return scope }
37493758
}
37503759
};
37513760

@@ -6099,7 +6108,7 @@
60996108
// [walk]: util/walk.js
61006109

61016110

6102-
var version = "8.14.0";
6111+
var version = "8.14.1";
61036112

61046113
Parser.acorn = {
61056114
Parser: Parser,
Collapse file

‎deps/acorn/acorn/dist/acorn.mjs‎

Copy file name to clipboardExpand all lines: deps/acorn/acorn/dist/acorn.mjs
+33-24Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ var
487487
SCOPE_SUPER = 64,
488488
SCOPE_DIRECT_SUPER = 128,
489489
SCOPE_CLASS_STATIC_BLOCK = 256,
490+
SCOPE_CLASS_FIELD_INIT = 512,
490491
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
491492

492493
function functionFlags(async, generator) {
@@ -597,35 +598,38 @@ Parser.prototype.parse = function parse () {
597598

598599
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
599600

600-
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
601+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
601602

602-
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
603+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
603604

604605
prototypeAccessors.canAwait.get = function () {
605606
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
606-
var scope = this.scopeStack[i];
607-
if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false }
608-
if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 }
607+
var ref = this.scopeStack[i];
608+
var flags = ref.flags;
609+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { return false }
610+
if (flags & SCOPE_FUNCTION) { return (flags & SCOPE_ASYNC) > 0 }
609611
}
610612
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
611613
};
612614

613615
prototypeAccessors.allowSuper.get = function () {
614616
var ref = this.currentThisScope();
615617
var flags = ref.flags;
616-
var inClassFieldInit = ref.inClassFieldInit;
617-
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
618+
return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod
618619
};
619620

620621
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
621622

622623
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
623624

624625
prototypeAccessors.allowNewDotTarget.get = function () {
625-
var ref = this.currentThisScope();
626-
var flags = ref.flags;
627-
var inClassFieldInit = ref.inClassFieldInit;
628-
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
626+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
627+
var ref = this.scopeStack[i];
628+
var flags = ref.flags;
629+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||
630+
((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) { return true }
631+
}
632+
return false
629633
};
630634

631635
prototypeAccessors.inClassStaticBlock.get = function () {
@@ -1552,11 +1556,9 @@ pp$8.parseClassField = function(field) {
15521556

15531557
if (this.eat(types$1.eq)) {
15541558
// To raise SyntaxError if 'arguments' exists in the initializer.
1555-
var scope = this.currentThisScope();
1556-
var inClassFieldInit = scope.inClassFieldInit;
1557-
scope.inClassFieldInit = true;
1559+
this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
15581560
field.value = this.parseMaybeAssign();
1559-
scope.inClassFieldInit = inClassFieldInit;
1561+
this.exitScope();
15601562
} else {
15611563
field.value = null;
15621564
}
@@ -1698,6 +1700,8 @@ pp$8.parseExport = function(node, exports) {
16981700
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
16991701
node.specifiers = [];
17001702
node.source = null;
1703+
if (this.options.ecmaVersion >= 16)
1704+
{ node.attributes = []; }
17011705
} else { // export { x, y as z } [from '...']
17021706
node.declaration = null;
17031707
node.specifiers = this.parseExportSpecifiers(exports);
@@ -1721,6 +1725,8 @@ pp$8.parseExport = function(node, exports) {
17211725
}
17221726

17231727
node.source = null;
1728+
if (this.options.ecmaVersion >= 16)
1729+
{ node.attributes = []; }
17241730
}
17251731
this.semicolon();
17261732
}
@@ -3300,9 +3306,10 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
33003306
};
33013307

33023308
pp$5.parseGetterSetter = function(prop) {
3303-
prop.kind = prop.key.name;
3309+
var kind = prop.key.name;
33043310
this.parsePropertyName(prop);
33053311
prop.value = this.parseMethod(false);
3312+
prop.kind = kind;
33063313
var paramCount = prop.kind === "get" ? 0 : 1;
33073314
if (prop.value.params.length !== paramCount) {
33083315
var start = prop.value.start;
@@ -3325,9 +3332,9 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
33253332
prop.kind = "init";
33263333
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
33273334
if (isPattern) { this.unexpected(); }
3328-
prop.kind = "init";
33293335
prop.method = true;
33303336
prop.value = this.parseMethod(isGenerator, isAsync);
3337+
prop.kind = "init";
33313338
} else if (!isPattern && !containsEsc &&
33323339
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
33333340
(prop.key.name === "get" || prop.key.name === "set") &&
@@ -3339,7 +3346,6 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
33393346
this.checkUnreserved(prop.key);
33403347
if (prop.key.name === "await" && !this.awaitIdentPos)
33413348
{ this.awaitIdentPos = startPos; }
3342-
prop.kind = "init";
33433349
if (isPattern) {
33443350
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
33453351
} else if (this.type === types$1.eq && refDestructuringErrors) {
@@ -3349,6 +3355,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
33493355
} else {
33503356
prop.value = this.copyNode(prop.key);
33513357
}
3358+
prop.kind = "init";
33523359
prop.shorthand = true;
33533360
} else { this.unexpected(); }
33543361
};
@@ -3524,7 +3531,7 @@ pp$5.checkUnreserved = function(ref) {
35243531
{ this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
35253532
if (this.inAsync && name === "await")
35263533
{ this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
3527-
if (this.currentThisScope().inClassFieldInit && name === "arguments")
3534+
if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments")
35283535
{ this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
35293536
if (this.inClassStaticBlock && (name === "arguments" || name === "await"))
35303537
{ this.raise(start, ("Cannot use " + name + " in class static initialization block")); }
@@ -3637,6 +3644,9 @@ var pp$4 = Parser.prototype;
36373644
pp$4.raise = function(pos, message) {
36383645
var loc = getLineInfo(this.input, pos);
36393646
message += " (" + loc.line + ":" + loc.column + ")";
3647+
if (this.sourceFile) {
3648+
message += " in " + this.sourceFile;
3649+
}
36403650
var err = new SyntaxError(message);
36413651
err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
36423652
throw err
@@ -3660,8 +3670,6 @@ var Scope = function Scope(flags) {
36603670
this.lexical = [];
36613671
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
36623672
this.functions = [];
3663-
// A switch to disallow the identifier reference 'arguments'
3664-
this.inClassFieldInit = false;
36653673
};
36663674

36673675
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
@@ -3731,15 +3739,16 @@ pp$3.currentScope = function() {
37313739
pp$3.currentVarScope = function() {
37323740
for (var i = this.scopeStack.length - 1;; i--) {
37333741
var scope = this.scopeStack[i];
3734-
if (scope.flags & SCOPE_VAR) { return scope }
3742+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { return scope }
37353743
}
37363744
};
37373745

37383746
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
37393747
pp$3.currentThisScope = function() {
37403748
for (var i = this.scopeStack.length - 1;; i--) {
37413749
var scope = this.scopeStack[i];
3742-
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
3750+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&
3751+
!(scope.flags & SCOPE_ARROW)) { return scope }
37433752
}
37443753
};
37453754

@@ -6093,7 +6102,7 @@ pp.readWord = function() {
60936102
// [walk]: util/walk.js
60946103

60956104

6096-
var version = "8.14.0";
6105+
var version = "8.14.1";
60976106

60986107
Parser.acorn = {
60996108
Parser: Parser,
Collapse file

‎deps/acorn/acorn/package.json‎

Copy file name to clipboardExpand all lines: deps/acorn/acorn/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"./package.json": "./package.json"
1818
},
19-
"version": "8.14.0",
19+
"version": "8.14.1",
2020
"engines": {
2121
"node": ">=0.4.0"
2222
},

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.