oxc/crates
rzvxa d347aedfda feat(ast)!: generate ast_builder.rs. (#3890)
### Every structure has 2 builder methods:

1. `xxx` e.g. `block_statement`
```rust
    #[inline]
    pub fn block_statement(self, span: Span, body: Vec<'a, Statement<'a>>) -> BlockStatement<'a> {
        BlockStatement { span, body, scope_id: Default::default() }
    }
```
2. `alloc_xxx` e.g. `alloc_block_statement`
```rust
    #[inline]
    pub fn alloc_block_statement(
        self,
        span: Span,
        body: Vec<'a, Statement<'a>>,
    ) -> Box<'a, BlockStatement<'a>> {
        self.block_statement(span, body).into_in(self.allocator)
    }
```

### We generate 3 types of methods for enums:

1. `yyy_xxx` e.g. `statement_block`
```rust
    #[inline]
    pub fn statement_block(self, span: Span, body: Vec<'a, Statement<'a>>) -> Statement<'a> {
        Statement::BlockStatement(self.alloc(self.block_statement(span, body)))
    }
```
2. `yyy_from_xxx` e.g. `statement_from_block`
```rust
    #[inline]
    pub fn statement_from_block<T>(self, inner: T) -> Statement<'a>
    where
        T: IntoIn<'a, Box<'a, BlockStatement<'a>>>,
    {
        Statement::BlockStatement(inner.into_in(self.allocator))
    }
```
3. `yyy_xxx` where `xxx` is inherited e.g. `statement_declaration`
```rust
    #[inline]
    pub fn statement_declaration(self, inner: Declaration<'a>) -> Statement<'a> {
        Statement::from(inner)
    }
```

------------

### Generic parameters:

We no longer accept `Box<'a, ADT>`, `Atom` or `&'a str`, Instead we use `IntoIn<'a, Box<'a, ADT>>`, `IntoIn<'a, Atom<'a>>` and `IntoIn<'a, &'a str>` respectively.
It allows us to rewrite things like this:
```rust
let ident = IdentifierReference::new(SPAN, Atom::from("require"));
let number_literal_expr = self.ast.expression_numeric_literal(
    right_expr.span(),
    num,
    raw,
    self.ast.new_str(num.to_string().as_str()),
    NumberBase::Decimal,
);
```
As this:
```rust
let ident = IdentifierReference::new(SPAN, "require");
let number_literal_expr = self.ast.expression_numeric_literal(
    right_expr.span(),
    num,
    raw,
    num.to_string(),
    NumberBase::Decimal,
);
```
2024-07-09 00:57:26 +00:00
..
oxc Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_allocator Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_ast feat(ast)!: generate ast_builder.rs. (#3890) 2024-07-09 00:57:26 +00:00
oxc_ast_macros Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_cfg Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_codegen feat(oxc_codegen): generate annotation comments before CallExpression and NewExpression (#4119) 2024-07-09 00:22:28 +08:00
oxc_diagnostics Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_index Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_isolated_declarations feat(ast)!: generate ast_builder.rs. (#3890) 2024-07-09 00:57:26 +00:00
oxc_js_regex
oxc_language_server
oxc_linter fix(linter): incorrect fixer for no-unused-labels (#4123) 2024-07-08 17:58:59 -04:00
oxc_macros
oxc_minifier feat(ast)!: generate ast_builder.rs. (#3890) 2024-07-09 00:57:26 +00:00
oxc_module_lexer Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_parser feat(ast)!: generate ast_builder.rs. (#3890) 2024-07-09 00:57:26 +00:00
oxc_prettier feat(ast,codegen): add TSParenthesizedType and print type parentheses correctly (#3979) 2024-06-30 07:57:48 +00:00
oxc_semantic feat(semantic): check for abstract initializations and implementations (#4125) 2024-07-08 17:30:16 -04:00
oxc_sourcemap Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_span feat(span): add various implementations of FromIn for Atom. (#4090) 2024-07-08 15:32:57 +00:00
oxc_syntax Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_transformer feat(ast)!: generate ast_builder.rs. (#3890) 2024-07-09 00:57:26 +00:00
oxc_traverse Release crates v0.17.2 (#4115) 2024-07-08 19:16:33 +08:00
oxc_wasm refactor(transformer): pass in symbols and scopes (#3978) 2024-06-30 06:33:48 +00:00