[squeak-dev] The Trunk: ST80-eem.117.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Aug 15 01:24:47 UTC 2010


Eliot Miranda uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-eem.117.mcz

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

Name: ST80-eem.117
Author: eem
Time: 14 August 2010, 6:24:25.811 pm
UUID: c49d605b-594c-423c-81da-b802444bec74
Ancestors: ST80-nice.116

Fix explainer for block args & temps

=============== Diff against ST80-nice.116 ===============

Item was changed:
  ----- Method: ParagraphEditor>>explainTemp: (in category 'explain') -----
  explainTemp: string 
+ 	"Is string the name of a temporary variable (method or block argument or temporary)?"
- 	"Is string the name of a temporary variable (or block argument variable)?"
  
+ 	| selectedClass methodNode tempNode |
- 	| selectedClass tempNames i reply methodNode method msg |
  	(model respondsTo: #selectedMessageName) ifFalse: [^ nil].
+ 	model selectedMessageName ifNil: [^nil].	"not in a method"
- 	(msg := model selectedMessageName) ifNil: [^nil].	"not in a message"
  	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"'])!
- 	tempNames := selectedClass parserClass new 
- 			parseArgsAndTemps: model selectedMessage notifying: nil.
- 	method := selectedClass compiledMethodAt: msg.
- 	(i := tempNames findFirst: [:each | each = string]) = 0 ifTrue: [
- 		(method numTemps > tempNames size)
- 			ifTrue: 
- 				["It must be an undeclared block argument temporary"
- 				methodNode := selectedClass compilerClass new
- 							parse: model selectedMessage
- 							in: selectedClass
- 							notifying: nil.
- 				tempNames := methodNode tempNames]
- 			ifFalse: [^nil]].
- 	(i := tempNames findFirst: [:each | each = string]) > 0 ifTrue: [i > method numArgs
- 			ifTrue: [reply := '"is a temporary variable in this method"']
- 			ifFalse: [reply := '"is an argument to this method"']].
- 	^reply!




More information about the Squeak-dev mailing list