diff -r 54b3bc9e3987 -r 20598d7ce9fa compiler/PPCNotNode.st --- a/compiler/PPCNotNode.st Tue Apr 21 17:20:11 2015 +0100 +++ b/compiler/PPCNotNode.st Thu Apr 30 23:43:14 2015 +0200 @@ -25,59 +25,9 @@ ^ true ! ! -!PPCNotNode methodsFor:'compiling'! - -compileWith: compiler effect: effect id: id +!PPCNotNode methodsFor:'visiting'! - compiler startMethod: id. - compiler addVariable: 'memento'. - compiler add: (compiler smartRemember: child). - - compiler call: (child compileWith: compiler). - compiler add: (compiler smartRestore: child). - - compiler add: '^ error ifFalse: [ self error ] ifTrue: [ self clearError. nil ]'. - ^ compiler stopMethod. +accept: visitor + ^ visitor visitNotNode: self ! ! -!PPCNotNode methodsFor:'optimizing'! - -optimize: params - (self rewrite: params) ifTrue: [ - ^ true. - ]. - ^ super optimize: params. -! - -rewrite: changeStatus - (child isKindOf: PPCAbstractLiteralNode) ifTrue: [ - changeStatus change. - ^ PPCNotLiteralNode new - name: self name; - literal: self child literal; - yourself - ]. - - (child isKindOf: PPCMessagePredicateNode) ifTrue: [ - changeStatus change. - ^ PPCNotMessagePredicateNode new - name: self name; - message: child message; - yourself - ]. - - (child isKindOf: PPCCharSetPredicateNode) ifTrue: [ - changeStatus change. - ^ PPCNotCharSetPredicateNode new - name: self name; - predicate: child predicate; - yourself - ]. - - "Can do the fast version, because we throw away the result and return nil" - (self allNodes anySatisfy: [ :node | node asFast ~= node ]) ifTrue: [ - changeStatus change. - self replace: child with: (child transform: [:node | node asFast]). - ] -! ! -