Skip to content

Support exiting scope before last field #[scope(exit_before)] #6311

@overlookmotel

Description

@overlookmotel

oxc_ast_tools recognises #[scope(enter_before)] to mark a field as the start of the scope in a type. We also need #[scope(exit_before)] for #6270.

Note: I think #[scope(exit_before)] is better than #[scope(exit_after)] because attributes go before fields, so it reads more clearly:

pub struct TSConditionalType<'a> {
    pub span: Span,
    pub check_type: TSType<'a>,
    #[scope(enter_before)]
    pub extends_type: TSType<'a>,
    pub true_type: TSType<'a>,
    #[scope(exit_before)]
    pub false_type: TSType<'a>,
    pub scope_id: Cell<Option<ScopeId>>,
}

We will need to build support for this into both:

  1. oxc_ast_tools and the Visit / VisitMut generator.
  2. oxc_traverse's codegen.

Metadata

Metadata

Assignees

Labels

A-ast-toolsArea - AST toolsC-enhancementCategory - New feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions