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

Fix and test for inlinings with If's and right shift not translated #667

Merged

Conversation

hernanmd
Copy link
Member

@hernanmd hernanmd commented Aug 7, 2023

This PR add a C code generator test and fix which involves inlinings with an if expression in the left side of a right shift operation. For example, Slang code like:

methodWithIfAndShiftRight: var

	^ (var < 0
		ifTrue:  [ 0 ]
		ifFalse: [ var ]) >> (var - 1 * 32)

was causing any translation which uses a similar pattern to fail, because the CIfStatementNode was asserted to be an expression. In the fix (thanks to Guille), we pass a CTernaryNode representing the if instead to correctly generates the C code.

…the left side.

Add a fix (thanks to Guille) which correctly generates the C AST expression.
@hernanmd hernanmd added bug Something isn't working slang labels Aug 7, 2023
@hernanmd hernanmd self-assigned this Aug 7, 2023
Copy link
Member

@guillep guillep left a comment

Choose a reason for hiding this comment

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

LVGTM!

Thanks!!

PS: Let's wait for the CI

@guillep guillep merged commit b3eb1ef into pharo-project:pharo-12 Aug 7, 2023
@hernanmd hernanmd deleted the inline-method-if-with-shift-right branch September 19, 2023 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working slang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants