Skip to content

refactor(ast/estree): use #[estree(prepend_to)]#10862

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-07-refactor_ast_estree_use_estree_prepend_to_
May 7, 2025
Merged

refactor(ast/estree): use #[estree(prepend_to)]#10862
graphite-app[bot] merged 1 commit intomainfrom
05-07-refactor_ast_estree_use_estree_prepend_to_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 7, 2025

Pure refactor. Use #[estree(prepend_to = ...)] (introduced in #10849) to concatenate directives and statements in ESTree AST.

Previously we had hacks like this:

pub struct Program<'a> {
    #[estree(rename = "body")]
    pub directives: Vec<'a, Directive<'a>>,
    #[estree(append_to = "directives")]
    pub body: Vec<'a, Statement<'a>>,
}

Instead we can do this which is easier to read, and simpler for oxc_ast_tools to generate code for:

pub struct Program<'a> {
    #[estree(prepend_to = "body")]
    pub directives: Vec<'a, Directive<'a>>,
    pub body: Vec<'a, Statement<'a>>,
}

Copy link
Member Author

overlookmotel commented May 7, 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-ast Area - AST C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels May 7, 2025
@overlookmotel overlookmotel marked this pull request as ready for review May 7, 2025 13:15
@codspeed-hq
Copy link

codspeed-hq bot commented May 7, 2025

CodSpeed Instrumentation Performance Report

Merging #10862 will not alter performance

Comparing 05-07-refactor_ast_estree_use_estree_prepend_to_ (0f7e755) with main (d066516)

Summary

✅ 36 untouched benchmarks

@overlookmotel
Copy link
Member Author

No change to generated code, just makes AST type defs more readable, so merging without review.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label May 7, 2025
Copy link
Member Author

overlookmotel commented May 7, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 05-07-feat_ast_tools_support_estree_prepend_to_ branch from 7015811 to d066516 Compare May 7, 2025 13:25
graphite-app bot pushed a commit that referenced this pull request May 7, 2025
Pure refactor. Use `#[estree(prepend_to = ...)]` (introduced in #10849) to concatenate directives and statements in ESTree AST.

Previously we had hacks like this:

```rs
pub struct Program<'a> {
    #[estree(rename = "body")]
    pub directives: Vec<'a, Directive<'a>>,
    #[estree(append_to = "directives")]
    pub body: Vec<'a, Statement<'a>>,
}
```

Instead we can do this which is easier to read, and simpler for `oxc_ast_tools` to generate code for:

```rs
pub struct Program<'a> {
    #[estree(prepend_to = "body")]
    pub directives: Vec<'a, Directive<'a>>,
    pub body: Vec<'a, Statement<'a>>,
}
```
@graphite-app graphite-app bot force-pushed the 05-07-refactor_ast_estree_use_estree_prepend_to_ branch from 8ab06bb to 3ea4462 Compare May 7, 2025 13:26
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 7, 2025
Base automatically changed from 05-07-feat_ast_tools_support_estree_prepend_to_ to main May 7, 2025 13:32
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label May 7, 2025
Pure refactor. Use `#[estree(prepend_to = ...)]` (introduced in #10849) to concatenate directives and statements in ESTree AST.

Previously we had hacks like this:

```rs
pub struct Program<'a> {
    #[estree(rename = "body")]
    pub directives: Vec<'a, Directive<'a>>,
    #[estree(append_to = "directives")]
    pub body: Vec<'a, Statement<'a>>,
}
```

Instead we can do this which is easier to read, and simpler for `oxc_ast_tools` to generate code for:

```rs
pub struct Program<'a> {
    #[estree(prepend_to = "body")]
    pub directives: Vec<'a, Directive<'a>>,
    pub body: Vec<'a, Statement<'a>>,
}
```
@overlookmotel overlookmotel force-pushed the 05-07-refactor_ast_estree_use_estree_prepend_to_ branch from 3ea4462 to 0f7e755 Compare May 7, 2025 13:55
@graphite-app graphite-app bot merged commit 0f7e755 into main May 7, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 05-07-refactor_ast_estree_use_estree_prepend_to_ branch May 7, 2025 14:02
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant