all files / lib/languages/ java.js

91.43% Statements 32/35
60% Branches 6/10
87.5% Functions 7/8
96.3% Lines 26/27
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71                 178× 178× 178×   178×                         346× 346× 338× 338× 338×           338×                                      
(function() {
  var Java, Language, heroToThis, parserHolder,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
 
  Language = require('./language');
 
  parserHolder = {};
 
  module.exports = Java = (function(_super) {
    __extends(Java, _super);
 
    Java.prototype.name = 'Java';
 
    Java.prototype.id = 'java';
 
    Java.prototype.parserID = 'cashew';
 
    function Java() {
      var _ref;
      Java.__super__.constructor.apply(this, arguments);
      if (parserHolder.cashew == null) {
        parserHolder.cashew = (_ref = typeof self !== "undefined" && self !== null ? self.aetherCashew : void 0) != null ? _ref : require('cashew-js');
      }
      this.runtimeGlobals = {
        ___JavaRuntime: parserHolder.cashew.___JavaRuntime,
        _Object: parserHolder.cashew._Object,
        Integer: parserHolder.cashew.Integer,
        Double: parserHolder.cashew.Double,
        _NotInitialized: parserHolder.cashew._NotInitialized,
        _ArrayList: parserHolder.cashew._ArrayList
      };
    }
 
    Java.prototype.obviouslyCannotTranspile = function(rawCode) {
      return false;
    };
 
    Java.prototype.parse = function(code, aether) {
      var ast;
      ast = parserHolder.cashew.Parse(code);
      ast = parserHolder.cashew.wrapFunction(ast, aether.options.functionName, aether.className, aether.staticCall);
      heroToThis(ast.body[0].body.body);
      return ast;
    };
 
    return Java;
 
  })(Language);
 
  heroToThis = function(body) {
    return body.unshift({
      "type": "VariableDeclaration",
      "declarations": [
        {
          "type": "VariableDeclarator",
          "id": {
            "type": "Identifier",
            "name": "hero"
          },
          "init": {
            "type": "ThisExpression"
          }
        }
      ],
      "kind": "var"
    });
  };
 
}).call(this);