Open isakovarseniy opened 7 years ago
Hi
package t; public enum B implements I{ Q("q"), W("w"); private final String value; B(final String value) { this.value = value; } public String getValue() { return value; } }
package t; public interface I { }
package t; public class C { public void method (){ B b = B.Q; int i=0; if (b instanceof I){ i=1; } } }
Generated code for class B
namespace t { export class C { public method() { let b : t.B = t.B.Q; let i : number = 0; if(b != null && (b["__interfaces"] != null && b["__interfaces"].indexOf("t.I") >= 0 || b.constructor != null && b.constructor["__interfaces"] != null && b.constructor["__interfaces"].indexOf("t.I") >= 0)) { i = 1; } } } C["__class"] = "t.C"; }
let b : t.B = t.B.Q; // in this case b = 0
should be class
let b : t.B =B["_$wrappers"][t.B.Q]
if (b instanceof I){ i=1; //never happened }
BTW Correct me if I am wrong but I would probably put additional brackets
if( (//add ( b != null && (b["__interfaces"] != null && b["__interfaces"].indexOf("t.I") >= 0 )//add ) || ( //add ( b.constructor != null && b.constructor["__interfaces"] != null && b.constructor["__interfaces"].indexOf("t.I") >= 0) ) //add ) ) { i = 1;
Thanks Arseniy Isakov
That's a tricky one! Thank you for reporting and I'll keep in touch.
Hi
Generated code for class B
should be class
class does not have property "__interfaces"
BTW Correct me if I am wrong but I would probably put additional brackets
Thanks Arseniy Isakov