Skip to content

Commit ad4522c

Browse files
committed
JS: Make 'typeStrongerThan' transitive
1 parent e40ee82 commit ad4522c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/DataFlowPrivate.qll

+3-8
Original file line numberDiff line numberDiff line change
@@ -583,19 +583,14 @@ class DataFlowType extends TDataFlowType {
583583
DataFlow::ClassNode asInstanceOfClass() { this = TInstanceType(result) }
584584
}
585585

586-
private predicate typeStrongerThan1(DataFlowType t1, DataFlowType t2) {
587-
// 't1' is a subclass of 't2'
588-
t1.asInstanceOfClass() = t2.asInstanceOfClass().getADirectSubClass()
589-
}
590-
591586
/**
592587
* Holds if `t1` is strictly stronger than `t2`.
593588
*/
594589
predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) {
595-
typeStrongerThan1(t1, t2)
590+
// 't1' is a subclass of 't2'
591+
t1.asInstanceOfClass() = t2.asInstanceOfClass().getADirectSubClass+()
596592
or
597-
// Ensure all types are transitively stronger than 'any'
598-
not typeStrongerThan1(t1, _) and
593+
// Ensure all types are stronger than 'any'
599594
not t1 = TAnyType() and
600595
t2 = TAnyType()
601596
}

0 commit comments

Comments
 (0)