Bert Freudenberg uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-bf.393.mcz ==================== Summary ==================== Name: Compiler-bf.393 Author: bf Time: 23 August 2018, 7:44:43.576279 pm UUID: 860565e2-2f2c-49bb-9e2f-e0d69d7b46c5 Ancestors: Compiler-bf.392 Fix pc highlighting for ifNil:ifNotNil:. =============== Diff against Compiler-bf.392 =============== Item was changed: ----- Method: MessageNode>>transformIfNilIfNotNil: (in category 'macro transformations') ----- transformIfNilIfNotNil: encoder "vb: Changed to support one-argument ifNotNil: branch. In the 1-arg case we transform the receiver to (var := receiver) which is further transformed to (var := receiver) == nil ifTrue: .... ifFalse: ... This does not allow the block variable to shadow an existing temp, but it's no different from how to:do: is done." | ifNotNilArg | ifNotNilArg := arguments at: 2. ((self checkBlock: (arguments at: 1) as: 'Nil arg' from: encoder maxArgs: 0) and: [self checkBlock: ifNotNilArg as: 'NotNil arg' from: encoder maxArgs: 1]) ifFalse: [^false]. ifNotNilArg numberOfArguments = 1 ifTrue: [receiver := AssignmentNode new variable: ifNotNilArg firstArgument + value: receiver. + encoder noteSourceRange: (encoder sourceRangeFor: self) forNode: receiver]. - value: receiver]. selector := SelectorNode new key: #ifTrue:ifFalse: code: #macro. receiver := MessageNode new receiver: receiver selector: #== arguments: (Array with: NodeNil) precedence: 2 from: encoder. + encoder noteSourceRange: (encoder sourceRangeFor: self) forNode: receiver. arguments do: [:arg| arg noteOptimizedIn: self]. ^true! Item was changed: ----- Method: MessageNode>>transformIfNotNilIfNil: (in category 'macro transformations') ----- transformIfNotNilIfNil: encoder "vb: Changed to support one-argument ifNotNil: branch. In the 1-arg case we transform the receiver to (var := receiver) which is further transformed to (var := receiver) == nil ifTrue: .... ifFalse: ... This does not allow the block variable to shadow an existing temp, but it's no different from how to:do: is done." | ifNotNilArg | ifNotNilArg := arguments at: 1. ((self checkBlock: ifNotNilArg as: 'NotNil arg' from: encoder maxArgs: 1) and: [self checkBlock: (arguments at: 2) as: 'Nil arg' from: encoder maxArgs: 0]) ifFalse: [^false]. ifNotNilArg numberOfArguments = 1 ifTrue: [receiver := AssignmentNode new variable: ifNotNilArg firstArgument + value: receiver. + encoder noteSourceRange: (encoder sourceRangeFor: self) forNode: receiver]. - value: receiver]. selector := SelectorNode new key: #ifTrue:ifFalse: code: #macro. receiver := MessageNode new receiver: receiver selector: #== arguments: (Array with: NodeNil) precedence: 2 from: encoder. + encoder noteSourceRange: (encoder sourceRangeFor: self) forNode: receiver. arguments swap: 1 with: 2. arguments do: [:arg| arg noteOptimizedIn: self]. ^true! |
Free forum by Nabble | Edit this page |