Marko v3: Cleanup how scoped vars are handled

This commit is contained in:
Patrick Steele-Idem 2016-02-12 17:13:45 -07:00
parent 19144d4921
commit f49638a6dd

View File

@ -15,12 +15,15 @@ class Vars extends Node {
var kind = this.kind;
var isStatement = this.statement;
var body = this.body;
var selfInvoking = this.isFlagSet('selfInvoking');
var hasBody = this.body && this.body.length;
if(!selfInvoking && hasBody) {
this.setFlag('selfInvoking');
return codegen.builder.selfInvokingFunction([ this ]);
if(hasBody) {
var scopedBody = [this].concat(this.body.items);
this.body = null;
return codegen.builder.selfInvokingFunction(scopedBody);
}
if (!declarations || !declarations.length) {