Skip to content

fix(parser): store lone surrogates in TemplateElementValue as escape sequence#10182

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-02-fix_parser_store_lone_surrogates_in_templateelementvalue_as_escape_sequence
Apr 2, 2025
Merged

fix(parser): store lone surrogates in TemplateElementValue as escape sequence#10182
graphite-app[bot] merged 1 commit intomainfrom
04-02-fix_parser_store_lone_surrogates_in_templateelementvalue_as_escape_sequence

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Apr 2, 2025

Encode lone surrogates in cooked property of TemplateElementValue using same encoding scheme as for StringLiterals.

In fact, they were already being encoded like this after #10041, but add a lone_surrogates flag to TemplateLiteral to decode them correctly in ESTree AST.

oxc_codegen ignores cooked and just prints raw, so needs no alteration.

Copy link
Member Author

overlookmotel commented Apr 2, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-parser Area - Parser A-ast Area - AST C-bug Category - Bug labels Apr 2, 2025
@overlookmotel overlookmotel marked this pull request as ready for review April 2, 2025 10:56
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 2, 2025

CodSpeed Instrumentation Performance Report

Merging #10182 will create unknown performance changes

Comparing 04-02-fix_parser_store_lone_surrogates_in_templateelementvalue_as_escape_sequence (27768a5) with main (775abac)

Summary

🆕 36 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 codegen[checker.ts] N/A 22.5 ms N/A
🆕 codegen_sourcemap[checker.ts] N/A 65.5 ms N/A
🆕 formatter[antd.js] N/A 7.9 ms N/A
🆕 formatter[react.development.js] N/A 43.6 µs N/A
🆕 formatter[typescript.js] N/A 7.2 ms N/A
🆕 isolated-declarations[vue-id.ts] N/A 58.3 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 21.5 µs N/A
🆕 lexer[antd.js] N/A 24.8 ms N/A
🆕 lexer[cal.com.tsx] N/A 5.9 ms N/A
🆕 lexer[checker.ts] N/A 14.8 ms N/A
🆕 lexer[pdf.mjs] N/A 3.9 ms N/A
🆕 linter[RadixUIAdoptionSection.jsx] N/A 2.7 ms N/A
🆕 linter[cal.com.tsx] N/A 1.2 s N/A
🆕 linter[checker.ts] N/A 3 s N/A
🆕 mangler[antd.js] N/A 16 ms N/A
🆕 mangler[react.development.js] N/A 295.7 µs N/A
🆕 mangler[typescript.js] N/A 39.7 ms N/A
🆕 minifier[antd.js] N/A 166.2 ms N/A
🆕 minifier[react.development.js] N/A 1.9 ms N/A
🆕 minifier[typescript.js] N/A 293.1 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@overlookmotel overlookmotel marked this pull request as draft April 2, 2025 11:09
@overlookmotel overlookmotel force-pushed the 04-02-fix_parser_store_lone_surrogates_in_templateelementvalue_as_escape_sequence branch from 2c70b2c to 3bca1f2 Compare April 2, 2025 11:24
@overlookmotel overlookmotel marked this pull request as ready for review April 2, 2025 11:25
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Apr 2, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Apr 2, 2025

Merge activity

…e sequence (#10182)

Encode lone surrogates in `cooked` property of `TemplateElementValue` using same encoding scheme as for `StringLiteral`s.

In fact, they were already being encoded like this after #10041, but add a `lone_surrogates` flag to `TemplateLiteral` to decode them correctly in ESTree AST.

`oxc_codegen` ignores `cooked` and just prints `raw`, so needs no alteration.
@graphite-app graphite-app bot force-pushed the 04-02-fix_parser_fix_parsing_lone_surrogates_in_stringliteral_s branch from 74ec89a to 38d2bea Compare April 2, 2025 12:59
@graphite-app graphite-app bot force-pushed the 04-02-fix_parser_store_lone_surrogates_in_templateelementvalue_as_escape_sequence branch from 3bca1f2 to 27768a5 Compare April 2, 2025 12:59
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 2, 2025
Base automatically changed from 04-02-fix_parser_fix_parsing_lone_surrogates_in_stringliteral_s to main April 2, 2025 13:13
@graphite-app graphite-app bot merged commit 27768a5 into main Apr 2, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 04-02-fix_parser_store_lone_surrogates_in_templateelementvalue_as_escape_sequence branch April 2, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant