Repository navigation
Fix mapping of tokens with generated nodes in between - #16948
nicolo-ribaudo merged 2 commits into
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/58292 |
kriskowal
left a comment
There was a problem hiding this comment.
This is very likely the trouble I ran into, though I have not yet isolated. Thank you!
| if (child == null) continue; | ||
| if (child.start == null || child.end == null) continue; |
There was a problem hiding this comment.
| if (child == null) continue; | |
| if (child.start == null || child.end == null) continue; | |
| if (child == null || child.start == null || child.end == null) continue; |
There was a problem hiding this comment.
Heheh unfortunately typescript-eslint complains that child == null || child.start == null should be rewritten to child?.start == null, but I find child?.start == null || child.end == null to be terrible so this two-lines solution was the compromise I reached with the linter :P
|
Whops, wrong commit message 😓 I'll at least rename the PR for the changelog |
|
I tried to use Before this PR, -__arrayFindLast(/* isOptionalObject */false, foo, callback);
+__arrayFindLast(/* isOptionalObject */false,foo,callback)Space between arguments are removed, comma not printed. After this PR, the output seems getting worse - __at(/* isOptionalObject */true,foo?.bar.baz,-1)
+ __at (/* isOptionalObject */true,foo?.bar.baz,-1)The call expression is generated by this function https://github.com/prettier/prettier/blob/1abee7352fe98f8d484a0e813ebe531fffb8503e/scripts/build/transform/transforms/create-method-call-transform.js#L30 I'm not sure how this works, and not really care about the output that much, but I guess worth to point it out. |
See the first commit to see the wrong output. The problem was that a
nullstart was flowing to the binary search, failing both<and>comparisons, and thus considering it as "matched" and returning the middle point.cc @kriskowal