[Vm-dev] VM Maker: VMMaker.oscog-lw.224.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Nov 30 09:18:33 UTC 2012
Lars Wassermann uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-lw.224.mcz
==================== Summary ====================
Name: VMMaker.oscog-lw.224
Author: lw
Time: 30 November 2012, 10:13:46.707 am
UUID: a51717bf-aca8-3447-b4cc-24b24b75d804
Ancestors: VMMaker.oscog-eem.223
my image couldn't compile TMethod>>removeFinalSelfReturn as it was delivered with commit 220. This small change fixed it for my system.
=============== Diff against VMMaker.oscog-eem.223 ===============
Item was changed:
----- Method: TMethod>>removeFinalSelfReturn (in category 'transformations') -----
removeFinalSelfReturn
"The Smalltalk parser automatically adds the statement '^self' to the end of methods
without explicit returns. This method removes such statements, since in most VMMaker
classes (except struct classes) the generated code has no notion of 'self' anyway.
If the statement is removed and no return type has yet been specified asnd the class
specifies a default return type (e.g. #void) for methods that don't return, then set the
return type accordingly."
| lastStmt |
((lastStmt := parseTree statements last) isReturn
and: [lastStmt expression isVariable
and: ['self' = lastStmt expression name]]) ifTrue:
[| tokens |
tokens := Scanner new scanTokens: (definingClass sourceCodeAt: selector ifAbsent: ['']).
(tokens size < 2
+ or: [(tokens last: 2) ~= #(#'^' 'self')]) ifTrue:
- or: [(tokens last: 2) ~= #(#^ 'self')]) ifTrue:
[parseTree setStatements: parseTree statements allButLast.
returnType = #sqInt ifTrue:
[([definingClass implicitReturnTypeFor: selector]
on: MessageNotUnderstood
do: [:ex| nil]) ifNotNil:
[:defaultReturnType|
returnType := defaultReturnType]]]]!
More information about the Vm-dev
mailing list