acorn-walk
Advanced tools
Comparing version 8.3.0 to 8.3.1
@@ -0,1 +1,9 @@ | ||
## 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) | ||
@@ -2,0 +10,0 @@ |
@@ -19,2 +19,4 @@ import * as acorn from "acorn" | ||
Statement: acorn.Statement, | ||
Function: acorn.Function, | ||
Class: acorn.Class, | ||
Pattern: acorn.Pattern, | ||
@@ -21,0 +23,0 @@ ForInit: acorn.VariableDeclaration | acorn.Expression |
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
// AST walker module for Mozilla Parser API compatible trees | ||
// AST walker module for ESTree compatible trees | ||
@@ -18,3 +18,3 @@ // A simple walk is one where you simply specify callbacks to be | ||
// | ||
// 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 | ||
@@ -30,5 +30,5 @@ // Statement, which denote categories of nodes. | ||
; }(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); | ||
@@ -44,7 +44,7 @@ } | ||
; }(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(); } | ||
@@ -51,0 +51,0 @@ })(node, state, override); |
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "8.3.0", | ||
"version": "8.3.1", | ||
"engines": { | ||
@@ -22,0 +22,0 @@ "node": ">=0.4.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
52316
976