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

Handle CallExpression for debug macros. #46

Open
rwjblue opened this issue Jul 26, 2017 · 2 comments
Open

Handle CallExpression for debug macros. #46

rwjblue opened this issue Jul 26, 2017 · 2 comments

Comments

@rwjblue
Copy link
Member

rwjblue commented Jul 26, 2017

Currently, we are handling only ExpressionStatement's for debug macro replacement. Unfortunately, the following do not get processed (since they do not include an ExpressionStatement):

function foo() {
  return assert(false, 'derp'); // ReturnStatement
}

let qux = () => assert(false, 'herp'); // ArrowFunctionExpression

This is the underlying issue in emberjs/ember-cli-babel#168.

@josex2r
Copy link

josex2r commented Jan 16, 2018

Hi, I think I found a way to fix the issue in branch BBVAEngineering/use-call-expression, but I'm not sure if it's the correct way.
I was unable to use CallExpression at first level, don't know why but babel wasn't removing some line breaks :S

Then I tried another approach, use the visitors ReturnStatement and ArrowFunctionExpression to find the CallExpression and replace the debug functions.

All the tests seems to work but I couldn't try the branch in ember apps because when I link my package (npm link) to an Ember app the proccess always breaks with an exception:

Build Error (Babel) in ember-resolver/features.js # Any Ember package
Cannot read property '__esModule' of undefined

¿Any hints about linking this package to a project to test my branch?

@josex2r
Copy link

josex2r commented Jan 25, 2018

Finally I could check the changes, 3f902db was driving me crazy XD
It seems to be working fine in different apps so I've opened #56.

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

No branches or pull requests

2 participants