Skip to content

Commit 7042f67

Browse files
committed
Refactor code to be simpler
1 parent 778826b commit 7042f67

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

go/ql/lib/semmle/go/Types.qll

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ class Type extends @type {
165165
predicate hasLocationInfo(
166166
string filepath, int startline, int startcolumn, int endline, int endcolumn
167167
) {
168+
this.getEntity().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
169+
or
170+
not exists(this.getEntity()) and
168171
filepath = "" and
169172
startline = 0 and
170173
startcolumn = 0 and
@@ -1014,17 +1017,6 @@ class NamedType extends @namedtype, CompositeType {
10141017
}
10151018

10161019
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
1017-
1018-
override predicate hasLocationInfo(
1019-
string filepath, int startline, int startcolumn, int endline, int endcolumn
1020-
) {
1021-
exists(DeclaredType dt |
1022-
dt.getType() = this and
1023-
// Note that if the type declaration isn't in the source that we have
1024-
// then we use a dummy location.
1025-
dt.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
1026-
)
1027-
}
10281020
}
10291021

10301022
/**

0 commit comments

Comments
 (0)