Temporary variable not removed when assignment deleted
Given an AssignmentStatement
like String x = ...
, when deleting the assignment, the temporary variable is not deleted as well (as is done with message assignments or when changing the assignTo of the assignment statement).
However, this should only be done if it is not used anywhere else.
Comments (13)
-
reporter -
reporter The following needs to be supported as well I think:
String x = ...; String x = somethingElse;
When the first statement is deleted, x should not be deleted. Right now, it is only checked whether it is referenced in messages (of their assignTo).
-
reporter References
#403: Adds special handling for assignment statements.Adds a check when deleting an AssignmentStatement to make sure the temporary property (if necessary) is deleted.
Updates the condition to determine whether a temporary property needs to be removed. Considers other assignment statement's assignTo references as well. The temporary property can only be deleted if it is only referenced by this one assignment statement.
→ <<cset 180331268b4f>>
-
reporter Adds tests with test data for the FragmentsController.
Adds dependency to JUnit to the controller project and a tests source folder.
References
#403(tests).→ <<cset 22b2fbe5fcee>>
-
reporter Temporarily disables Checkstyle for tests.
In the future, it might be desirably to create specific rules (more relaxed) for test cases.
References
#403(tests).→ <<cset 091adebe1d94>>
-
reporter Adds tests with test data for the MessageViewController.
Adds tests for removal of nested messages.
References
#403(tests).→ <<cset 707b56b51cd9>>
-
reporter -
assigned issue to
-
assigned issue to
-
reporter References
#403: Updates call to finding cross references to updated method signature (name).→ <<cset 61e023d1d5a3>>
-
reporter References
#403: Improves structure of tests.Adds abstract test class which handles the initialization (set up before class), test setup and tear down.
Also, the indices for fragments in the test classes are extracted to constants, in order to easier manage them when the test model changes.
Added two self messages to nested behaviour for additional test cases.
→ <<cset bd99c7ca622e>>
-
reporter References
#403: Fixes temporary property removal check when removing messages.- Moves removal of temporary property to MessageViewController.
- Updates check to ensure that temporary property is at most used once in order to safely remove it.
→ <<cset 11dcaba4f44a>>
-
reporter - changed status to resolved
Merged into master in pull request #76.
-
reporter References
#403: Adds test case to check whether temporary properties are properly deleted.Ensures that deletion is performed also for assigning a property several times, but deleting all of the statements.
→ <<cset 181cf5b66ad2>>
-
reporter References
#403: Improves removal of unused temporary properties to consider all affected fragments.If the only fragments/messages assigning to the temporary property are ones being deleted or updated (the assignTo is replaced), it can be safely deleted.
→ <<cset 3505986ba7f1>>
- Log in to comment
This also needs to be performed when deleting the operand it is contained in.
When deleting a message with nested behaviour, it should be removed automatically, since it is the
initialMessage
which contains the property.