--- smalltalk-tmp/compiler/ParseTreeSearcher.st 2007-01-11 11:50:03.000000000 -0600 +++ smalltalk--devo--2.2/compiler/ParseTreeSearcher.st 2007-01-11 11:45:33.000000000 -0600 @@ -747,7 +747,6 @@ (key isString not and: [key recurseInto]) ifTrue: [ self visitNodeList: (oldContext at: key put: (value collect: [:v | v copy])) - visitor: #visitNode:onMatch: onMatch: [:newValue | oldContext at: key put: newValue]]]! ! @@ -775,20 +774,34 @@ ^newNode isNil ifTrue: [aNode acceptVisitor: self. aNode] ifFalse: [aBlock value: newNode. newNode]! -visitNodeList: aNodeList visitor: vSelector onMatch: aBlock +visitNodeList: aNodeList onMatch: aBlock "Answer aNodeList but with each element replaced by the result of - sending vSelector to me with said element (and a block of my - own). If any matches occur, I'll call aBlock afterwards with the + visitNode:onMatch: with said element (and a block of my own). If + any matches occur, I'll call aBlock afterwards with the replacement of aNodeList before answering it." | replacementList rlHasMatch | rlHasMatch := false. replacementList := aNodeList collect: [:eltNode | - self perform: vSelector with: eltNode - with: [:newElt | rlHasMatch := true]]. + self visitNode: eltNode + onMatch: [:newElt | rlHasMatch := true]]. ^rlHasMatch ifTrue: [aBlock value: replacementList. replacementList] ifFalse: [aNodeList]! +visitArgumentList: aNodeList onMatch: aBlock + "Answer aNodeList but with each element replaced by the result of + visitArgument:onMatch: with said element (and a block of my own). + If any matches occur, I'll call aBlock afterwards with the + replacement of aNodeList before answering it." + | replacementList rlHasMatch | + rlHasMatch := false. + replacementList := aNodeList collect: [:eltNode | + self visitArgument: eltNode + onMatch: [:newElt | rlHasMatch := true]]. + ^rlHasMatch + ifTrue: [aBlock value: replacementList. replacementList] + ifFalse: [aNodeList]! ! + !ParseTreeRewriter methodsFor: 'visitor-double dispatching'! acceptAssignmentNode: anAssignmentNode