Skip to content

Compiler: simplify DoIt#13398

Merged
MarcusDenker merged 11 commits intopharo-project:Pharo12from
privat:doit
Apr 18, 2023
Merged

Compiler: simplify DoIt#13398
MarcusDenker merged 11 commits intopharo-project:Pharo12from
privat:doit

Conversation

@privat
Copy link
Contributor

@privat privat commented Apr 11, 2023

The management of DoIt (executable scripts) is a little hairy and complex.

  • Invisible synthetic return statements are injected in parseDoIt and asDoIt, but not in parseExpression.
  • asDoit return a RBMethodNode instead of a RBoItMethodNode
  • asDoit results have an inconsistent source
  • some AST methods are unneeded extension methods

This PR tries to make the behavior less complex:

  • original source is not altered (even after asDoit)
  • no returns are injected in the AST. The default return behavior is implemented at compile time by the transformator, as it already decides for classic methods with/without a final return.

Copy link
Member

@jecisc jecisc left a comment

Choose a reason for hiding this comment

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

Nice!

Only thing I'm not sure about is OCASTTranslator >> visitMethodNode: since I don't know well the compiler, but the code seems good :)

Copy link
Member

@MarcusDenker MarcusDenker left a comment

Choose a reason for hiding this comment

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

Nice!

@MarcusDenker MarcusDenker merged commit ec341c2 into pharo-project:Pharo12 Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants