Skip to content

Commit c4dc2f5

Browse files
committed
Revert "WIP: Factor out Promisification state"
This reverts commit 79d2b84.
1 parent e831489 commit c4dc2f5

1 file changed

Lines changed: 1 addition & 31 deletions

File tree

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,14 +1133,6 @@ module API {
11331133
// for fields and accessors, mark the reads as use-nodes
11341134
decoratorPropEdge(base, lbl, ref.(DataFlow::PropRead))
11351135
)
1136-
or
1137-
// awaiting the return value from a promisified function
1138-
exists(DataFlow::SourceNode src, DataFlow::SourceNode pred, string propDesc, int boundArgs |
1139-
use(base, src) and
1140-
pred = trackUseNode(src, Promisification::promisifiedReturnValue(boundArgs), 0, propDesc) and
1141-
awaitedStep(pred, ref) and
1142-
lbl = Label::parameter(boundArgs)
1143-
)
11441136
}
11451137

11461138
/** Holds if `base` is a use-node that flows to the decorator expression of the given decorator. */
@@ -1266,31 +1258,19 @@ module API {
12661258
/** Default statue; the tracked value has not been through any steps related to promisification. */
12671259
TNotPromisified() or
12681260
/** The tracked value is a function that has been through promisification. */
1269-
TPromisifiedFunction() or
1270-
/** The tracked value is returned from a call to a promisified function, i.e. it is a promise resolving the value that eventually gets passed to a callback. */
1271-
TPromisifiedReturnValue(int callbackArgumentIndex) { callbackArgumentIndex = [0 .. 10] }
1261+
TPromisifiedFunction()
12721262

12731263
class State extends TState {
12741264
string toString() {
12751265
this = TNotPromisified() and result = "not-promisified"
12761266
or
12771267
this = TPromisifiedFunction() and result = "promisified-function"
1278-
or
1279-
exists(int i |
1280-
this = TPromisifiedReturnValue(i) and result = "promisified-return-value(" + i + ")"
1281-
)
12821268
}
12831269
}
12841270

12851271
State notPromisified() { result = TNotPromisified() }
12861272

12871273
State promisifiedFunction() { result = TPromisifiedFunction() }
1288-
1289-
State promisifiedReturnValue(int i) { result = TPromisifiedReturnValue(i) }
1290-
}
1291-
1292-
private predicate awaitedStep(DataFlow::Node node1, DataFlow::Node node2) {
1293-
StepSummary::smallstep(node1, node2, LoadStep(Promises::valueProp()))
12941274
}
12951275

12961276
/**
@@ -1325,16 +1305,6 @@ module API {
13251305
result = promisify
13261306
)
13271307
or
1328-
exists(DataFlow::CallNode call, int bound |
1329-
call =
1330-
trackUseNode(nd, Promisification::promisifiedFunction(), bound, prop, t.continue())
1331-
.getACall() and
1332-
promisified = Promisification::promisifiedReturnValue(bound + call.getNumArgument()) and
1333-
boundArgs = 0 and
1334-
result = call and
1335-
prop = ""
1336-
)
1337-
or
13381308
exists(DataFlow::PartialInvokeNode pin, DataFlow::Node pred, int predBoundArgs |
13391309
trackUseNode(nd, promisified, predBoundArgs, prop, t.continue()).flowsTo(pred) and
13401310
prop = "" and

0 commit comments

Comments
 (0)