Skip to content

refactor(linter): print strings without constructing ASTs#23786

Merged
graphite-app[bot] merged 1 commit into
mainfrom
c/linter-print-strings-without-ast
Jun 26, 2026
Merged

refactor(linter): print strings without constructing ASTs#23786
graphite-app[bot] merged 1 commit into
mainfrom
c/linter-print-strings-without-ast

Conversation

@camc314

@camc314 camc314 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace seven synthetic string literal AST constructions with Codegen::print_string
  • remove the associated temporary allocators, AST builders, and unused imports
  • preserve existing fixer options and generated output

Closes #23780.

Stack:

@github-actions github-actions Bot added the A-linter Area - Linter label Jun 25, 2026
@camc314 camc314 self-assigned this Jun 25, 2026
@codspeed-hq

codspeed-hq Bot commented Jun 25, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 66 skipped benchmarks1


Comparing c/linter-print-strings-without-ast (f24d8e1) with main (cd1fd12)

Open in CodSpeed

Footnotes

  1. 66 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 force-pushed the c/codegen-print-string branch from db56185 to 38b2399 Compare June 25, 2026 17:02
@camc314 camc314 requested a review from Dunqing as a code owner June 25, 2026 17:02
@camc314 camc314 force-pushed the c/linter-print-strings-without-ast branch from e8e061b to d5bba94 Compare June 25, 2026 17:04
graphite-app Bot pushed a commit that referenced this pull request Jun 26, 2026
## Summary

- expose `Codegen::print_string` for printing an escaped JavaScript string literal from `&str`
- share the existing string escaping implementation without constructing an AST
- disallow template literal output so the API is safe in string-literal-only contexts
- add coverage for quote selection, escaping, Unicode, and minified output

Part of #23780.

**Stack:**
 - #23786
 - #23785 (this PR)
 - #23782
@graphite-app graphite-app Bot force-pushed the c/codegen-print-string branch from 38b2399 to cd1fd12 Compare June 26, 2026 17:09

@overlookmotel overlookmotel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Will merge as soon as #23785 is merged.

Base automatically changed from c/codegen-print-string to main June 26, 2026 17:38
@github-actions github-actions Bot added the A-codegen Area - Code Generation label Jun 26, 2026
@overlookmotel overlookmotel force-pushed the c/linter-print-strings-without-ast branch from d5bba94 to f24d8e1 Compare June 26, 2026 17:41
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jun 26, 2026

overlookmotel commented Jun 26, 2026

Copy link
Copy Markdown
Member

Merge activity

## Summary

- replace seven synthetic string literal AST constructions with `Codegen::print_string`
- remove the associated temporary allocators, AST builders, and unused imports
- preserve existing fixer options and generated output

Closes #23780.

**Stack:**
 - #23786 (this PR)
 - #23785
 - #23782
@graphite-app graphite-app Bot force-pushed the c/linter-print-strings-without-ast branch from f24d8e1 to 7c7ce24 Compare June 26, 2026 17:51
@graphite-app graphite-app Bot merged commit 7c7ce24 into main Jun 26, 2026
29 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jun 26, 2026
@graphite-app graphite-app Bot deleted the c/linter-print-strings-without-ast branch June 26, 2026 17:56
camc314 added a commit that referenced this pull request Jul 3, 2026
## Summary

- expose `Codegen::print_string` for printing an escaped JavaScript string literal from `&str`
- share the existing string escaping implementation without constructing an AST
- disallow template literal output so the API is safe in string-literal-only contexts
- add coverage for quote selection, escaping, Unicode, and minified output

Part of #23780.

**Stack:**
 - #23786
 - #23785 (this PR)
 - #23782
camc314 added a commit that referenced this pull request Jul 3, 2026
## Summary

- replace seven synthetic string literal AST constructions with `Codegen::print_string`
- remove the associated temporary allocators, AST builders, and unused imports
- preserve existing fixer options and generated output

Closes #23780.

**Stack:**
 - #23786 (this PR)
 - #23785
 - #23782
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: avoid constructing an AST to print a string

2 participants