mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JS: Make 'typeStrongerThan' transitive
This commit is contained in:
@@ -583,19 +583,14 @@ class DataFlowType extends TDataFlowType {
|
||||
DataFlow::ClassNode asInstanceOfClass() { this = TInstanceType(result) }
|
||||
}
|
||||
|
||||
private predicate typeStrongerThan1(DataFlowType t1, DataFlowType t2) {
|
||||
// 't1' is a subclass of 't2'
|
||||
t1.asInstanceOfClass() = t2.asInstanceOfClass().getADirectSubClass()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `t1` is strictly stronger than `t2`.
|
||||
*/
|
||||
predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) {
|
||||
typeStrongerThan1(t1, t2)
|
||||
// 't1' is a subclass of 't2'
|
||||
t1.asInstanceOfClass() = t2.asInstanceOfClass().getADirectSubClass+()
|
||||
or
|
||||
// Ensure all types are transitively stronger than 'any'
|
||||
not typeStrongerThan1(t1, _) and
|
||||
// Ensure all types are stronger than 'any'
|
||||
not t1 = TAnyType() and
|
||||
t2 = TAnyType()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user