File tree Expand file tree Collapse file tree
src/utils/model-generator/internal
test/utils/model-generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,14 +17,24 @@ module TaintTracking = CS::TaintTracking;
1717
1818class Type = CS:: Type ;
1919
20+ /**
21+ * Holds if any of the parameters of `api` are `System.Func<>`.
22+ */
23+ private predicate isHigherOrder ( CS:: Callable api ) {
24+ exists ( Type t | t = api .getAParameter ( ) .getType ( ) .getUnboundDeclaration ( ) |
25+ t instanceof System:: SystemFuncDelegateType
26+ )
27+ }
28+
2029/**
2130 * Holds if it is relevant to generate models for `api`.
2231 */
2332private predicate isRelevantForModels ( CS:: Callable api ) {
2433 [ api .( CS:: Modifiable ) , api .( CS:: Accessor ) .getDeclaration ( ) ] .isEffectivelyPublic ( ) and
2534 api .getDeclaringType ( ) .getNamespace ( ) .getQualifiedName ( ) != "" and
2635 not api instanceof CS:: ConversionOperator and
27- not api instanceof Util:: MainMethod
36+ not api instanceof Util:: MainMethod and
37+ not isHigherOrder ( api )
2838}
2939
3040/**
Original file line number Diff line number Diff line change @@ -85,4 +85,17 @@ public Int32 M4(Int32 i)
8585 {
8686 return i ;
8787 }
88+ }
89+
90+ public class HigherOrderParameters
91+ {
92+ public string M1 ( string s , Func < string , string > map )
93+ {
94+ return s ;
95+ }
96+
97+ public object M2 ( Func < object , object > map , object o )
98+ {
99+ return map ( o ) ;
100+ }
88101}
You can’t perform that action at this time.
0 commit comments