Skip to content

[Transforms] Incorrectly emit this as _this  #7909

@mhegazy

Description

@mhegazy

Expected:

var obj = {
    __proto__: {
        method: function () {
        }
    },
    method: function () {
        _super.prototype.method.call(this);
    },
    get prop() {
        _super.prototype.method.call(this);
        return 10;
    },
    set prop(value) {
        _super.prototype.method.call(this);
    },
    p1: function () {
        _super.method.call(this);
    },
    p2: function f() {
        _super.method.call(this);
    },
    p3: function () {
        _super.method.call(this);
    }
};

Actual:

var _this = this;
var obj = {
    __proto__: {
        method: function () {
        }
    },
    method: function () {
        _super.prototype.method.call(this);
    },
    get prop() {
        _super.prototype.method.call(this);
        return 10;
    },
    set prop(value) {
        _super.prototype.method.call(this);
    },
    p1: function () {
        _super.method.call(this);
    },
    p2: function f() {
        _super.method.call(this);
    },
    p3: function () {
        _super.method.call(_this);
    }
};

Failed tests:

  • tests\cases\compiler\superInObjectLiterals_ES5.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: API: TransformsRelates to the public transform APIFixedA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions