JavaScript: Introduce Type(Back)Tracker::continue predicate.

This commit is contained in:
Max Schaefer
2019-03-29 11:45:18 +00:00
parent c097031c7e
commit 62c895de3e
2 changed files with 15 additions and 16 deletions

View File

@@ -168,10 +168,12 @@ class TypeTracker extends TTypeTracker {
boolean hasCall() { result = hasCall }
/**
* Gets the property this type has been tracked into, or the empty string if
* it has not been tracked into a property.
* Gets a type tracker that starts where this one has left off to allow continued
* tracking.
*
* This predicate is only defined if the type has not been tracked into a property.
*/
string getProp() { result = prop }
TypeTracker continue() { prop = "" and result = this }
}
module TypeTracker {
@@ -257,10 +259,12 @@ class TypeBackTracker extends TTypeBackTracker {
boolean hasReturn() { result = hasReturn }
/**
* Gets the property this type has been tracked into, or the empty string if
* it has not been tracked into a property.
* Gets a type tracker that starts where this one has left off to allow continued
* tracking.
*
* This predicate is only defined if the type has not been tracked into a property.
*/
string getProp() { result = prop }
TypeBackTracker continue() { prop = "" and result = this }
}
module TypeBackTracker {

View File

@@ -51,8 +51,7 @@ module SocketIO {
// exclude getter versions
exists(mcn.getAnArgument()) and
result = mcn and
t2.getProp() = "" and
t = t2
t = t2.continue()
)
)
}
@@ -111,8 +110,7 @@ module SocketIO {
or
// invocation of a chainable method
result = pred.getAMethodCall(namespaceChainableMethod()) and
t2.getProp() = "" and
t = t2
t = t2.continue()
or
// invocation of chainable getter method
exists(string m |
@@ -121,8 +119,7 @@ module SocketIO {
m = "volatile"
|
result = pred.getAPropertyRead(m) and
t2.getProp() = "" and
t = t2
t = t2.continue()
)
)
}
@@ -174,8 +171,7 @@ module SocketIO {
m = EventEmitter::chainableMethod()
|
result = pred.getAMethodCall(m) and
t2.getProp() = "" and
t = t2
t = t2.continue()
)
or
// invocation of a chainable getter method
@@ -186,8 +182,7 @@ module SocketIO {
m = "volatile"
|
result = pred.getAPropertyRead(m) and
t2.getProp() = "" and
t = t2
t = t2.continue()
)
)
}