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

babili is removing function arguments in scope of eval call #366

Closed
targos opened this issue Jan 9, 2017 · 10 comments · Fixed by #371 or #763
Closed

babili is removing function arguments in scope of eval call #366

targos opened this issue Jan 9, 2017 · 10 comments · Fixed by #371 or #763
Assignees
Labels
bug Confirmed bug
Projects
Milestone

Comments

@targos
Copy link

targos commented Jan 9, 2017

The following code:

'use strict';
function myEval(code, _var_) {
  eval(code);
}
myEval('console.log(_var_)', 'myValue');

Is transformed to:

'use strict';function myEval(code){eval(code)}myEval('console.log(_var_)','myValue');

Which does not work.

I'm using babel-preset-babili v0.0.9. The bug was not present in v0.0.5. I suppose it was introduced in 10b114f.

@kangax
Copy link
Member

kangax commented Jan 9, 2017

I'm surprised this didn't break our eval tests.

@kangax
Copy link
Member

kangax commented Jan 9, 2017

@targos
Copy link
Author

targos commented Feb 16, 2017

I still get the same output with babili 0.0.11 which includes #371. Do I need to set an option?

@targos
Copy link
Author

targos commented Feb 18, 2017

Unless I'm mistaken, can this be reopen, please?

@boopathi
Copy link
Member

Oh. Yeah. I'll check this.

@boopathi boopathi reopened this Feb 18, 2017
@targos
Copy link
Author

targos commented Jun 26, 2017

Hello. Can you please open again? The issue is back in latest babili version (example).

targos added a commit to NPellet/visualizer that referenced this issue Jun 26, 2017
@boopathi
Copy link
Member

Interesting. I tried it with the master branch which was released a few days ago and this bug is not present. The repl is outdated I suppose - I'll check that.

@j-f1
Copy link
Contributor

j-f1 commented Jun 26, 2017

It looks like the REPL is running Babili 0.0.9 (run Babili.version in the DevTools), and the latest is 0.1.4

@targos
Copy link
Author

targos commented Jun 26, 2017

I checked with the latest release on my app. Maybe this testcase is too simple now. I will check again.

@targos
Copy link
Author

targos commented Jun 27, 2017

@boopathi here is the result I get with babel-preset-babili@0.1.4:

$ cat test.js
'use strict';
function myEval(code, _var_) {
  eval(code);
}
myEval('console.log(_var_)', 'myValue');

$ babel test.js --presets babili
'use strict';function myEval(a,b){eval(a)}myEval('console.log(_var_)','myValue');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
No open projects
5 participants