@@ -126,30 +126,33 @@ class VSTestAssertNonNullMethod extends AssertNonNullMethod {
126126
127127/** A method that forwards to another assertion method. */
128128class ForwarderAssertMethod extends AssertMethod {
129- AssertMethod forwardee ;
129+ Assertion a ;
130130 Parameter p ;
131131
132132 ForwarderAssertMethod ( ) {
133133 p = this .getAParameter ( ) and
134134 strictcount ( AssignableDefinition def | def .getTarget ( ) = p ) = 1 and
135135 forex ( ControlFlowElement body |
136136 body = this .getABody ( ) |
137- exists ( Assertion a |
138- body = getAnAssertingElement ( a ) and
139- a .getExpr ( ) = p .getAnAccess ( ) and
140- forwardee = a .getAssertMethod ( )
141- )
137+ bodyAsserts ( this , body , a ) and
138+ a .getExpr ( ) = p .getAnAccess ( )
142139 )
143140 }
144141
145142 override int getAssertionIndex ( ) { result = p .getPosition ( ) }
146143
147144 override ExceptionClass getExceptionClass ( ) {
148- result = forwardee .getExceptionClass ( )
145+ result = this . getUnderlyingAssertMethod ( ) .getExceptionClass ( )
149146 }
150147
151148 /** Gets the underlying assertion method that is being forwarded to. */
152- AssertMethod getUnderlyingAssertMethod ( ) { result = forwardee }
149+ AssertMethod getUnderlyingAssertMethod ( ) { result = a .getAssertMethod ( ) }
150+ }
151+
152+ pragma [ noinline]
153+ private predicate bodyAsserts ( Callable c , ControlFlowElement body , Assertion a ) {
154+ c .getABody ( ) = body and
155+ body = getAnAssertingElement ( a )
153156}
154157
155158private ControlFlowElement getAnAssertingElement ( Assertion a ) {
0 commit comments