7
7
import rust
8
8
9
9
/**
10
- * Gets a location for an `Unimplemented` node.
11
- */
12
- Location getUnimplementedLocation ( Unimplemented node ) {
13
- result = node .( Locatable ) .getLocation ( )
14
- or
15
- not node instanceof Locatable and
16
- result instanceof EmptyLocation
17
- }
18
-
19
- /**
20
- * Gets `l.toString()`, but with any locations outside of the source location prefix cleaned up.
21
- */
22
- bindingset [ l]
23
- string cleanLocationString ( Location l ) {
24
- if exists ( l .getFile ( ) .getRelativePath ( ) ) or l instanceof EmptyLocation
25
- then result = l .toString ( )
26
- else l .getFile ( ) .getParentContainer ( ) .getAbsolutePath ( ) + result = l .toString ( ) // remove the directory from the string
27
- }
28
-
29
- /**
30
- * Gets a string along the lines of " (x2)", corresponding to the number `i`. For `i = 1`, the result is the empty string.
10
+ * Gets a string along the lines of " (x2)", corresponding to the number `i`.
11
+ * For `i = 1`, the result is the empty string.
31
12
*/
32
13
bindingset [ i]
33
14
string multipleString ( int i ) {
@@ -36,26 +17,8 @@ string multipleString(int i) {
36
17
i > 1 and result = " (x" + i .toString ( ) + ")"
37
18
}
38
19
39
- query predicate listUnimplemented ( string location , string msg ) {
40
- // something that is not extracted yet
41
- exists ( int c |
42
- c = strictcount ( Unimplemented n | cleanLocationString ( getUnimplementedLocation ( n ) ) = location ) and
43
- msg = "Not yet implemented" + multipleString ( c ) + "."
44
- )
45
- }
46
-
47
- query predicate listMissingExpr ( string location , string msg ) {
48
- // gaps in the AST due to parse errors
49
- exists ( int c |
50
- c = strictcount ( MissingExpr e | cleanLocationString ( e .getLocation ( ) ) = location ) and
51
- msg = "Missing expression" + multipleString ( c ) + "."
52
- )
53
- }
54
-
55
- query predicate listMissingPat ( string location , string msg ) {
56
- // gaps in the AST due to parse errors
57
- exists ( int c |
58
- c = strictcount ( MissingPat p | cleanLocationString ( p .getLocation ( ) ) = location ) and
59
- msg = "Missing pattern" + multipleString ( c ) + "."
60
- )
61
- }
20
+ from string name , int c
21
+ where c = strictcount ( Unextracted e | e .toString ( ) = name )
22
+ // we don't have locations, so just list the number of each type of
23
+ // `Unextracted` element.
24
+ select name + multipleString ( c )
0 commit comments