Code coverage report for sc/lang/compiler/codegen/program.js

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

All files » sc/lang/compiler/codegen/ » program.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 45 5     40 40     40   40 39     40      
(function(sc) {
  "use strict";
 
  require("./codegen");
 
  var CodeGen = sc.lang.compiler.CodeGen;
 
  CodeGen.addGenerateMethod("Program", function(node) {
    if (!node.body.length) {
      return [];
    }
 
    var body = this.withFunction([ "" ], function() { // "" compiled as $
      return this.generateStatements(node.body);
    });
 
    var result = [ "(", body, ")" ];
 
    if (!this.opts.bare) {
      result = [ "SCScript", result, ";" ];
    }
 
    return result;
  });
})(sc);