martypitt / typescript4j

Typescript compiler for Java
71 stars 12 forks source link

Fails to compile with 'TypeError: Cannot read property "flags" from undefined' #7

Open CRogers opened 11 years ago

CRogers commented 11 years ago

I'm trying to get this up and running but when I try and run it like so:

TypescriptCompiler tc = new TypescriptCompiler();
tc.compile("(() => { var a = 1; })()");

An exception is thrown by the javascript runtime that:

org.mozilla.javascript.EcmaError: TypeError: Cannot read property "flags" from undefined (typescript-0.9.1.1.js#29132)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712)
    at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3725)
    at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1483)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1239)
    at script(typescript-0.9.1.1.js:29132)
    at script(typescript-0.9.1.1.js:53592)
    at script(typescript-0.9.1.1.js:29121)
    at script(typescript-0.9.1.1.js:53984)
    at script(typescript-0.9.1.1.js:54017)
    at script(typescript-0.9.1.1.js:52857)
    at script(typescript-0.9.1.1.js:29626)
    at script(typescript-0.9.1.1.js:29460)
    at script(typescript-0.9.1.1.js:28649)
    at script(typescript-0.9.1.1.js:29030)
    at script(typescript-0.9.1.1.js:53663)
    at script(typescript-0.9.1.1.js:53064)
    at script(typescript-0.9.1.1.js:52857)
    at script(typescript-0.9.1.1.js:29626)
    at script(typescript-0.9.1.1.js:28543)
    at script(typescript-0.9.1.1.js:53200)
    at script(typescript-0.9.1.1.js:52857)
    at script(typescript-0.9.1.1.js:53927)
    at script(typescript-0.9.1.1.js:52857)
    at script(typescript-0.9.1.1.js:29626)
    at script(typescript-0.9.1.1.js:29572)
    at script(typescript-0.9.1.1.js:53725)
    at script(typescript-0.9.1.1.js:29626)
    at script(typescript-0.9.1.1.js:51786)
    at script(typescript.compile-0.4.js:102)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
    at org.mozilla.javascript.NativeArray.iterativeMethod(NativeArray.java:1584)
    at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:318)
    at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1473)
    at script(typescript.compile-0.4.js:99)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
    at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
    at org.mozilla.javascript.gen.compile_js_1._c_script_0(compile.js:1)
    at org.mozilla.javascript.gen.compile_js_1.call(compile.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.mozilla.javascript.gen.compile_js_1.call(compile.js)
    at org.mozilla.javascript.gen.compile_js_1.exec(compile.js)
    at org.mozilla.javascript.Context.evaluateString(Context.java:1079)
    at com.mangofactory.typescript.TypescriptCompiler.compile(TypescriptCompiler.java:73)
    at com.mangofactory.typescript.TypescriptCompiler.compile(TypescriptCompiler.java:103)
    at com.mangofactory.typescript.TypescriptCompiler.compile(TypescriptCompiler.java:97)
        ..............

The offending line 29132 of typescript-0.9.1.1 is:

            if ((pullDecl.flags & 8 /* Ambient */) === 8 /* Ambient */) {

Any ideas what is going wrong?

codler commented 10 years ago

I get this error also :S