Skip to content

Fixed empty destructuring declarations/assignments in for...of loops#658

Merged
tomblind merged 5 commits intomasterfrom
bugfix/forof-empty-destructuring
Jul 10, 2019
Merged

Fixed empty destructuring declarations/assignments in for...of loops#658
tomblind merged 5 commits intomasterfrom
bugfix/forof-empty-destructuring

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

@tomblind tomblind commented Jul 9, 2019

fixes #607

expect(result).toBe("0a1b2c");
});

test("forof array empty destructuring declaration", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaration/assignment versions of each test take quite a lot of space, maybe it would be better to generate them if the only difference is const []/[]? Something like:

describe("for...of empty destructuring", () => {
    const declareTests = (destructuringPrefix: string) => {
        test("array", () => {
            const code = `
                const arr = [["a"], ["b"], ["c"]];
                let i = 0;
                for (${destructuringPrefix}[] of arr) {
                    ++i;
                }
                return i;
            `;
            expect(util.transpileAndExecute(code)).toBe(3);
        });

        // ...
    };

    describe("declaration", () => declareTests("const "));
    describe("assignment", () => declareTests(""));
});

Copy link
Copy Markdown
Member

@Perryvw Perryvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but fix the build please :)

@tomblind tomblind merged commit 6058224 into master Jul 10, 2019
@tomblind tomblind deleted the bugfix/forof-empty-destructuring branch July 10, 2019 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

luaIterator + tupleReturn used with empty destructuring

3 participants