Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.386.mcz==================== Summary ====================
Name: Compiler-eem.386
Author: eem
Time: 16 June 2018, 5:46:30.6679 pm
UUID: b7853f0c-81c4-46cf-bc35-b572d22887b7
Ancestors: Compiler-eem.385
Fix a number of failing decompilation tests due to the last statement of a block being known to answer nil by the compiler side. The root cause was my test in BlockNode>>printStatementsOn:indent: that assumed that blocks with arguments never answered nil.
=============== Diff against Compiler-eem.385 ===============
Item was changed:
----- Method: BlockNode>>printStatementsOn:indent: (in category 'printing') -----
printStatementsOn: aStream indent: levelOrZero
| len shown thisStatement level |
level := 1 max: levelOrZero.
+ comment ifNotNil:
+ [self printCommentOn: aStream indent: level.
+ aStream crtab: level].
- comment == nil
- ifFalse:
- [self printCommentOn: aStream indent: level.
- aStream crtab: level].
len := shown := statements size.
(levelOrZero = 0 "top level" and: [statements last isReturnSelf])
ifTrue: [shown := 1 max: shown - 1]
+ ifFalse: ["should a trailing nil be printed or not? Not if it is an implicit result, not if the last statement answers nil."
+ ((arguments size > 0 and: [len = 0])
+ or: [(statements at: len) == NodeNil
+ and: [len = 1
+ or: [len > 1
+ and: [(statements at: len - 1) isMessageNode
+ and: [(statements at: len - 1) isNilIf
+ or: [(statements at: len - 1) isOptimizedWhileLoop]]]]]])
- ifFalse: ["should a trailing nil be printed or not? Not if it is an implicit result."
- (arguments size = 0
- and: [len >= 1
- and: [(statements at: len) == NodeNil
- and: [len = 1
- or: [len > 1
- and: [(statements at: len - 1) isMessageNode
- and: [(statements at: len - 1) isNilIf]]]]]])
ifTrue: [shown := shown - 1]].
1 to: shown do:
[:i |
thisStatement := statements at: i.
thisStatement printOn: aStream indent: level.
i < shown ifTrue: [aStream nextPut: $.; crtab: level].
(thisStatement comment ~~ nil and: [thisStatement comment size > 0])
ifTrue:
[i = shown ifTrue: [aStream crtab: level].
thisStatement printCommentOn: aStream indent: level.
i < shown ifTrue: [aStream crtab: level]]]!
Item was added:
+ ----- Method: MessageNode>>isOptimizedWhileLoop (in category 'testing') -----
+ isOptimizedWhileLoop
+ ^special > 0
+ and: [#(transformWhile: transformRepeat:) includes: (MacroTransformers at: special)]!