The Trunk: Morphic-eem.460.mcz

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

The Trunk: Morphic-eem.460.mcz

commits-2
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.460.mcz

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

Name: Morphic-eem.460
Author: eem
Time: 14 August 2010, 6:26:55.551 pm
UUID: 837eca0b-36a4-4686-9a79-68dfb9b40009
Ancestors: Morphic-ar.459

Fix explainer for block args & temps

=============== Diff against Morphic-ar.459 ===============

Item was changed:
  ----- Method: TextEditor>>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!