From 785c4fb5a03bd9e229fcb799afb6c2bd29bb80ed Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sat, 13 Feb 2010 09:44:12 -0500 Subject: [PATCH] recording else_body as a child of IfNode, when added after the face --- lib/coffee_script/nodes.js | 1 + src/nodes.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/coffee_script/nodes.js b/lib/coffee_script/nodes.js index 3d2d8946..37c6956f 100644 --- a/lib/coffee_script/nodes.js +++ b/lib/coffee_script/nodes.js @@ -1182,6 +1182,7 @@ // Rewrite a chain of IfNodes to add a default case as the final else. add_else: function add_else(exprs) { this.is_chain() ? this.else_body.add_else(exprs) : (this.else_body = exprs && exprs.unwrap()); + this.children.push(exprs); return this; }, // If the else_body is an IfNode itself, then we've got an if-else chain. diff --git a/src/nodes.coffee b/src/nodes.coffee index ab84a79c..6b9435bf 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -960,6 +960,7 @@ IfNode: exports.IfNode: inherit Node, { # Rewrite a chain of IfNodes to add a default case as the final else. add_else: (exprs) -> if @is_chain() then @else_body.add_else(exprs) else @else_body: exprs and exprs.unwrap() + @children.push(exprs) this # If the else_body is an IfNode itself, then we've got an if-else chain.