'From Cuis 2.6 of 10 August 2010 [latest update: #540] on 29 August 2010 at 8:59:06 am'!

!CompiledMethod methodsFor: 'decompiling' stamp: 'eem 8/12/2010 13:52'!
decompileWithTemps
	"Return the decompiled parse tree that represents self, but get the temp names
	 by compiling the sourcecode..."

	|  class selector |
	class := self methodClass ifNil: [Object].
	selector := self selector ifNil: [self defaultSelector].

	(self fileIndex > 0 and: [(SourceFiles at: self fileIndex) isNil]) ifTrue: [
			"Emergency or no source file -- decompile without temp names "
			^self decompile.
	].
	^((self decompilerClass new withTempNames: self methodNode schematicTempNamesString)
						decompile: selector
						in: class
						method: self)! !


!SmalltalkEditor methodsFor: 'explain' stamp: 'jmv 8/28/2010 12:06'!
explainTemp: string 
	"Is string the name of a temporary variable (method or block argument or temporary)?"

	| selectedClass methodNode tempNode |
	(model respondsTo: #selectedMessageName) ifFalse: [^ nil].
	model selectedMessageName ifNil: [^nil].	"not in a method"
	selectedClass := model selectedClassOrMetaClass.
	methodNode := selectedClass parserClass new parse: model selectedMessage class: selectedClass.
	tempNode := methodNode encoder tempNodes detect: [:n| n name = string] ifNone: [^nil].
	^(tempNode isArg
		ifTrue: ['"is an argument to this ']
		ifFalse: ['"is a temporary variable in this ']),
	   (tempNode isDeclaredAtMethodLevel
		ifTrue: ['method"']
		ifFalse: ['block"'])! !

TempVariableNode removeSelector: #cleanUpForRegeneration!
BytecodeEncoder removeSelector: #schematicTempNamesOn:blockExtents:fromIndex:!
