-
Notifications
You must be signed in to change notification settings - Fork 71
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 a lot of unused expression #832
Fix a lot of unused expression #832
Conversation
Simple new rule for harmonization - change in the tests to adapt to new rule - add some test for negative number - test for a more non-destructive rule
Hi @RenaudFondeur ! I cannot review this PR because all the files were changed by Tonel :( I was checking the new tests, they looks ok.
Which ones? Those tests show that after inlining there are still some unused local assignments and unnecessary ifs. |
hello @PalumboN ! The tests missing are the cases where the variable need to be retained because the method to be inlined is either in a return, an assignment or the receiver/argument of a send. Sometimes inlining doesn't put a goTo node in the conditional send meaning it can become empty during the check, in this case the check either suppress it or reduce it (for example ifTrue:ifFalse: -> ifFalse: if the ifTrue: is empty). The unused variable can also arrive in the check after getting some transformation like a cast or becoming a function call if it is an instance variable. |
…eUnusedNodesInBranch: . supress harmonizeSignedAndUnsignedTypesIn: , it has no sender and look exactly like an old version of harmonizeReturnTypesIn: now in CCodeGenerator
when inlining happens, we produce a copy of the method's AST but we only ensure that the children are correct meaning we cannot iterate the AST from bottom top anymore.
add a visitor in Slang to suppress unused expressions after inlining occurs