Skip to content

Conversation

@Ducasse
Copy link
Member

@Ducasse Ducasse commented Oct 26, 2025

Making that parser will fail when a statement follows a return.

…18607 FIxes: pharo-project#18607

Making that parser will fail when a statement follows a return.
@Ducasse Ducasse changed the title Fix: #18607 Fix #18607 Fixes #18607 FIxes: #18607 Making that parser will fail when a statement follows a return. Oct 27, 2025
@Ducasse Ducasse closed this Oct 27, 2025
@Ducasse Ducasse reopened this Oct 27, 2025
@demarey demarey changed the title Making that parser will fail when a statement follows a return. Make parser fail when a statement follows a return. Oct 27, 2025

(statementList notEmpty and: [ statementList last isReturn ]) ifTrue: [
node addWarning: 'Unreachable statement' ].
self error: 'After the return statement, there is an unreachable statement in this method source: ', source ].
Copy link
Contributor

Choose a reason for hiding this comment

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

It is nice but will it forbid to have a comment after the return

@Ducasse
Copy link
Member Author

Ducasse commented Oct 27, 2025

Yes I was thinking that we could turn the expression into a comment. I started to play with it but I could not find how to have a position of the expression so that I can set the comment position.
Should work more on that.

@MarcusDenker
Copy link
Member

I close this, as we should not raise an Error, but instead annotate the AST with the error using addError:

I will do a PR with that.

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.

3 participants