Skip to content

fix chained assignment with unused#1540

Merged
alexlamsl merged 1 commit intomishoo:masterfrom
alexlamsl:issue-1539
Mar 2, 2017
Merged

fix chained assignment with unused#1540
alexlamsl merged 1 commit intomishoo:masterfrom
alexlamsl:issue-1539

Conversation

@alexlamsl
Copy link
Copy Markdown
Collaborator

When #1450 optimises a=b=42, it stops after the first variable even if both are unused.

When mishoo#1450 optimises `a=b=42`, it stops after the first variable even if both are unused.

fixes mishoo#1539
@alexlamsl alexlamsl changed the title fix chained assignment with unsued fix chained assignment with unused Mar 2, 2017
}
expect: {
function f() {
return 42;
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.

How does this optimization take place at all with both reduce_vars and collapse_vars disabled?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

sequence:

  • a = b = 42; return a; ➡️ return (a = b = 42), a;

side_effects + cascade:

  • (a = b = 42), a ➡️ b = 42

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

It's cascade. Never used that one before.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Well, it's on by default. I run into that when I was working on #1460

@alexlamsl alexlamsl merged commit 17b8135 into mishoo:master Mar 2, 2017
@alexlamsl alexlamsl deleted the issue-1539 branch March 2, 2017 20:45
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.

2 participants