Skip to content

Insert the result of --replacement-js as it is to close #689 - #749

Merged
mathiasrw merged 1 commit into
mainfrom
fix/689
Oct 23, 2026
Merged

mathiasrw merged 1 commit into
mainfrom
fix/689

Conversation

@mathiasrw

Copy link
Copy Markdown
Owner

Closes #689

Stacked on #748. Merge that first.

Change

  • When the code of --replacement-js does not use a captured group, it still runs only once per file, but its result is given to String.replace from a function. The result of a function is never expanded, so $&, $$, $` and $' in it are inserted as they are. This is how it already worked when a group is used.
  • With --output-match the code of --replacement-js is not run, as the replacement prints the matches. This is now said in doReplacement(). Before, it only worked because eval() of the --output-match function gave the function back.
  • The test.todo for Result of --replacement-js gets $& and $$ expanded #689 is now a real test.

@mathiasrw
mathiasrw added this pull request to stack #765 October 23, 2026 00:30
@mathiasrw
mathiasrw force-pushed the fix/689 branch 2 times, most recently from 5e26c51 to 2554bb7 Compare October 23, 2026 00:35
Base automatically changed from fix/688 to main October 23, 2026 00:36
@mathiasrw
mathiasrw merged commit 71616d3 into main Oct 23, 2026
7 checks passed
@mathiasrw
mathiasrw deleted the fix/689 branch October 23, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Result of --replacement-js gets $& and $$ expanded

1 participant