Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fix for other types of nodes in referencePaths #123

Merged
merged 5 commits into from
Aug 29, 2016

Conversation

boopathi
Copy link
Member

@@ -873,4 +873,34 @@ describe("mangle-names", () => {
`);
expect(transform(source)).toBe(expected);
});

it("should handle export declarations", () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

should add this to DCE as well... or shall I add it to preset tests ?

@boopathi
Copy link
Member Author

regarding #122 , strangely it happens only for

function foo () {
  var a;
  if (a) {} else { 
    b() 
  }
}

and not for

function foo () {

  if (a) {} else { 
    b() 
  }
}

this is replaced to

function foo () {
  var a;
  if (!a) {
    b()
  }
}

and the referencePath of a is !a ...

const babel = require("babel-core");
const unpad = require("../../../utils/unpad");

function transform(code, options = {}, sourceType = "script") {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would make sense to move transform to utils and share among tests to avoid duplication?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah.. Like discussed here #76 ... separate PR for all these things ...

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, I forgot :) If you can make a PR for that, I'd gladly merge — would make tests a bit cleaner.

@kangax kangax merged commit 96e90e5 into master Aug 29, 2016
@kangax kangax deleted the fix-mangle-refPaths branch August 29, 2016 20:03
@hzoo hzoo added the bug Confirmed bug label Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants