cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 160 forks source link

__interfaces is defined twice with inheritance #104

Closed lgrignon closed 8 years ago

lgrignon commented 8 years ago

class A implements X {}

class B extends A {}

generates in TS two constructors: for A: public constructor() { Object.defineProperty(this, 'interfaces', { value: ["X"] }); } for B constructor() { Object.defineProperty(this, 'interfaces', { value: ["X"] }); }

2 problems: (i) call to super() is not printed ==> compilation error (ii) if super() explicitely written in jsweet; property __interfaces is defined twice ==> error at runtime

renaudpawlak commented 8 years ago

Thanks Louis, it is fixed. Sorry for the inconvenience :) Handling `instanceof`` for interfaces requires some runtime operations that might imply some side effects. It is getting better though. I have added some tests and will add more later.