# HG changeset patch # User Jan Vrany # Date 1434661513 -3600 # Node ID 501ba969803d0638707f8faf23f22bbfafd5428b # Parent 0433a9d7fbcdd76c6dd77e415d6333fe7a652aaf Do not use RBProgramNode>>variableNodesDo: as this method is not present in Pharo. Use local helper method instead. diff -r 0433a9d7fbcd -r 501ba969803d compiler/PPCCodeGenerator.st --- a/compiler/PPCCodeGenerator.st Thu Jun 18 21:20:15 2015 +0100 +++ b/compiler/PPCCodeGenerator.st Thu Jun 18 22:05:13 2015 +0100 @@ -108,6 +108,25 @@ ^ compiler checkCache: (compiler idFor: node) ! ! +!PPCCodeGenerator methodsFor:'private'! + +withAllVariableNodesOf: anRBProgramNode do: aBlock + "Enumerate all chilren of `anRBProgramNode` (including itself) + and evaluate `aBlock` for each variable node. + This is a replacement for Smalltalk/X's RBProgramNode>>variableNodesDo: + which is not present in Pharo" + + anRBProgramNode isVariable ifTrue:[ + aBlock value: anRBProgramNode. + ^ self. + ]. + anRBProgramNode children do:[:each | + self withAllVariableNodesOf: each do: aBlock + ]. + + "Created: / 18-06-2015 / 22:02:43 / Jan Vrany " +! ! + !PPCCodeGenerator methodsFor:'support'! compileTokenWhitespace: node @@ -235,7 +254,7 @@ blockNeedsCollection := false. blockMatches := IdentityDictionary new."Must use IDENTITY dict as nodes have overwritten their #=!!!!!!" childValueVars := node child preferredChildrenVariableNames. - blockBody variableNodesDo:[:variableNode| + self withAllVariableNodesOf: blockBody do:[:variableNode| variableNode name = blockNodesVar name ifTrue:[ "Check if variable node matches..." variableNode parent isMessage ifTrue:[ @@ -304,7 +323,7 @@ compiler code: blockBody. ] - "Modified: / 16-06-2015 / 07:41:16 / Jan Vrany " + "Modified: / 18-06-2015 / 22:03:17 / Jan Vrany " ! visitAndNode: node @@ -512,7 +531,7 @@ | blockArg | blockArg := blockNode arguments first. - blockBody variableNodesDo:[:variableNode| + self withAllVariableNodesOf: blockBody do:[:variableNode| variableNode name = blockArg name ifTrue:[ variableNode token value: self retvalVar. ]. @@ -538,7 +557,7 @@ ] "Created: / 02-06-2015 / 17:28:55 / Jan Vrany " - "Modified: / 18-06-2015 / 06:34:09 / Jan Vrany " + "Modified: / 18-06-2015 / 22:03:36 / Jan Vrany " ! visitMessagePredicateNode: node