@@ -886,6 +886,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
886
886
cached
887
887
predicate nodeDataFlowType ( Node n , DataFlowType t ) { t = getNodeType ( n ) }
888
888
889
+ cached
890
+ predicate typeStrongerThanCached ( DataFlowType t1 , DataFlowType t2 ) { typeStrongerThan ( t1 , t2 ) }
891
+
889
892
cached
890
893
predicate jumpStepCached ( Node node1 , Node node2 ) { jumpStep ( node1 , node2 ) }
891
894
@@ -1622,7 +1625,9 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1622
1625
1623
1626
bindingset [ t1, t2]
1624
1627
pragma [ inline_late]
1625
- private predicate typeStrongerThan0 ( DataFlowType t1 , DataFlowType t2 ) { typeStrongerThan ( t1 , t2 ) }
1628
+ predicate typeStrongerThanFilter ( DataFlowType t1 , DataFlowType t2 ) {
1629
+ typeStrongerThanCached ( t1 , t2 )
1630
+ }
1626
1631
1627
1632
private predicate callEdge ( DataFlowCall call , DataFlowCallable c , ArgNode arg , ParamNode p ) {
1628
1633
viableParamArg ( call , p , arg ) and
@@ -1703,7 +1708,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1703
1708
nodeDataFlowType ( arg , at ) and
1704
1709
nodeDataFlowType ( p , pt ) and
1705
1710
relevantCallEdge ( _, _, arg , p ) and
1706
- typeStrongerThan0 ( pt , at )
1711
+ typeStrongerThanFilter ( pt , at )
1707
1712
)
1708
1713
or
1709
1714
exists ( ParamNode p , DataFlowType at , DataFlowType pt |
@@ -1714,7 +1719,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1714
1719
nodeDataFlowType ( p , pt ) and
1715
1720
paramMustFlow ( p , arg ) and
1716
1721
relevantCallEdge ( _, _, arg , _) and
1717
- typeStrongerThan0 ( at , pt )
1722
+ typeStrongerThanFilter ( at , pt )
1718
1723
)
1719
1724
or
1720
1725
exists ( ParamNode p |
@@ -1754,7 +1759,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1754
1759
nodeDataFlowType ( arg , at ) and
1755
1760
nodeDataFlowType ( p , pt ) and
1756
1761
relevantCallEdge ( _, _, arg , p ) and
1757
- typeStrongerThan0 ( at , pt )
1762
+ typeStrongerThanFilter ( at , pt )
1758
1763
)
1759
1764
or
1760
1765
exists ( ArgNode arg |
@@ -1823,8 +1828,13 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
1823
1828
* stronger then compatibility is checked and `t1` is returned.
1824
1829
*/
1825
1830
bindingset [ t1, t2]
1831
+ pragma [ inline_late]
1826
1832
DataFlowType getStrongestType ( DataFlowType t1 , DataFlowType t2 ) {
1827
- if typeStrongerThan ( t2 , t1 ) then result = t2 else ( compatibleTypes ( t1 , t2 ) and result = t1 )
1833
+ if typeStrongerThanCached ( t2 , t1 )
1834
+ then result = t2
1835
+ else (
1836
+ compatibleTypes ( t1 , t2 ) and result = t1
1837
+ )
1828
1838
}
1829
1839
1830
1840
/**
0 commit comments