Repository navigation
fix(formatter): preserve statement boundaries in as-needed mode - #1760
magic-akari wants to merge 7 commits into
Conversation
…tions Use the actual emitted successor token and TypeScript contextual grammar to keep a standalone global expression separate.
Let unbraced nested statements report their actual trailing owners. Preserve authored do-while fences and ignore targets as the containing statement chooses its separator.
…ndaries Apply the same empty statement rules to print-time ownership and ASI lookahead, including when the retained ignore follows an elided separator.
Recognize a distinct closing type angle reached through an actual call operand. Keep a required statement boundary while leaving contiguous angle tokens and separate arrow bodies to their own syntax.
Share the physical colon and source comment packets between the label chain and label printer. Keep raw label and body protection independent of comment claims.
Reuse empty-statement retention with a snapshot of the original iterator only for a suppressed successor. Inspect a source terminator candidate only when one exists.
Binary size diffLinux x64 GNU · release · uncompressed, stripped bindings. Merge:
|
JavaScript API Gungraun benchmark diffBase: Values are shown as Download the raw Gungraun and Valgrind data (retained for 90 days). Callgrind metric changesMedian instruction counts from three processes, shown as compare / base in K (1,000), truncated to whole thousands. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged or overlapping ranges (inconclusive). JIT disabled (--jitless); predictable mode enabled (--predictable). Counts are not wall time. Exact counts, ranges and profiles are retained in artifacts. Generate
Lang
Parse
Source type
Walk
Benchmark resultsExact instruction counts: median (min–max).
|
Gungraun benchmark diffBase SHA: 07c93de Values are shown as Download the raw Gungraun and Valgrind data (retained for 90 days). Callgrind metric changesCallgrind instruction counts (Ir) for the compare and base revisions. Values are shown as compare / base in K (1,000), truncated to whole thousands. Multi-part profiles use the part numbers from Gungraun and include an aggregated Total. New and Removed identify benchmarks that exist on only one side; the missing value is shown as a dash. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged. Formatter
Generator
Minifier
Parser
Semantic
Transform
Type strip
Visit
Benchmark results |
Motivation
Semicolon lookahead can see an empty statement that the printer will drop or miss a boundary owned by an unbraced body. The resulting output can change how TypeScript parses adjacent statements or which statement
prettier-ignoreprotects.Changes
globalexpressions and between left shifts and calls that contain generic call arguments.do…while. Resolve label colons and protected labeled bodies from the original source.