Code coverage report for sc/lang/compiler/codegen/var-stmt.js

Statements: 100% (12 / 12)      Branches: 100% (2 / 2)      Functions: 100% (3 / 3)      Lines: 100% (12 / 12)      Ignored: none     

All files » sc/lang/compiler/codegen/ » var-stmt.js
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 261     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);