We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
babel/babel#301
Following code incorrectly compiles because the property key identifier err is turned into context$1$0.t0:
err
context$1$0.t0
Input:
function* foo() { try { yield someValue; } catch (err) { var obj = {err: err}; } }
Output:
var foo = regeneratorRuntime.mark(function foo() { var obj; return regeneratorRuntime.wrap(function foo$(context$1$0) { while (1) switch (context$1$0.prev = context$1$0.next) { case 0: context$1$0.prev = 0; context$1$0.next = 3; return someValue; case 3: context$1$0.next = 8; break; case 5: context$1$0.prev = 5; context$1$0.t0 = context$1$0["catch"](0); obj = {context$1$0.t0: context$1$0.t0}; case 8: case "end": return context$1$0.stop(); } }, foo, this, [[0, 5]]); });
The text was updated successfully, but these errors were encountered:
The current replacement implementation is pretty naive. It doesn't take into account MemberExpression properties etc.
MemberExpression
This:
function* foo() { try { yield someValue; } catch (err) { test.err } }
Gets turned into:
var foo = regeneratorRuntime.mark(function foo() { return regeneratorRuntime.wrap(function foo$(context$1$0) { while (1) switch (context$1$0.prev = context$1$0.next) { case 0: context$1$0.prev = 0; context$1$0.next = 3; return someValue; case 3: context$1$0.next = 8; break; case 5: context$1$0.prev = 5; context$1$0.t4 = context$1$0["catch"](0); test.context$1$0.t4; case 8: case "end": return context$1$0.stop(); } }, foo, this, [[0, 5]]); });
Sorry, something went wrong.
Definitely a bug. We probably need something like isReference to do this right: https://github.com/eventualbuddha/ast-util/blob/9bf91c5ce8/lib/index.js#L454-L507
isReference
1df1608
Be smarter about renaming catch parameters.
52a9dc8
Fixes #154.
No branches or pull requests
babel/babel#301
Following code incorrectly compiles because the property key identifier
err
is turned intocontext$1$0.t0
:Input:
Output:
The text was updated successfully, but these errors were encountered: