self-compiling closures as expressions
This commit is contained in:
parent
61a7f7a567
commit
156a0b13d9
|
@ -729,7 +729,7 @@
|
|||
wrap: function wrap(expressions, statement) {
|
||||
var call, func;
|
||||
func = new ParentheticalNode(new CodeNode([], Expressions.wrap([expressions])));
|
||||
call = new CallNode(new ValueNode(func, new AccessorNode(new LiteralNode('call'))), [new LiteralNode('this')]);
|
||||
call = new CallNode(new ValueNode(func, [new AccessorNode(new LiteralNode('call'))]), [new LiteralNode('this')]);
|
||||
return statement ? Expressions.wrap([call]) : call;
|
||||
}
|
||||
});
|
||||
|
@ -1216,7 +1216,7 @@
|
|||
this.condition = condition;
|
||||
this.body = body && body.unwrap();
|
||||
this.else_body = else_body && else_body.unwrap();
|
||||
this.children = [this.condition, this.body, this.else_body];
|
||||
this.children = compact([this.condition, this.body, this.else_body]);
|
||||
this.tags = tags || {
|
||||
};
|
||||
if (this.condition instanceof Array) {
|
||||
|
|
|
@ -563,7 +563,7 @@ ClosureNode: exports.ClosureNode: {
|
|||
|
||||
wrap: (expressions, statement) ->
|
||||
func: new ParentheticalNode(new CodeNode([], Expressions.wrap([expressions])))
|
||||
call: new CallNode(new ValueNode(func, new AccessorNode(new LiteralNode('call'))), [new LiteralNode('this')])
|
||||
call: new CallNode(new ValueNode(func, [new AccessorNode(new LiteralNode('call'))]), [new LiteralNode('this')])
|
||||
if statement then Expressions.wrap([call]) else call
|
||||
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ IfNode: exports.IfNode: inherit Node, {
|
|||
@condition: condition
|
||||
@body: body and body.unwrap()
|
||||
@else_body: else_body and else_body.unwrap()
|
||||
@children: [@condition, @body, @else_body]
|
||||
@children: compact [@condition, @body, @else_body]
|
||||
@tags: tags or {}
|
||||
@multiple: true if @condition instanceof Array
|
||||
@condition: new OpNode('!', new ParentheticalNode(@condition)) if @tags.invert
|
||||
|
|
Loading…
Reference in New Issue