Andreas Raab uploaded a new version of Compiler to project The Trunk: http://source.squeak.org/trunk/Compiler-ar.145.mcz
==================== Summary ====================
Name: Compiler-ar.145 Author: ar Time: 27 May 2010, 9:38:04.277 pm UUID: 932818d3-1aeb-104b-826b-60c5a6f6f6a1 Ancestors: Compiler-HenrikSperreJohansen.144
Merging Compiler-HenrikSperreJohansen.144
Fix for BlockClosure decompilation in Workspace doits.
Previously, blocks with remoteTemps would fail to decompile, f.ex:
| x y | [:a :b | x := a. y := b] decompile (http://code.google.com/p/pharo/issues/detail?id=767)
Also, temp names would not be preserved when inspecting a non-remoteTemps block, say
[:x :y | | temp | 1 + x@y. ^temp] decompile printString.
Getting the instvar names from MethodTrailer if present in decompileBlock: solves both these issues.
(ar: restore formatting and refer to SyntaxErrorNotification directly)
=============== Diff against Compiler-ar.143 ===============
Item was changed: ----- Method: Decompiler>>decompileBlock: (in category 'public access') ----- decompileBlock: aBlock "Decompile aBlock, returning the result as a BlockNode. Show temp names from source if available." "Decompiler new decompileBlock: [3 + 4]" | startpc end homeClass blockNode methodNode home source | (home := aBlock home) ifNil: [^ nil]. method := home method. (homeClass := home methodClass) == #unknown ifTrue: [^ nil]. constructor := self constructorForMethod: aBlock method. + self withTempNames: (method tempNamesString ifNil:[ method fileIndex ~~ 0 ifTrue: "got any source code?" [source := [method getSourceFromFile] on: Error do: [:ex | ^ nil]. methodNode := [homeClass compilerClass new parse: source in: homeClass notifying: nil] + on: SyntaxErrorNotification - on: (Smalltalk classNamed: 'SyntaxErrorNotification') do: [:ex | ^ nil]. + methodNode schematicTempNamesString]]). - self withTempNames: methodNode schematicTempNamesString]. self initSymbols: homeClass. startpc := aBlock startpc. end := aBlock isClosure ifTrue: [(method at: startpc - 2) * 256 + (method at: startpc - 1) + startpc - 1] ifFalse: [(method at: startpc - 2) \ 16 - 4 * 256 + (method at: startpc - 1) + startpc - 1]. stack := OrderedCollection new: method frameSize. caseExits := OrderedCollection new. statements := OrderedCollection new: 20. super method: method pc: (aBlock isClosure ifTrue: [startpc - 4] ifFalse: [startpc - 5]). aBlock isClosure ifTrue: [numLocalTemps := #decompileBlock: "Get pushClosureCopy... to hack fake temps for copied values"]. blockNode := self blockTo: end. stack isEmpty ifFalse: [self error: 'stack not empty']. ^blockNode statements first!
packages@lists.squeakfoundation.org