From 6b23cbc8522bdc6d28e1abb44eb2d1d6eb6b697a Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Tue, 6 Jan 2015 12:27:23 +0200 Subject: [PATCH] AST_Do nodes: walk body before condition --- lib/ast.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/ast.js b/lib/ast.js index 051cd2fb..2eb8cc86 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -205,21 +205,27 @@ var AST_DWLoop = DEFNODE("DWLoop", "condition", { $documentation: "Base class for do/while statements", $propdoc: { condition: "[AST_Node] the loop condition. Should not be instanceof AST_Statement" - }, - _walk: function(visitor) { - return visitor._visit(this, function(){ - this.condition._walk(visitor); - this.body._walk(visitor); - }); } }, AST_IterationStatement); var AST_Do = DEFNODE("Do", null, { $documentation: "A `do` statement", + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.body._walk(visitor); + this.condition._walk(visitor); + }); + } }, AST_DWLoop); var AST_While = DEFNODE("While", null, { $documentation: "A `while` statement", + _walk: function(visitor) { + return visitor._visit(this, function(){ + this.condition._walk(visitor); + this.body._walk(visitor); + }); + } }, AST_DWLoop); var AST_For = DEFNODE("For", "init condition step", { -- 2.34.1