11import csharp
22import semmle.code.csharp.commons.StructuralComparison
33
4- private class StructuralComparisonTest extends StructuralComparisonConfiguration {
5- StructuralComparisonTest ( ) { this = "StructuralComparisonTest" }
6-
7- /**
8- * All pairs of controls flow elements found in the source and within the same
9- * enclosing callable excluding all instances of `ThisAccess` to reduce the size
10- * of the output.
11- */
12- override predicate candidate ( ControlFlowElement e1 , ControlFlowElement e2 ) {
13- e1 .fromSource ( ) and
14- e2 .fromSource ( ) and
15- e1 != e2 and
16- e1 .getEnclosingCallable ( ) = e2 .getEnclosingCallable ( ) and
17- not e1 instanceof ThisAccess
18- }
4+ /**
5+ * All pairs of controls flow elements found in the source and within the same
6+ * enclosing callable excluding all instances of `ThisAccess` to reduce the size
7+ * of the output.
8+ */
9+ private predicate candidate ( ControlFlowElement x , ControlFlowElement y ) {
10+ x .fromSource ( ) and
11+ y .fromSource ( ) and
12+ x != y and
13+ x .getEnclosingCallable ( ) = y .getEnclosingCallable ( ) and
14+ not x instanceof ThisAccess
1915}
2016
21- query predicate same ( ControlFlowElement e1 , ControlFlowElement e2 ) {
22- exists ( StructuralComparisonTest sct , Location l1 , Location l2 |
23- sct .same ( e1 , e2 ) and
24- l1 = e1 .getLocation ( ) and
25- l2 = e2 .getLocation ( ) and
17+ query predicate same ( ControlFlowElement x , ControlFlowElement y ) {
18+ exists ( Location l1 , Location l2 |
19+ candidate ( x , y ) and
20+ sameGvn ( x , y ) and
21+ l1 = x .getLocation ( ) and
22+ l2 = y .getLocation ( ) and
2623 (
2724 l1 .getStartLine ( ) < l2 .getStartLine ( )
2825 or
@@ -31,4 +28,4 @@ query predicate same(ControlFlowElement e1, ControlFlowElement e2) {
3128 )
3229}
3330
34- query predicate gvn ( ControlFlowElement e , Gvn gvn ) { gvn = toGvn ( e ) and e .fromSource ( ) }
31+ query predicate gvn ( ControlFlowElement x , Gvn gvn ) { gvn = toGvn ( x ) and x .fromSource ( ) }
0 commit comments