@@ -81,6 +81,14 @@ class Node0Impl extends TIRDataFlowNode0 {
81
81
/** Gets the operands corresponding to this node, if any. */
82
82
Operand asOperand ( ) { result = this .( OperandNode0 ) .getOperand ( ) }
83
83
84
+ /** Gets the location of this node. */
85
+ final Location getLocation ( ) { result = this .getLocationImpl ( ) }
86
+
87
+ /** INTERNAL: Do not use. */
88
+ Location getLocationImpl ( ) {
89
+ none ( ) // overridden by subclasses
90
+ }
91
+
84
92
/** INTERNAL: Do not use. */
85
93
string toStringImpl ( ) {
86
94
none ( ) // overridden by subclasses
@@ -131,9 +139,15 @@ abstract class InstructionNode0 extends Node0Impl {
131
139
override DataFlowType getType ( ) { result = getInstructionType ( instr , _) }
132
140
133
141
override string toStringImpl ( ) {
134
- // This predicate is overridden in subclasses. This default implementation
135
- // does not use `Instruction.toString` because that's expensive to compute.
136
- result = instr .getOpcode ( ) .toString ( )
142
+ if instr .( InitializeParameterInstruction ) .getIRVariable ( ) instanceof IRThisVariable
143
+ then result = "this"
144
+ else result = instr .getAst ( ) .toString ( )
145
+ }
146
+
147
+ override Location getLocationImpl ( ) {
148
+ if exists ( instr .getAst ( ) .getLocation ( ) )
149
+ then result = instr .getAst ( ) .getLocation ( )
150
+ else result instanceof UnknownDefaultLocation
137
151
}
138
152
139
153
final override predicate isGLValue ( ) { exists ( getInstructionType ( instr , true ) ) }
@@ -173,7 +187,17 @@ abstract class OperandNode0 extends Node0Impl {
173
187
174
188
override DataFlowType getType ( ) { result = getOperandType ( op , _) }
175
189
176
- override string toStringImpl ( ) { result = op .toString ( ) }
190
+ override string toStringImpl ( ) {
191
+ if op .getDef ( ) .( InitializeParameterInstruction ) .getIRVariable ( ) instanceof IRThisVariable
192
+ then result = "this"
193
+ else result = op .getDef ( ) .getAst ( ) .toString ( )
194
+ }
195
+
196
+ override Location getLocationImpl ( ) {
197
+ if exists ( op .getDef ( ) .getAst ( ) .getLocation ( ) )
198
+ then result = op .getDef ( ) .getAst ( ) .getLocation ( )
199
+ else result instanceof UnknownDefaultLocation
200
+ }
177
201
178
202
final override predicate isGLValue ( ) { exists ( getOperandType ( op , true ) ) }
179
203
}
0 commit comments