Skip to content

Array spread with function call broken in 0.2.0 #695

@AshleyScirra

Description

@AshleyScirra

Input Code

function foo()
{
	return [...bar].reverse();
};

Actual Output

function foo() {
	return [...bar]; // oops - where did reverse() go?
}

Expected Output

function foo() {
	return [...bar].reverse();
}

Details

I'd suspect it is reversing the elements in the array literal and removing the reverse() call, but it does not take in to account spread.
Workaround:

function foo()
{
	const ret = [...bar];
	return ret.reverse();
};

This keeps the reverse() call after minify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions