Skip to content

Conversation

Janther
Copy link
Contributor

@Janther Janther commented Sep 30, 2025

Continuing with extracting variants from PolymorphicNodes.

In this PR

We address the following nodes

  • ConstructorAttribute
  • FallbackFunctionAttribute
  • FunctionAttribute
  • FunctionTypeAttribute
  • ModifierAttribute
  • ReceiveFunctionAttribute
  • StateVariableAttribute
  • UnnamedFunctionAttribute

On top of that, in every collection of these attributes we remove the printVariant as we don't need it anymore and instead of having 2 map functions chained, we just have 1 map to avoid looping twice.

We are also removing multiple destructuring of the variant attribute of these attributes.

Caveat
There was one test scenario that had to be fixed because before one comment would be associated to the PolymorphicNode and another to the variant, and now both of these comments are associated to the same node.

…onAttribute`, `FunctionTypeAttribute`, `ModifierAttribute`, `ReceiveFunctionAttribute`, `StateVariableAttribute`, and `UnnamedFunctionAttribute` from the AST tree
@Janther Janther requested a review from fvictorio September 30, 2025 23:41
Comment on lines +66 to +77
Exclude<
StrictAstNode,
| ArgumentsDeclaration
| ConstructorAttribute
| FallbackFunctionAttribute
| FunctionAttribute
| FunctionTypeAttribute
| ModifierAttribute
| ReceiveFunctionAttribute
| StateVariableAttribute
| UnnamedFunctionAttribute
>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the only section that for now looks a bit ugly to me, but it gets removed in the last step, for now we need to name every PolymorphicNode that we have successfully removed from the AST tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant