@@ -2252,6 +2252,18 @@ module Ssa {
22522252 /** Gets the basic block to which this SSA definition belongs. */
22532253 BasicBlock getBasicBlock ( ) { this .definesAt ( result , _) }
22542254
2255+ /**
2256+ * Gets the syntax element associated with this SSA definition, if any.
2257+ * This is either an expression, for example `x = 0`, a parameter, or a
2258+ * callable. Pseudo nodes have no associated syntax element.
2259+ */
2260+ Element getElement ( ) {
2261+ exists ( BasicBlock bb , int i |
2262+ this .definesAt ( bb , i ) |
2263+ result = bb .getNode ( i ) .getElement ( )
2264+ )
2265+ }
2266+
22552267 /**
22562268 * Holds if this SSA definition assigns to `out`/`ref` parameter `p`, and the
22572269 * parameter may remain unchanged throughout the rest of the enclosing callable.
@@ -2341,6 +2353,8 @@ module Ssa {
23412353 isCapturedVariableDefinitionFlowOut ( this , cdef )
23422354 }
23432355
2356+ override Element getElement ( ) { result = ad .getElement ( ) }
2357+
23442358 override string toString ( ) {
23452359 if this .getADefinition ( ) instanceof AssignableDefinitions:: ImplicitParameterDefinition then
23462360 result = getToStringPrefix ( this ) + "SSA param(" + this .getSourceVariable ( ) + ")"
@@ -2384,6 +2398,8 @@ module Ssa {
23842398 )
23852399 }
23862400
2401+ override Callable getElement ( ) { result = this .getCallable ( ) }
2402+
23872403 override string toString ( ) {
23882404 if this .getSourceVariable ( ) .getAssignable ( ) instanceof LocalScopeVariable then
23892405 result = getToStringPrefix ( this ) + "SSA capture def(" + this .getSourceVariable ( ) + ")"
0 commit comments