{{ message }}
Fix live debugger curried function instrumentation#441
Draft
watson wants to merge 1 commit into
Draft
Conversation
Contributor
Author
Arrow expression-body instrumentation rewrote the body's final character to add the outer suffix. When the expression body was itself a function or arrow, that character could also be the inner function's closing brace, so the outer write dropped the inner catch block and produced invalid JavaScript. Append the outer suffix after the expression body instead, preserving the inner function postamble. Add nested and curried regression cases that re-parse transformed output under both namedOnly modes.
503521e to
e5064e7
Compare
01561a1 to
937be82
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What and why?
Fixes a Live Debugger transform bug where curried functions like this could emit invalid JavaScript:
Before this fix, the outer arrow instrumentation could overwrite the inner function's closing-brace instrumentation. The generated output effectively looked like this, with the inner
trymissing itscatch/finally:That invalid output fails downstream parsers with errors like
Missing catch or finally clauseorExpected a semicolon.How?
The expression-body path now updates the first body character as before, but appends the suffix at
bodyEndinstead of rewriting[bodyEnd - 1, bodyEnd]. This keeps the inner block-body postamble intact when the arrow body is another function or arrow.Added table-driven nested-function regression coverage for named function expressions, exported function-expression factories, triple-nested callback shapes, and curried arrows across
namedOnlymodes.