termi / es6-transpiler

Tomorrow's JavaScript syntax today
Other
216 stars 18 forks source link

Wrong extends from class with dot in name #39

Closed theshock closed 10 years ago

theshock commented 10 years ago

EcmaScript 6 code:

var Namespace = {
    FooClass: function () {
        console.log('FooClass.constructor');
    }
};

class BarClass extends Namespace.FooClass {

    constructor () {
        console.log('FooClass.constructor');
        super();
    }

}

new BarClass();

Result JS code:

var Namespace = {
    FooClass: function () {
        console.log('FooClass.constructor');
    }
};

var BarClass = (function (super$0) {
    var MIXIN$0 = function (t, s) {
        for (var p in s) {
            if (s.hasOwnProperty(p)) {
                Object.defineProperty(t, p, Object.getOwnPropertyDescriptor(s, p));
            }
        }
        return t
    };
    MIXIN$0(BarClass, super$0);

    function BarClass() {
        console.log('FooClass.constructor');
        super$0.call(this);
    };
    return BarClass;
})();

new BarClass();

No class extends, as we can see. Expected correct extends.