Comparing version 0.0.8 to 0.0.9
20
index.js
@@ -291,2 +291,4 @@ // Export reader | ||
'IfStatement': function(){ | ||
var elseIf = node.elseStatement | ||
&& node.elseStatement.type === 'IfStatement'; | ||
var condition = node.condition ? | ||
@@ -297,4 +299,6 @@ compile(il, node.type)(node.condition) : '', | ||
elseStatement = node.elseStatement ? | ||
compile(il+1, node.type)(node.elseStatement) : ''; | ||
return new Element(node.type, inl(il) +'if (' +condition +'){' | ||
compile(il +(!elseIf ? 1 : 0), | ||
node.type)(node.elseStatement) : ''; | ||
return new Element(node.type, (par !== 'IfStatement' ? inl(il) : '') | ||
+'if (' +condition +'){' | ||
+nli(il+1) | ||
@@ -304,7 +308,7 @@ +ifStatement | ||
+'}' +(elseStatement ? | ||
' else {' | ||
+nli(il+1) | ||
' else ' +(node.elseStatement.length ? '{' : '') | ||
+(elseIf || node.elseStatement.type ? '' : nli(il+1)) | ||
+elseStatement | ||
+nli(il) | ||
+'}' | ||
+(node.elseStatement.length ? nli(il) : '') | ||
+(node.elseStatement.length ? '}' : '') | ||
: '')); | ||
@@ -398,5 +402,3 @@ }, | ||
: ''; | ||
return new Element(node.type, 'return' +(value ? ' ' : '') | ||
+value | ||
+';'); | ||
return new Element(node.type, 'return' +(value ? ' ' : '') +value); | ||
}, | ||
@@ -403,0 +405,0 @@ 'WithStatement': function(){ |
@@ -10,3 +10,3 @@ { | ||
"author": "aynik", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "type": "git", |
767502
16365