The Trunk: Tools-bf.394.mcz

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

The Trunk: Tools-bf.394.mcz

commits-2
Bert Freudenberg uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-bf.394.mcz

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

Name: Tools-bf.394
Author: bf
Time: 19 March 2012, 8:09:09.124 pm
UUID: 798e0091-0a38-465c-b108-9d6a32f618ea
Ancestors: Tools-laza.393

Move decompilation logic from CodeHolder into CompiledMethod

=============== Diff against Tools-laza.393 ===============

Item was changed:
  ----- Method: CodeHolder>>decompiledSourceIntoContentsWithTempNames: (in category 'message list') -----
  decompiledSourceIntoContentsWithTempNames: showTempNames
  "Obtain a source string by decompiling the method's code, and place
  that source string into my contents.
  Also return the string.
  Get temps from source file if showTempNames is true."
 
+ | class selector method |
- | tempNames class selector method |
  class := self selectedClassOrMetaClass.
  selector := self selectedMessageName.
  "Was method deleted while in another project?"
  method := class compiledMethodAt: selector ifAbsent: [^ ''].
 
  currentCompiledMethod := method.
+ contents := (showTempNames
+ ifTrue: [method decompileWithTemps]
+ ifFalse: [method decompile]) decompileString.
- (showTempNames not
- or: [method fileIndex > 0
- and: [(SourceFiles at: method fileIndex) isNil]])
- ifTrue: [
- "Emergency or no source file -- decompile without temp names "
- contents := (class decompilerClass new
- decompile: selector
- in: class
- method: method) decompileString]
- ifFalse: [tempNames := (class newCompiler
- parse: method getSourceFromFile asString
- in: class
- notifying: nil)
- generate: CompiledMethodTrailer defaultMethodTrailer;
- schematicTempNamesString.
- contents := ((class decompilerClass new withTempNames: tempNames)
- decompile: selector
- in: class
- method: method) decompileString].
  contents := contents asText makeSelectorBoldIn: class.
  ^ contents copy!