diff options
author | kzc <kzc@users.noreply.github.com> | 2020-05-05 14:21:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 02:21:36 +0800 |
commit | b656f7c083c79102a318a02fec3e76a450122cf4 (patch) | |
tree | 87bf7ac2e23d5466427e10796274162a57da3287 | |
parent | 873db281e836e9bee37ead92d90967a89750cae5 (diff) | |
download | tracifyjs-b656f7c083c79102a318a02fec3e76a450122cf4.tar.gz tracifyjs-b656f7c083c79102a318a02fec3e76a450122cf4.zip |
remove unused returns from tree walk (#3850)
-rw-r--r-- | lib/ast.js | 59 |
1 files changed, 29 insertions, 30 deletions
@@ -111,7 +111,7 @@ var AST_Node = DEFNODE("Node", "start end", { end: "[AST_Token] The last token of this node" }, walk: function(visitor) { - return visitor.visit(this); + visitor.visit(this); } }, null); @@ -160,7 +160,7 @@ var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.body.walk(visitor); }); } @@ -179,7 +179,7 @@ var AST_Block = DEFNODE("Block", "body", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { walk_body(node, visitor); }); } @@ -207,7 +207,7 @@ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.label.walk(visitor); node.body.walk(visitor); }); @@ -243,7 +243,7 @@ var AST_Do = DEFNODE("Do", null, { $documentation: "A `do` statement", walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.body.walk(visitor); node.condition.walk(visitor); }); @@ -254,7 +254,7 @@ var AST_While = DEFNODE("While", null, { $documentation: "A `while` statement", walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.condition.walk(visitor); node.body.walk(visitor); }); @@ -270,7 +270,7 @@ var AST_For = DEFNODE("For", "init condition step", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { if (node.init) node.init.walk(visitor); if (node.condition) node.condition.walk(visitor); if (node.step) node.step.walk(visitor); @@ -287,7 +287,7 @@ var AST_ForIn = DEFNODE("ForIn", "init object", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.init.walk(visitor); node.object.walk(visitor); node.body.walk(visitor); @@ -302,7 +302,7 @@ var AST_With = DEFNODE("With", "expression", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); node.body.walk(visitor); }); @@ -387,7 +387,7 @@ var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments length_read", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { if (node.name) node.name.walk(visitor); node.argnames.forEach(function(argname) { argname.walk(visitor); @@ -422,7 +422,7 @@ var AST_Exit = DEFNODE("Exit", "value", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { if (node.value) node.value.walk(visitor); }); } @@ -443,7 +443,7 @@ var AST_LoopControl = DEFNODE("LoopControl", "label", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { if (node.label) node.label.walk(visitor); }); } @@ -467,7 +467,7 @@ var AST_If = DEFNODE("If", "condition alternative", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.condition.walk(visitor); node.body.walk(visitor); if (node.alternative) node.alternative.walk(visitor); @@ -484,7 +484,7 @@ var AST_Switch = DEFNODE("Switch", "expression", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); walk_body(node, visitor); }); @@ -506,7 +506,7 @@ var AST_Case = DEFNODE("Case", "expression", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); walk_body(node, visitor); }); @@ -523,7 +523,7 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { walk_body(node, visitor); if (node.bcatch) node.bcatch.walk(visitor); if (node.bfinally) node.bfinally.walk(visitor); @@ -538,7 +538,7 @@ var AST_Catch = DEFNODE("Catch", "argname", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.argname.walk(visitor); walk_body(node, visitor); }); @@ -558,7 +558,7 @@ var AST_Definitions = DEFNODE("Definitions", "definitions", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.definitions.forEach(function(defn) { defn.walk(visitor); }); @@ -578,7 +578,7 @@ var AST_VarDef = DEFNODE("VarDef", "name value", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.name.walk(visitor); if (node.value) node.value.walk(visitor); }); @@ -595,7 +595,7 @@ var AST_Call = DEFNODE("Call", "expression args", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); node.args.forEach(function(arg) { arg.walk(visitor); @@ -615,7 +615,7 @@ var AST_Sequence = DEFNODE("Sequence", "expressions", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expressions.forEach(function(expr) { expr.walk(visitor); }); @@ -647,7 +647,7 @@ var AST_Dot = DEFNODE("Dot", null, { $documentation: "A dotted property access expression", walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); }); } @@ -657,7 +657,7 @@ var AST_Sub = DEFNODE("Sub", null, { $documentation: "Index-style property access, i.e. `a[\"foo\"]`", walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); node.property.walk(visitor); }); @@ -672,7 +672,7 @@ var AST_Unary = DEFNODE("Unary", "operator expression", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.expression.walk(visitor); }); } @@ -695,7 +695,7 @@ var AST_Binary = DEFNODE("Binary", "operator left right", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.left.walk(visitor); node.right.walk(visitor); }); @@ -711,7 +711,7 @@ var AST_Conditional = DEFNODE("Conditional", "condition consequent alternative", }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.condition.walk(visitor); node.consequent.walk(visitor); node.alternative.walk(visitor); @@ -732,7 +732,7 @@ var AST_Array = DEFNODE("Array", "elements", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.elements.forEach(function(element) { element.walk(visitor); }); @@ -747,7 +747,7 @@ var AST_Object = DEFNODE("Object", "properties", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.properties.forEach(function(prop) { prop.walk(visitor); }); @@ -763,7 +763,7 @@ var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", { }, walk: function(visitor) { var node = this; - return visitor.visit(node, function() { + visitor.visit(node, function() { node.value.walk(visitor); }); } @@ -926,7 +926,6 @@ TreeWalker.prototype = { var done = this.callback(node, descend || noop); if (!done && descend) descend(); this.pop(); - return done; }, parent: function(n) { return this.stack[this.stack.length - 2 - (n || 0)]; |