mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
fixing infinite recursion when compiling if statements containing pure_statements
This commit is contained in:
@@ -69,7 +69,9 @@
|
|||||||
del(this.options, 'operation');
|
del(this.options, 'operation');
|
||||||
}
|
}
|
||||||
top = this.top_sensitive() ? this.options.top : del(this.options, 'top');
|
top = this.top_sensitive() ? this.options.top : del(this.options, 'top');
|
||||||
closure = this.is_statement() && !this.is_pure_statement() && !top && !this.options.returns && !(this instanceof CommentNode);
|
closure = this.is_statement() && !this.is_pure_statement() && !top && !this.options.returns && !(this instanceof CommentNode) && !(this.contains(function(n) {
|
||||||
|
return n.is_pure_statement();
|
||||||
|
}));
|
||||||
return closure ? this.compile_closure(this.options) : this.compile_node(this.options);
|
return closure ? this.compile_closure(this.options) : this.compile_node(this.options);
|
||||||
};
|
};
|
||||||
// Statements converted into expressions via closure-wrapping share a scope
|
// Statements converted into expressions via closure-wrapping share a scope
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ exports.BaseNode: class BaseNode
|
|||||||
del @options, 'operation' unless this instanceof ValueNode
|
del @options, 'operation' unless this instanceof ValueNode
|
||||||
top: if @top_sensitive() then @options.top else del @options, 'top'
|
top: if @top_sensitive() then @options.top else del @options, 'top'
|
||||||
closure: @is_statement() and not @is_pure_statement() and not top and
|
closure: @is_statement() and not @is_pure_statement() and not top and
|
||||||
not @options.returns and not (this instanceof CommentNode)
|
not @options.returns and not (this instanceof CommentNode) and
|
||||||
|
not (@contains (n) -> n.is_pure_statement())
|
||||||
if closure then @compile_closure(@options) else @compile_node(@options)
|
if closure then @compile_closure(@options) else @compile_node(@options)
|
||||||
|
|
||||||
# Statements converted into expressions via closure-wrapping share a scope
|
# Statements converted into expressions via closure-wrapping share a scope
|
||||||
|
|||||||
Reference in New Issue
Block a user