Skip to content

fix: minify infinity in expressions#841

Merged
vigneshshanmugam merged 3 commits intomasterfrom
infinity-1
May 14, 2018
Merged

fix: minify infinity in expressions#841
vigneshshanmugam merged 3 commits intomasterfrom
infinity-1

Conversation

@boopathi
Copy link
Copy Markdown
Member

Fix #839

@@ -0,0 +1,6 @@
let x = [1 / 0, 1 / 0];
let y = [{
a: Infinity
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should expect a: 1 / 0, I think.

}

const bindingIds = path.parentPath.getBindingIdentifierPaths();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems to work. If I'm reading it right, could

        for (const id of Object.keys(bindingIds)) {
          if (
            id === "Infinity" &&
            bindingIds[id] === path &&
            // ObjectProperty is common for ObjectExpression and ObjectPattern and only
            // one of them is a Binding, the other is simply a reference
            !path.parentPath.parentPath.isObjectExpression()
          ) {
            return;
          }
        }

be simplified to this?

        if (
          bindingIds["Infinity"] === path &&
            // ObjectProperty is common for ObjectExpression and ObjectPattern and only
            // one of them is a Binding, the other is simply a reference
            !path.parentPath.parentPath.isObjectExpression()
          ) {
          return;
        }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tag: Bug Fix Pull Request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants