Skip to content

refactor(ast): remove TSEnumBody#2509

Merged
Boshen merged 1 commit intomainfrom
02-26-refactor_ast_remove_TSEnumBody_
Feb 26, 2024
Merged

refactor(ast): remove TSEnumBody#2509
Boshen merged 1 commit intomainfrom
02-26-refactor_ast_remove_TSEnumBody_

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Feb 26, 2024

No description provided.

Copy link
Member Author

Boshen commented Feb 26, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@github-actions github-actions bot added A-linter Area - Linter A-ast Area - AST A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation labels Feb 26, 2024
@Boshen Boshen merged commit 540f917 into main Feb 26, 2024
@Boshen Boshen deleted the 02-26-refactor_ast_remove_TSEnumBody_ branch February 26, 2024 04:44
Copy link
Member Author

Boshen commented Feb 26, 2024

Merge activity

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 26, 2024

CodSpeed Performance Report

Merging #2509 will not alter performance

Comparing 02-26-refactor_ast_remove_TSEnumBody_ (6fd126f) with main (b8764a8)

Summary

✅ 27 untouched benchmarks

}
/// Enum Body
///
/// A scope must be created on the enum body so this abstraction exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I inlined enter / leave scope into the visitor function for now.

IWANABETHATGUY pushed a commit to IWANABETHATGUY/oxc that referenced this pull request May 29, 2024
overlookmotel pushed a commit that referenced this pull request Apr 3, 2025
Part of #9705 

This PR fixes AST structure of `TSEnumDeclaration` from:

```js
{
  "type": "TSEnumDeclaration",
  "id": { /* ... */ },
  "members": [
    {
      "type": "TSEnumMember",
      "id": { /* ... */ },
      "initializer": null
    }
  ],
  "const": false,
  "declare": false
}
```

to:

```js
{
  "type": "TSEnumDeclaration",
  "id": { /* ... */ },
  "body": {
    "type": "TSEnumBody",
    "members": [
	    {
	      "type": "TSEnumMember",
          "id": { /* ... */ },
	      "initializer": null
	    }
	  ],
  },
  "const": false,
  "declare": false
}
```

>
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts
>
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/ast-spec/src/special/TSEnumBody/spec.ts

Historically, we had this node in the past, but it seems to have been
deleted in #2509 .

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
overlookmotel pushed a commit that referenced this pull request Apr 9, 2025
Fixes #10087 

---

Follow up for #10017 .

This PR eliminates the part where nodes were manually generated for
JS-land AST.

NOTE: This node was originally present, but was removed at #2509 and is
now being reintroduced to get the correct `Span` position for #9705 .

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-codegen Area - Code Generation A-linter Area - Linter A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants