-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
handle deopt case in builtins properly #533
Conversation
vigneshshanmugam
commented
May 11, 2017
•
edited
Loading
edited
- Deopt case was not there for classBody
- handle the case when creating segments when the parentPath is not a function.
- fix babilified code fails at runtime on SystemJS #458
- fix Hoisted or aliased variable issue with webpack #529
); | ||
t.traverseFast(node, subNode => { | ||
if (t.isFunction(subNode)) { | ||
funcNode = subNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will try this with generators if we can avoid full traversal.
99fb95e
to
43c76ed
Compare
Codecov Report
@@ Coverage Diff @@
## master #533 +/- ##
=========================================
- Coverage 83.26% 83.2% -0.06%
=========================================
Files 34 34
Lines 2539 2549 +10
Branches 908 915 +7
=========================================
+ Hits 2114 2121 +7
- Misses 254 256 +2
- Partials 171 172 +1
Continue to review full report at Codecov.
|
7c6e066
to
d9129c6
Compare
@boopathi This is ready for review now and all the edge cases and included in the test. |
return path; | ||
} | ||
} | ||
return void 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this statement is not required
if (!(lastCommon.isProgram() || funParent.isProgram())) { | ||
segments.set(funParent, paths); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in both the above conditions, lastCommon.isProgram()
should be false. So, maybe something like this -
let fnParent;
if (!lastCommon.isProgram()) {
if (lastCommon.isFunction()) {
segments.set(lastCommon, paths);
return;
} else if (!(fnParent = lastCommon.getFunctionParent()).isProgram()) {
segments.set(fnParent, paths);
return;
}
}
Let's also handle the case where the arrowFn body isn't a block statement. for example: function foo() {
const x = () => Math.max(Math.max(a,b), Math.max(Math.floor(b), Math.floor(c)))
} |
Good catch. de-opting for now. |