Skip to content

Commit

Permalink
rename and refactor newExpression method
Browse files Browse the repository at this point in the history
  • Loading branch information
Durieux Pol committed Feb 9, 2024
1 parent cdc5b52 commit 3168693
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 34 deletions.
11 changes: 5 additions & 6 deletions src/MuTalk-Model/MTAssignmentNullifierOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ MTAssignmentNullifierOperator >> description [
]

{ #category : 'applying' }
MTAssignmentNullifierOperator >> newExpression [
MTAssignmentNullifierOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode |
| nodeCopy |
nodeCopy := anOldNode copy.
nodeCopy value: (RBLiteralValueNode value: nil).
nodeCopy ]
| nodeCopy |
nodeCopy := anOldNode copy.
nodeCopy value: (RBLiteralValueNode value: nil).
^ nodeCopy
]
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTEmptyMethodOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MTEmptyMethodOperator >> description [
]

{ #category : 'applying' }
MTEmptyMethodOperator >> newExpression [
MTEmptyMethodOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBSequenceNode statements: #() ]
^ RBSequenceNode statements: #( )
]
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTLiteralBooleanNegateOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MTLiteralBooleanNegateOperator >> description [
]

{ #category : 'applying' }
MTLiteralBooleanNegateOperator >> newExpression [
MTLiteralBooleanNegateOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBLiteralValueNode value: anOldNode value not ]
^ RBLiteralValueNode value: anOldNode value not
]
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTLiteralIntegersDecreaseOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MTLiteralIntegersDecreaseOperator >> description [
]

{ #category : 'applying' }
MTLiteralIntegersDecreaseOperator >> newExpression [
MTLiteralIntegersDecreaseOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBLiteralValueNode value: anOldNode value - 1 ]
^ RBLiteralValueNode value: anOldNode value - 1
]
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTLiteralIntegersIncreaseOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MTLiteralIntegersIncreaseOperator >> description [
]

{ #category : 'applying' }
MTLiteralIntegersIncreaseOperator >> newExpression [
MTLiteralIntegersIncreaseOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBLiteralValueNode value: anOldNode value + 1 ]
^ RBLiteralValueNode value: anOldNode value + 1
]
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTLiteralIntegersToZeroOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MTLiteralIntegersToZeroOperator >> description [
]

{ #category : 'applying' }
MTLiteralIntegersToZeroOperator >> newExpression [
MTLiteralIntegersToZeroOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBLiteralValueNode value: 0 ]
^ RBLiteralValueNode value: 0
]
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTLiteralStringChangeOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ MTLiteralStringChangeOperator >> description [
]

{ #category : 'applying' }
MTLiteralStringChangeOperator >> newExpression [
MTLiteralStringChangeOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBLiteralValueNode value: self stringReplaced ]
^ RBLiteralValueNode value: self stringReplaced
]

{ #category : 'applying' }
Expand Down
4 changes: 2 additions & 2 deletions src/MuTalk-Model/MTLiteralStringToEmptyOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MTLiteralStringToEmptyOperator >> description [
]

{ #category : 'applying' }
MTLiteralStringToEmptyOperator >> newExpression [
MTLiteralStringToEmptyOperator >> newNodeFrom: anOldNode [

^ [ :anOldNode | RBLiteralValueNode value: '' ]
^ RBLiteralValueNode value: ''
]
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ MTMessageSendArgumentsNullifierOperator >> description [
]

{ #category : 'applying' }
MTMessageSendArgumentsNullifierOperator >> newExpression [

| whichToReplace nodeCopy |
^ [ :anOldNode |
nodeCopy := anOldNode copy.
whichToReplace := nodeCopy arguments at: self whichArgument.
whichToReplace replaceWith: (RBLiteralValueNode value: nil).
nodeCopy]
MTMessageSendArgumentsNullifierOperator >> newNodeFrom: anOldNode [

| nodeCopy whichToReplace |
nodeCopy := anOldNode copy.
whichToReplace := nodeCopy arguments at: self whichArgument.
whichToReplace replaceWith: (RBLiteralValueNode value: nil).
^ nodeCopy
]

{ #category : 'applying' }
Expand Down
8 changes: 3 additions & 5 deletions src/MuTalk-Model/MTMessageSendToYourselfOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ MTMessageSendToYourselfOperator >> description [
]

{ #category : 'applying' }
MTMessageSendToYourselfOperator >> newExpression [
MTMessageSendToYourselfOperator >> newNodeFrom: anOldNode [

| nodeCopy |
^ [ :anOldNode |
nodeCopy := anOldNode copy.
RBMessageNode receiver: nodeCopy receiver selector: #yourself
]
nodeCopy := anOldNode copy.
^ RBMessageNode receiver: nodeCopy receiver selector: #yourself
]
8 changes: 7 additions & 1 deletion src/MuTalk-Model/MTPredicateBasedMutantOperator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ MTPredicateBasedMutantOperator >> modifiedSourceFor: aCompiledMethod with: aPars
^ parseTreeCopy formattedCode
]

{ #category : 'instance creation' }
{ #category : 'applying' }
MTPredicateBasedMutantOperator >> newExpression [

^ [ :anOldNode | self newNodeFrom: anOldNode ]
]

{ #category : 'instance creation' }
MTPredicateBasedMutantOperator >> newNodeFrom: anOldNode [

self subclassResponsibility
]

Expand Down

0 comments on commit 3168693

Please sign in to comment.