Skip to content

Another Temporary variable declared too late #15342

Closed
@peblpebl

Description

@peblpebl

Code

playground

class C {
foo(arg1, arg2) {
[arg1, arg2] = [arg2, arg1];
return arg1;
}
}

Expected behavior:

I would expect any temporary variable declaration to be inserted before use (in this case _a).
I would certainly not expect it after a return statement , giving unreachable code.

Actual behavior:

var C = (function () {
function C() {
}
C.prototype.foo = function (arg1, arg2) {
_a = [arg2, arg1], arg1 = _a[0], arg2 = _a[1];
return arg1;
var _a;
};
return C;
}());

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions