aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2015-01-06 12:27:23 +0200
committerMihai Bazon <mihai@bazon.net>2015-01-06 12:29:07 +0200
commit6b23cbc8522bdc6d28e1abb44eb2d1d6eb6b697a (patch)
treeda0ec2875451e4615e292e54aadcd7ac3a71a5fd
parent7f9bc9e863addac4bd17c09beb94a01faaea0aad (diff)
downloadtracifyjs-6b23cbc8522bdc6d28e1abb44eb2d1d6eb6b697a.tar.gz
tracifyjs-6b23cbc8522bdc6d28e1abb44eb2d1d6eb6b697a.zip
AST_Do nodes: walk body before condition
-rw-r--r--lib/ast.js18
1 files 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", {