File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed
Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change 1010
1111 import javascript
1212
13- abstract class CommandUsage extends Locatable {
14- abstract string getCommandName ( ) ;
13+ class CommandName extends string {
14+ CommandName ( ) { exists ( CommandUsage e | e . getCommandName ( ) = this ) }
1515
16- predicate isUsedFromOtherPlace ( ) {
17- exists ( CommandUsage e | e != this and e .getCommandName ( ) = this .getCommandName ( ) )
18- }
16+ int getNumberOfUsages ( ) { result = count ( CommandUsage e | e .getCommandName ( ) = this | e ) }
1917
20- predicate isFirstUsage ( ) {
21- forall ( CommandUsage e | e .getCommandName ( ) = this .getCommandName ( ) |
22- e .getLocationOrdinal ( ) >= this .getLocationOrdinal ( )
18+ CommandUsage getFirstUsage ( ) {
19+ result .getCommandName ( ) = this and
20+ forall ( CommandUsage e | e .getCommandName ( ) = this |
21+ e .getLocationOrdinal ( ) >= result .getLocationOrdinal ( )
2322 )
2423 }
24+ }
25+
26+ abstract class CommandUsage extends Locatable {
27+ abstract string getCommandName ( ) ;
2528
2629 string getLocationOrdinal ( ) {
2730 result =
8184 override string getCommandName ( ) { result = this .getPropValue ( "command" ) .getStringValue ( ) }
8285 }
8386
84- from CommandUsage e
85- where
86- e .isUsedFromOtherPlace ( ) and
87- not e .isFirstUsage ( )
88- select e , "The " + e .getCommandName ( ) + " command is used from another location"
87+ from CommandName c
88+ where c .getNumberOfUsages ( ) > 1
89+ select c .getFirstUsage ( ) ,
90+ "The " + c + " command is used from " + c .getNumberOfUsages ( ) + " locations"
8991
You can’t perform that action at this time.
0 commit comments