eclipse / n4js

Eclipse Public License 1.0
30 stars 27 forks source link

Transpiler misses out spec constructor initialization of fields defined in structural interfaces #2541

Closed mmews-n4 closed 11 months ago

mmews-n4 commented 1 year ago

Example

export public interface ~Foo {
    public foo: string;
}

export public abstract class Base {
    public constructor(@Spec spec: ~i~this) {}
}

export public class Bar extends Base implements Foo {
    public baz: int;
}

Transpiled (wrong) output

// Generated by N4JS transpiler; for copyright see original N4JS source file.

import 'n4js-runtime'

export class Base extends N4Object {
    constructor(spec) {
        super();
        const $specObj = spec || {};
    }
    static get n4type() {
        return $getReflectionForClass(this, '["Base","n4/app/reservation/service/action/foo","@enfore/opr-app"]');
    }
}
export class Bar extends Base {
    constructor(spec) {
        super(spec);
        const $specObj = spec || {};
        this.baz = $specObj.baz;
    }
    static get n4type() {
        return $getReflectionForClass(this, '["Bar","n4/app/reservation/service/action/foo","@enfore/opr-app",["f.baz","f:foo"]]');
    }
}