docs(oxc_parser): add header symbol for parser.unexpected's doc comment#24
Merged
Merged
Conversation
Member
|
(github on mobile is not easy to use so I accidentally closed this and then reopened again.) Keep on learning, and we will see more contributions from you. |
graphite-app Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
This avoids calling `Expression::span()` when wrapping an expression-bodied arrow function in a synthetic `ExpressionStatement`. The parser already knows the expression body starts at the current token before parsing and ends at `prev_token_end` afterwards, so this can use `start_span()` / `end_span()` directly. That keeps the returned `Expression` in registers instead of materializing it on the stack just to call the generated `GetSpan` impl. Before, the optimized parser assembly spilled the returned expression and called `Expression::span()`: ```asm bl parse_assignment_expression_or_higher_impl mov x20, x0 mov x22, x1 strh w21, [x19, #1196] strb w0, [sp, #16] str x1, [sp, #24] add x0, sp, #16 bl GetSpan_for_Expression_span ... str x0, [x21] ; ExpressionStatement span strb w20, [x21, #16] ; Expression tag str x22, [x21, #24] ; Expression payload ``` After, the span is built from parser token state and the expression result is written directly into the arena allocation: ```asm ldr x20, [x0, #816] ; current token span before parse ... bl parse_assignment_expression_or_higher_impl strh w21, [x19, #1196] ldr w8, [x19, #1192] ; previous token end after parse bfi x20, x8, #32, #32 ... str x20, [x21] ; ExpressionStatement span strb w0, [x21, #16] ; Expression tag str x1, [x21, #24] ; Expression payload ``` This also reduced the first monomorphized parse_arrow_function_expression_body stack frame from 432 bytes to 416 bytes in my local release assembly.
camc314
added a commit
that referenced
this pull request
Jul 3, 2026
This avoids calling `Expression::span()` when wrapping an expression-bodied arrow function in a synthetic `ExpressionStatement`. The parser already knows the expression body starts at the current token before parsing and ends at `prev_token_end` afterwards, so this can use `start_span()` / `end_span()` directly. That keeps the returned `Expression` in registers instead of materializing it on the stack just to call the generated `GetSpan` impl. Before, the optimized parser assembly spilled the returned expression and called `Expression::span()`: ```asm bl parse_assignment_expression_or_higher_impl mov x20, x0 mov x22, x1 strh w21, [x19, #1196] strb w0, [sp, #16] str x1, [sp, #24] add x0, sp, #16 bl GetSpan_for_Expression_span ... str x0, [x21] ; ExpressionStatement span strb w20, [x21, #16] ; Expression tag str x22, [x21, #24] ; Expression payload ``` After, the span is built from parser token state and the expression result is written directly into the arena allocation: ```asm ldr x20, [x0, #816] ; current token span before parse ... bl parse_assignment_expression_or_higher_impl strh w21, [x19, #1196] ldr w8, [x19, #1192] ; previous token end after parse bfi x20, x8, #32, #32 ... str x20, [x21] ; ExpressionStatement span strb w0, [x21, #16] ; Expression tag str x1, [x21, #24] ; Expression payload ``` This also reduced the first monomorphized parse_arrow_function_expression_body stack frame from 432 bytes to 416 bytes in my local release assembly.
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.
Description
It seems that there should exist a
#symbol to makePanicsbe an title when user see the document comment.Additional Information
I'm highly interested in this project, but I'm a newbie in Rust and compiler. Currently trying to understand the compiler concepts from the guide you wrote and trying to understand this great project :)
I'm also not good at english writing, so if I have written anything that offend you, please accept my apologies.