Skip to content

Commit

Permalink
Drop deprecated ScopeBody and ScopeExpression from walker
Browse files Browse the repository at this point in the history
Issue #656
  • Loading branch information
marijnh committed Sep 10, 2018
1 parent c28d099 commit e389b07
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/walk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// });
//
// to do something with all expressions. All Parser API node types
// can be used to identify node types, as well as Expression,
// Statement, and ScopeBody, which denote categories of nodes.
// can be used to identify node types, as well as Expression and
// Statement, which denote categories of nodes.
//
// The base argument can be used to pass a custom (recursive)
// walker, and state can be used to give this walked an initial
Expand Down Expand Up @@ -230,7 +230,7 @@ base.TryStatement = (node, st, c) => {
}
base.CatchClause = (node, st, c) => {
if (node.param) c(node.param, st, "Pattern")
c(node.body, st, "ScopeBody")
c(node.body, st, "Statement")
}
base.WhileStatement = base.DoWhileStatement = (node, st, c) => {
c(node.test, st, "Expression")
Expand Down Expand Up @@ -267,12 +267,8 @@ base.Function = (node, st, c) => {
if (node.id) c(node.id, st, "Pattern")
for (let param of node.params)
c(param, st, "Pattern")
c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody")
c(node.body, st, node.expression ? "Expression" : "Statement")
}
// FIXME drop these node types in next major version
// (They are awkward, and in ES6 every block can be a scope.)
base.ScopeBody = (node, st, c) => c(node, st, "Statement")
base.ScopeExpression = (node, st, c) => c(node, st, "Expression")

base.Pattern = (node, st, c) => {
if (node.type === "Identifier")
Expand Down

0 comments on commit e389b07

Please sign in to comment.