compiler/PPCCodeGenerator.st
changeset 495 555f59e60886
parent 492 fc3dbe5654c5
child 496 0433a9d7fbcd
equal deleted inserted replaced
494:5cdfa83d6027 495:555f59e60886
   209 !PPCCodeGenerator methodsFor:'visiting'!
   209 !PPCCodeGenerator methodsFor:'visiting'!
   210 
   210 
   211 visitActionNode: node
   211 visitActionNode: node
   212     | blockNode blockBody blockNodesVar blockNeedsCollection blockMatches childValueVars |
   212     | blockNode blockBody blockNodesVar blockNeedsCollection blockMatches childValueVars |
   213 
   213 
   214     blockNode := node block ast deepCopy.
   214     blockNode := node block sourceNode deepCopy.
   215     self assert: blockNode arguments size == 1.
   215     self assert: blockNode arguments size == 1.
   216     blockNodesVar := blockNode arguments first .
   216     blockNodesVar := blockNode arguments first .
   217     blockBody := blockNode body.
   217     blockBody := blockNode body.
   218 
   218 
   219     "Now, analyze block body, search for all references to
   219     "Now, analyze block body, search for all references to
   478 
   478 
   479 visitMappedActionNode: node
   479 visitMappedActionNode: node
   480     | child blockNode blockBody |
   480     | child blockNode blockBody |
   481 
   481 
   482     child := node child.
   482     child := node child.
   483     blockNode := node block ast copy.
   483     blockNode := node block sourceNode deepCopy.
   484     blockBody := blockNode body.
   484     blockBody := blockNode body.
   485 
   485 
   486     "Block return value is return value of last statement.
   486     "Block return value is return value of last statement.
   487      So if the method is not inline, make last statement a return.
   487      So if the method is not inline, make last statement a return.
   488         if the method is inline, make it assignment to retvalVar."
   488         if the method is inline, make it assignment to retvalVar."
   536         ].
   536         ].
   537         compiler code: blockBody.    
   537         compiler code: blockBody.    
   538     ]
   538     ]
   539 
   539 
   540     "Created: / 02-06-2015 / 17:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   540     "Created: / 02-06-2015 / 17:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   541     "Modified: / 15-06-2015 / 19:03:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   541     "Modified: / 18-06-2015 / 06:34:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   542 !
   542 !
   543 
   543 
   544 visitMessagePredicateNode: node
   544 visitMessagePredicateNode: node
   545     compiler add: '(context peek ', node message, ') ifFalse: ['.
   545     compiler add: '(context peek ', node message, ') ifFalse: ['.
   546     compiler codeError: 'predicate not found'.
   546     compiler codeError: 'predicate not found'.