@@ -61,19 +61,29 @@ class ClientSideGwtCompilationUnit extends GwtCompilationUnit {
6161 }
6262}
6363
64- /** Auxiliary predicate: `jsni` is a JSNI comment associated with method `m`. */
65- private predicate jsniComment ( Javadoc jsni , Method m ) {
64+ private predicate jsni ( Javadoc jsni , File file , int startline ) {
6665 // The comment must start with `-{` ...
6766 jsni .getChild ( 0 ) .getText ( ) .matches ( "-{%" ) and
6867 // ... and it must end with `}-`.
6968 jsni .getChild ( jsni .getNumChild ( ) - 1 ) .getText ( ) .matches ( "%}-" ) and
70- // The associated callable must be marked as `native` ...
69+ file = jsni .getFile ( ) and
70+ startline = jsni .getLocation ( ) .getStartLine ( )
71+ }
72+
73+ private predicate nativeMethodLines ( Method m , File file , int line ) {
7174 m .isNative ( ) and
72- // ... and the comment has to be contained in `m`.
73- jsni .getFile ( ) = m .getFile ( ) and
74- jsni .getLocation ( ) .getStartLine ( ) in [ m .getLocation ( ) .getStartLine ( ) .. m
75- .getLocation ( )
76- .getEndLine ( ) ]
75+ file = m .getFile ( ) and
76+ line in [ m .getLocation ( ) .getStartLine ( ) .. m .getLocation ( ) .getEndLine ( ) ]
77+ }
78+
79+ /** Auxiliary predicate: `jsni` is a JSNI comment associated with method `m`. */
80+ private predicate jsniComment ( Javadoc jsni , Method m ) {
81+ exists ( File file , int line |
82+ jsni ( jsni , file , line ) and
83+ // The associated callable must be marked as `native`
84+ // and the comment has to be contained in `m`.
85+ nativeMethodLines ( m , file , line )
86+ )
7787}
7888
7989/**
0 commit comments