Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ast function types #3931

Merged
merged 2 commits into from
Aug 18, 2024
Merged

Refactor ast function types #3931

merged 2 commits into from
Aug 18, 2024

Conversation

raskad
Copy link
Member

@raskad raskad commented Jul 21, 2024

Depends on #3917

This PR refactors the way we represent functions and classes in our AST to decrease ambiguities. It also refactors the way we parse named named executions of anonymous functions, reducing the complexity in the parser and aligning the handling more with the spec.

These are the changes:

  • Refactor handling of anonymous function names
    • Remove pass trough of names in parser
    • Set anonymous function names if needed while parsing assignment expressions etc.
  • Split AST nodes
    • Function -> FunctionExpression and FunctionDeclaration
    • AsyncFunction -> AsyncFunctionExpression and AsyncFunctionDeclaration
    • Generator -> GeneratorExpression and GeneratorDeclaration
    • AsyncGenerator -> AsyncGeneratorExpression and AsyncGeneratorDeclaration
    • Class -> ClassExpression and ClassDeclaration
  • Refactor object literal and class methods into ObjectMethodDefinition and ClassMethodDefinition
  • Fix class field computed names for functions and add tests

@raskad raskad added bug Something isn't working parser Issues surrounding the parser ast Issue surrounding the abstract syntax tree labels Jul 21, 2024
@raskad raskad added this to the next-release milestone Jul 21, 2024
Copy link

github-actions bot commented Jul 21, 2024

Test262 conformance changes

Test result main count PR count difference
Total 48,212 48,212 0
Passed 43,264 43,264 0
Ignored 1,413 1,413 0
Failed 3,535 3,535 0
Panics 0 0 0
Conformance 89.74% 89.74% 0.00%

@raskad raskad force-pushed the refactor-ast-function-types branch from 7ad5185 to 8ad2d06 Compare August 2, 2024 23:58
@raskad raskad marked this pull request as ready for review August 3, 2024 00:20
@raskad raskad requested a review from a team August 3, 2024 00:20
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Nice work! Looks good to me! :)

@HalidOdat HalidOdat requested a review from a team August 17, 2024 16:10
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Looks great! Always happy to move invariants from execution to compile time :)

@jedel1043 jedel1043 added this pull request to the merge queue Aug 18, 2024
Merged via the queue into main with commit 424896d Aug 18, 2024
13 checks passed
@raskad raskad deleted the refactor-ast-function-types branch August 24, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Issue surrounding the abstract syntax tree bug Something isn't working parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants