The Trunk: Compiler-nice.184.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compiler-nice.184.mcz

commits-2
Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.184.mcz

==================== Summary ====================

Name: Compiler-nice.184
Author: nice
Time: 12 January 2011, 10:09:27.038 pm
UUID: ba12fb9c-6c57-429b-b415-1188e1faba8b
Ancestors: Compiler-nice.183

Fix DecompilerTests>>#testDecompileLoopWithMovingLimit
A to:do: loop cannot modify the limit inside the block

=============== Diff against Compiler-nice.183 ===============

Item was changed:
  ----- Method: MessageNode>>toDoFromWhileWithInit: (in category 'macro transformations') -----
  toDoFromWhileWithInit: initStmt
  "Return nil, or a to:do: expression equivalent to this whileTrue:"
  | variable increment limit toDoBlock body test |
  (selector key == #whileTrue:
  and: [initStmt isAssignmentNode
  and: [initStmt variable isTemp]]) ifFalse:
  [^nil].
  body := arguments last statements.
  variable := initStmt variable.
  increment := body last toDoIncrement: variable.
  (increment == nil
  or: [receiver statements size ~= 1]) ifTrue:
  [^nil].
  test := receiver statements first.
  "Note: test chould really be checked that <= or >= comparison
  jibes with the sign of the (constant) increment"
  (test isMessageNode
  and: [(limit := test toDoLimit: variable) notNil]) ifFalse:
  [^nil].
+ "The block must not overwrite the limit"
+ (limit isVariableNode and: [body anySatisfy: [:e | e isAssignmentNode and: [e variable = limit]]])
+ ifTrue: [^nil].
  toDoBlock := BlockNode statements: body allButLast returns: false.
  toDoBlock arguments: (Array with: variable).
  variable scope: -1.
  variable beBlockArg.
  ^MessageNode new
  receiver: initStmt value
  selector: (SelectorNode new key: #to:by:do: code: #macro)
  arguments: (Array with: limit with: increment with: toDoBlock)
  precedence: precedence!