--- a/IRTransformTest.st Mon Mar 30 14:47:18 2009 +0000
+++ b/IRTransformTest.st Mon Mar 30 17:49:01 2009 +0000
@@ -46,44 +46,48 @@
!
testAddIntructions
-
- | iRMethod aCompiledMethod |
+
+ | iRMethod aCompiledMethod |
+
+ iRMethod := IRBuilder new
+ numRargs: 1;
+ addTemps: #(self); "receiver and args declarations"
+ pushLiteral: 1;
+ returnTop;
+ ir.
- iRMethod := IRBuilder new
- numRargs: 1;
- addTemps: #(self); "receiver and args declarations"
- pushLiteral: 1;
- returnTop;
- ir.
+ (iRMethod allSequences last) last delete.
+ (iRMethod allSequences last) last delete.
- (iRMethod allSequences last) last delete.
- (iRMethod allSequences last) last delete.
+ (iRMethod allSequences last)
+ addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)}.
- (iRMethod allSequences last)
- addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)}.
+ aCompiledMethod := iRMethod compiledCode.
+ self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
- aCompiledMethod := iRMethod compiledMethod.
- self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
+ "Modified: / 30-03-2009 / 19:40:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
testAddIntructionsBefore
-
- | iRMethod aCompiledMethod push |
+
+ | iRMethod aCompiledMethod push |
+
+ iRMethod := IRBuilder new
+ numRargs: 1;
+ addTemps: #(self); "receiver and args declarations"
+ pushLiteral: 1;
+ returnTop;
+ ir.
- iRMethod := IRBuilder new
- numRargs: 1;
- addTemps: #(self); "receiver and args declarations"
- pushLiteral: 1;
- returnTop;
- ir.
+ push := (iRMethod allSequences last) at: (iRMethod allSequences size - 1) .
+
+ (iRMethod allSequences last)
+ addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)} before: push.
- push := (iRMethod allSequences last) at: (iRMethod allSequences size - 1) .
+ aCompiledMethod := iRMethod compiledCode.
+ self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
- (iRMethod allSequences last)
- addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)} before: push.
-
- aCompiledMethod := iRMethod compiledMethod.
- self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
+ "Modified: / 30-03-2009 / 19:40:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
testAddIntructionsBeforeFromLList
@@ -137,21 +141,23 @@
!
testReplaceInstr
-
- | iRMethod aCompiledMethod |
+
+ | iRMethod aCompiledMethod |
- iRMethod := IRBuilder new
- numRargs: 1;
- addTemps: #(self); "receiver and args declarations"
- pushLiteral: 1;
- returnTop;
- ir.
-
- (iRMethod allSequences last at: 1)
- replaceWithInstructions: {(IRInstruction pushLiteral: 2)}.
+ iRMethod := IRBuilder new
+ numRargs: 1;
+ addTemps: #(self); "receiver and args declarations"
+ pushLiteral: 1;
+ returnTop;
+ ir.
+
+ (iRMethod allSequences last at: 1)
+ replaceWithInstructions: {(IRInstruction pushLiteral: 2)}.
- aCompiledMethod := iRMethod compiledMethod.
- self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
+ aCompiledMethod := iRMethod compiledCode.
+ self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
+
+ "Modified: / 30-03-2009 / 19:40:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!IRTransformTest class methodsFor:'documentation'!