| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1 1 1 1 11 11 14 14 14 7 7 14 | (function(sc) {
"use strict";
require("./codegen");
var CodeGen = sc.lang.compiler.CodeGen;
CodeGen.addGenerateMethod("VariableDeclaration", function(node) {
var scope = this.state.syncBlockScope;
return this.stitchWith(node.declarations, ",", function(item) {
this.scope.add("var", item.id.name, scope);
var result = [ this.generate(item.id) ];
if (item.init) {
result.push("=", this.generate(item.init));
} else {
result.push("=$.Nil()");
}
return result;
});
});
})(sc);
|