@@ -20,15 +20,15 @@ class WideCharPointerType extends PointerType {
20
20
}
21
21
22
22
/**
23
- * Given type `cur `, recurses through all intermediate types to find
24
- * any intermediate type equal to type `targ`
23
+ * Given type `t `, recurses through and returns all
24
+ * intermediate base types, including `t`.
25
25
*/
26
- predicate hasIntermediateType ( Type cur , Type targ ) {
27
- cur = targ
26
+ Type getABaseType ( Type t ) {
27
+ result = t
28
28
or
29
- hasIntermediateType ( cur .( DerivedType ) .getBaseType ( ) , targ )
29
+ result = getABaseType ( t .( DerivedType ) .getBaseType ( ) )
30
30
or
31
- hasIntermediateType ( cur .( TypedefType ) .getBaseType ( ) , targ )
31
+ result = getABaseType ( t .( TypedefType ) .getBaseType ( ) )
32
32
}
33
33
34
34
/**
@@ -40,7 +40,7 @@ class UnlikelyToBeAStringType extends Type {
40
40
targ .( CharType ) .isUnsigned ( ) or
41
41
targ .getName ( ) .toLowerCase ( ) .matches ( [ "uint8_t" , "%byte%" ] )
42
42
|
43
- hasIntermediateType ( this , targ )
43
+ getABaseType ( this ) = targ
44
44
)
45
45
}
46
46
}
@@ -59,7 +59,7 @@ class UnicodeMacroDependentWidthType extends Type {
59
59
"TCHAR"
60
60
]
61
61
|
62
- hasIntermediateType ( this , targ )
62
+ getABaseType ( this ) = targ
63
63
)
64
64
}
65
65
}
0 commit comments