Skip to content

Commit 9429e5c

Browse files
committed
Dataflow: Update StagePathNode.toString.
1 parent 81a815c commit 9429e5c

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,6 +2542,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
25422542
/** Gets the `FlowState` of this node. */
25432543
abstract FlowState getState();
25442544

2545+
/** Gets a textual representation of this element. */
25452546
abstract string toString();
25462547

25472548
predicate isSource() { none() }
@@ -2594,9 +2595,39 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
25942595

25952596
override FlowState getState() { result = state }
25962597

2597-
override string toString() {
2598+
private string ppType() {
2599+
exists(string ppt | ppt = t.toString() |
2600+
if ppt = "" then result = "" else result = " : " + ppt
2601+
)
2602+
}
2603+
2604+
private string ppAp() {
2605+
exists(string s | s = ap.toString() |
2606+
if s = "" then result = "" else result = " " + s
2607+
)
2608+
}
2609+
2610+
private string ppCtx() { result = " <" + cc + ">" }
2611+
2612+
private string ppSummaryCtx() {
2613+
summaryCtx instanceof TParamNodeNone and result = ""
2614+
or
2615+
exists(ParamNode p, Ap argAp0 |
2616+
summaryCtx = TParamNodeSome(p) and argAp = apSome(argAp0)
2617+
|
2618+
result = " <" + p + " : " + argT + " " + argAp0 + ">"
2619+
)
2620+
}
2621+
2622+
override string toString() { result = node.toString() + this.ppType() + this.ppAp() }
2623+
2624+
/**
2625+
* Gets a textual representation of this element, including a textual
2626+
* representation of the call context.
2627+
*/
2628+
string toStringWithContext() {
25982629
result =
2599-
node.toString() + " " + cc.toString() + " " + t.toString() + " " + ap.toString()
2630+
node.toString() + this.ppType() + this.ppAp() + this.ppCtx() + this.ppSummaryCtx()
26002631
}
26012632

26022633
override predicate isSource() {

0 commit comments

Comments
 (0)