|
| 1 | +" |
| 2 | +I am a variable node for representing a temporary variable stored in a Context object that has a name attached. |
| 3 | +This includes local variables and method parameters. |
| 4 | +" |
| 5 | +Class { |
| 6 | + #name : 'StInspectorNewTempNode', |
| 7 | + #superclass : 'StInspectorNode', |
| 8 | + #instVars : [ |
| 9 | + 'debugInfo', |
| 10 | + 'tempDescriptor' |
| 11 | + ], |
| 12 | + #category : 'NewTools-Inspector-Model', |
| 13 | + #package : 'NewTools-Inspector', |
| 14 | + #tag : 'Model' |
| 15 | +} |
| 16 | + |
| 17 | +{ #category : 'comparing' } |
| 18 | +StInspectorNewTempNode >> = anObject [ |
| 19 | + |
| 20 | + "Answer whether the receiver and anObject represent the same object." |
| 21 | + |
| 22 | + self == anObject ifTrue: [ ^ true ]. |
| 23 | + self class = anObject class ifFalse: [ ^ false ]. |
| 24 | + ^ tempDescriptor = anObject name and: [ |
| 25 | + hostObject = anObject hostObject ] |
| 26 | +] |
| 27 | + |
| 28 | +{ #category : 'accessing' } |
| 29 | +StInspectorNewTempNode >> children [ |
| 30 | + ^ #() |
| 31 | +] |
| 32 | + |
| 33 | +{ #category : 'accessing' } |
| 34 | +StInspectorNewTempNode >> debugInfo [ |
| 35 | + |
| 36 | + ^ debugInfo |
| 37 | +] |
| 38 | + |
| 39 | +{ #category : 'accessing' } |
| 40 | +StInspectorNewTempNode >> debugInfo: anObject [ |
| 41 | + |
| 42 | + debugInfo := anObject |
| 43 | +] |
| 44 | + |
| 45 | +{ #category : 'comparing' } |
| 46 | +StInspectorNewTempNode >> hash [ |
| 47 | + |
| 48 | + "Answer an integer value that is related to the identity of the receiver." |
| 49 | + |
| 50 | + ^ tempDescriptor hash bitXor: (hostObject hash) |
| 51 | +] |
| 52 | + |
| 53 | +{ #category : 'accessing' } |
| 54 | +StInspectorNewTempNode >> hostObject: aContext [ |
| 55 | + |
| 56 | + super hostObject: aContext. |
| 57 | + debugInfo := aContext method debugInfo. |
| 58 | +] |
| 59 | + |
| 60 | +{ #category : 'accessing' } |
| 61 | +StInspectorNewTempNode >> isArgumentVariable [ |
| 62 | + |
| 63 | + ^ tempDescriptor second |
| 64 | +] |
| 65 | + |
| 66 | +{ #category : 'accessing' } |
| 67 | +StInspectorNewTempNode >> isTempVariable [ |
| 68 | + |
| 69 | + ^ self isArgumentVariable not |
| 70 | +] |
| 71 | + |
| 72 | +{ #category : 'accessing' } |
| 73 | +StInspectorNewTempNode >> key [ |
| 74 | + ^ tempDescriptor first |
| 75 | +] |
| 76 | + |
| 77 | +{ #category : 'accessing' } |
| 78 | +StInspectorNewTempNode >> rawValue [ |
| 79 | + "Answer the object value of this object variable (slot, indexed attribute, computed value)." |
| 80 | + |
| 81 | + | scope | |
| 82 | + scope := (debugInfo debugScopeAt: (self hostObject executedPC max: self hostObject method initialPC)). |
| 83 | + ^ scope readVariableNamed: tempDescriptor first at: self hostObject |
| 84 | +] |
| 85 | + |
| 86 | +{ #category : 'accessing' } |
| 87 | +StInspectorNewTempNode >> tempDescriptor [ |
| 88 | + |
| 89 | + ^ tempDescriptor |
| 90 | +] |
| 91 | + |
| 92 | +{ #category : 'accessing' } |
| 93 | +StInspectorNewTempNode >> tempDescriptor: anObject [ |
| 94 | + |
| 95 | + tempDescriptor := anObject |
| 96 | +] |
| 97 | + |
| 98 | +{ #category : 'accessing' } |
| 99 | +StInspectorNewTempNode >> variableTag [ |
| 100 | + |
| 101 | + ^ 'temp. var' |
| 102 | +] |
0 commit comments