mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
recording else_body as a child of IfNode, when added after the face
This commit is contained in:
@@ -1182,6 +1182,7 @@
|
|||||||
// Rewrite a chain of IfNodes to add a default case as the final else.
|
// Rewrite a chain of IfNodes to add a default case as the final else.
|
||||||
add_else: function add_else(exprs) {
|
add_else: function add_else(exprs) {
|
||||||
this.is_chain() ? this.else_body.add_else(exprs) : (this.else_body = exprs && exprs.unwrap());
|
this.is_chain() ? this.else_body.add_else(exprs) : (this.else_body = exprs && exprs.unwrap());
|
||||||
|
this.children.push(exprs);
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
// If the else_body is an IfNode itself, then we've got an if-else chain.
|
// If the else_body is an IfNode itself, then we've got an if-else chain.
|
||||||
|
|||||||
@@ -960,6 +960,7 @@ IfNode: exports.IfNode: inherit Node, {
|
|||||||
# Rewrite a chain of IfNodes to add a default case as the final else.
|
# Rewrite a chain of IfNodes to add a default case as the final else.
|
||||||
add_else: (exprs) ->
|
add_else: (exprs) ->
|
||||||
if @is_chain() then @else_body.add_else(exprs) else @else_body: exprs and exprs.unwrap()
|
if @is_chain() then @else_body.add_else(exprs) else @else_body: exprs and exprs.unwrap()
|
||||||
|
@children.push(exprs)
|
||||||
this
|
this
|
||||||
|
|
||||||
# If the else_body is an IfNode itself, then we've got an if-else chain.
|
# If the else_body is an IfNode itself, then we've got an if-else chain.
|
||||||
|
|||||||
Reference in New Issue
Block a user