@@ -51,6 +51,21 @@ abstract class BadDynamicCall extends DynamicExpr {
5151 )
5252 )
5353 }
54+
55+ private predicate myTest (
56+ Variable v , int i , Expr source , AssignableRead read , SsaDefinition ssaDef ,
57+ SsaExplicitWrite ultimateSsaDef , Type t , string tName
58+ ) {
59+ read = this .getARelevantVariableAccess ( i ) and
60+ v = read .getTarget ( ) and
61+ t = source .getType ( ) and
62+ // t.getName() = "MyType" and
63+ tName = t .getFullyQualifiedNameDebug ( ) and
64+ // v.getName() = "d" and
65+ read = ssaDef .getARead ( ) and
66+ ultimateSsaDef = ssaDef .getAnUltimateDefinition ( ) and
67+ ultimateSsaDef .getValue ( ) .stripImplicit ( ) = source
68+ }
5469}
5570
5671class BadDynamicMethodCall extends BadDynamicCall , DynamicMethodCall {
@@ -70,12 +85,20 @@ class BadDynamicMethodCall extends BadDynamicCall, DynamicMethodCall {
7085 }
7186}
7287
88+ private predicate myTest ( DynamicOperatorCall doc , string targetQlClass , string opName ) {
89+ targetQlClass = doc .getARuntimeArgument ( ) .getAPrimaryQlClass ( ) and
90+ opName = doc .getLateBoundTargetName ( ) and
91+ opName = "checked --"
92+ }
93+
7394class BadDynamicOperatorCall extends BadDynamicCall , DynamicOperatorCall {
95+ // BadDynamicOperatorCall() { this.getARuntimeTarget() instanceof CheckedDecrementOperator }
7496 override AssignableRead getARelevantVariableAccess ( int i ) { result = this .getRuntimeArgument ( i ) }
7597
7698 override predicate isBad ( Variable v , ValueOrRefType pt , Expr pts , string message , string target ) {
7799 exists ( int i |
78100 pt = this .possibleBadTypeForRelevantSource ( v , i , pts ) and
101+ pt .getName ( ) = "MyType" and
79102 not pt .containsTypeParameters ( ) and
80103 not exists ( Type paramType | paramType = this .getADynamicParameterType ( _, i ) |
81104 pt .isImplicitlyConvertibleTo ( paramType )
@@ -99,7 +122,8 @@ class BadDynamicOperatorCall extends BadDynamicCall, DynamicOperatorCall {
99122
100123 private Type getADynamicParameterType ( Operator o , int i ) {
101124 o = this .getARuntimeTarget ( ) and
102- result = o .getParameter ( i ) .getType ( )
125+ result = o .getParameter ( i ) .getType ( ) and
126+ o .getName ( ) = "checked ++"
103127 }
104128}
105129
0 commit comments