diff --git a/deps/acorn/acorn-walk/CHANGELOG.md b/deps/acorn/acorn-walk/CHANGELOG.md index 2f3413caa6630e..0b4eea8a95d3ed 100644 --- a/deps/acorn/acorn-walk/CHANGELOG.md +++ b/deps/acorn/acorn-walk/CHANGELOG.md @@ -1,3 +1,11 @@ +## 8.3.1 (2023-12-06) + +### Bug fixes + +Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error. + +Visitor functions are now called in such a way that their `this` refers to the object they are part of. + ## 8.3.0 (2023-10-26) ### New features diff --git a/deps/acorn/acorn-walk/dist/walk.d.mts b/deps/acorn/acorn-walk/dist/walk.d.mts index 7ba7a1d33b14c1..7bc8c9790fd1a7 100644 --- a/deps/acorn/acorn-walk/dist/walk.d.mts +++ b/deps/acorn/acorn-walk/dist/walk.d.mts @@ -16,6 +16,8 @@ export type FullAncestorWalkerCallback = ( type AggregateType = { Expression: acorn.Expression, Statement: acorn.Statement, + Function: acorn.Function, + Class: acorn.Class, Pattern: acorn.Pattern, ForInit: acorn.VariableDeclaration | acorn.Expression } diff --git a/deps/acorn/acorn-walk/dist/walk.d.ts b/deps/acorn/acorn-walk/dist/walk.d.ts index 7ba7a1d33b14c1..7bc8c9790fd1a7 100644 --- a/deps/acorn/acorn-walk/dist/walk.d.ts +++ b/deps/acorn/acorn-walk/dist/walk.d.ts @@ -16,6 +16,8 @@ export type FullAncestorWalkerCallback = ( type AggregateType = { Expression: acorn.Expression, Statement: acorn.Statement, + Function: acorn.Function, + Class: acorn.Class, Pattern: acorn.Pattern, ForInit: acorn.VariableDeclaration | acorn.Expression } diff --git a/deps/acorn/acorn-walk/dist/walk.js b/deps/acorn/acorn-walk/dist/walk.js index 01e717960ef5b1..580df6413725f8 100644 --- a/deps/acorn/acorn-walk/dist/walk.js +++ b/deps/acorn/acorn-walk/dist/walk.js @@ -4,7 +4,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {}))); })(this, (function (exports) { 'use strict'; - // AST walker module for Mozilla Parser API compatible trees + // AST walker module for ESTree compatible trees // A simple walk is one where you simply specify callbacks to be // called on specific nodes. The last two arguments are optional. A @@ -14,7 +14,7 @@ // Expression: function(node) { ... } // }); // - // to do something with all expressions. All Parser API node types + // to do something with all expressions. All ESTree node types // can be used to identify node types, as well as Expression and // Statement, which denote categories of nodes. // @@ -25,9 +25,9 @@ function simple(node, visitors, baseVisitor, state, override) { if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { - var type = override || node.type, found = visitors[type]; + var type = override || node.type; baseVisitor[type](node, st, c); - if (found) { found(node, st); } + if (visitors[type]) { visitors[type](node, st); } })(node, state, override); } @@ -38,11 +38,11 @@ var ancestors = []; if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { - var type = override || node.type, found = visitors[type]; + var type = override || node.type; var isNew = node !== ancestors[ancestors.length - 1]; if (isNew) { ancestors.push(node); } baseVisitor[type](node, st, c); - if (found) { found(node, st || ancestors, ancestors); } + if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); } if (isNew) { ancestors.pop(); } })(node, state, override); } diff --git a/deps/acorn/acorn-walk/dist/walk.mjs b/deps/acorn/acorn-walk/dist/walk.mjs index 89dd1f1f4f3557..19eebc0e70f598 100644 --- a/deps/acorn/acorn-walk/dist/walk.mjs +++ b/deps/acorn/acorn-walk/dist/walk.mjs @@ -1,4 +1,4 @@ -// AST walker module for Mozilla Parser API compatible trees +// AST walker module for ESTree compatible trees // A simple walk is one where you simply specify callbacks to be // called on specific nodes. The last two arguments are optional. A @@ -8,7 +8,7 @@ // Expression: function(node) { ... } // }); // -// to do something with all expressions. All Parser API node types +// to do something with all expressions. All ESTree node types // can be used to identify node types, as well as Expression and // Statement, which denote categories of nodes. // @@ -19,9 +19,9 @@ function simple(node, visitors, baseVisitor, state, override) { if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { - var type = override || node.type, found = visitors[type]; + var type = override || node.type; baseVisitor[type](node, st, c); - if (found) { found(node, st); } + if (visitors[type]) { visitors[type](node, st); } })(node, state, override); } @@ -32,11 +32,11 @@ function ancestor(node, visitors, baseVisitor, state, override) { var ancestors = []; if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { - var type = override || node.type, found = visitors[type]; + var type = override || node.type; var isNew = node !== ancestors[ancestors.length - 1]; if (isNew) { ancestors.push(node); } baseVisitor[type](node, st, c); - if (found) { found(node, st || ancestors, ancestors); } + if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); } if (isNew) { ancestors.pop(); } })(node, state, override); } diff --git a/deps/acorn/acorn-walk/package.json b/deps/acorn/acorn-walk/package.json index b2d385d85ef31f..393c87a39255a0 100644 --- a/deps/acorn/acorn-walk/package.json +++ b/deps/acorn/acorn-walk/package.json @@ -16,7 +16,7 @@ ], "./package.json": "./package.json" }, - "version": "8.3.0", + "version": "8.3.1", "engines": { "node": ">=0.4.0" },