C#: Address review comments.

This commit is contained in:
Calum Grant
2020-05-18 09:28:50 +01:00
committed by Tom Hvitved
parent 9a51192d86
commit 0cfe424fc2

View File

@@ -11,6 +11,7 @@ import csharp
* This is used for extensionals that can be supplied
* as either type references or types.
*/
cached
@type_or_ref getTypeRef(@type type) {
result = type
or
@@ -37,7 +38,7 @@ private module TypeRefs {
*/
Type getCanonicalType() {
result = this.getAType() and
isCanonicalType(result)
not locationIsBetter(canonicalTypeLocation(result), canonicalTypeLocation(this.getAType()))
}
}
@@ -63,11 +64,4 @@ private module TypeRefs {
typeLocation.(SourceLocation).getFile().getAbsolutePath() <
betterLocation.(SourceLocation).getFile().getAbsolutePath()
}
private predicate isCanonicalType(Type type) {
not exists(TypeRef tr |
type = tr.getAType() and
locationIsBetter(canonicalTypeLocation(type), canonicalTypeLocation(tr.getAType()))
)
}
}