mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Marko v3: Cleanup how scoped vars are handled
This commit is contained in:
parent
19144d4921
commit
f49638a6dd
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user