Skip to content

2.7: strange code generated for calling base methods ((_a = _super.prototype.method).call.call) #21543

@evil-shrike

Description

@evil-shrike

After I recompile my project with TS 2.7.1 I notice pretty strange code in many (but not all) classes.

Before:

    peObjectList.prototype.createCommands = function () {
        var that = this, commands = _super.prototype.createCommands.call(that);
        commands.SelectAll = new core.commands.BoundCommand(that.doSelectAll, that.canSelectAll, that);
        return commands;
    };

After:

    peObjectList.prototype.createCommands = function () {
        var that = this, commands = (_a = _super.prototype.createCommands).call.call(_a, that);
        commands.SelectAll = new core.commands.BoundCommand(that.doSelectAll, that.canSelectAll, that);
        return commands;
        var _a;
    };

Original TS code:

protected createCommands(): lang.Map<ICommand> {
    let that = this,
        commands = super.createCommands.call(that);
    commands.SelectAll = new core.commands.BoundCommand(that.doSelectAll, that.canSelectAll, that);
    return commands;
}

May I ask why is it needed to call base methods via so strange construct (.call.call)?

I haven't found any info on this mentioned in release notes.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions