Skip to content

Commit 6804f94

Browse files
committed
Go: Factor out isAlias function
1 parent 878999b commit 6804f94

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

go/extractor/extractor.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,9 +1507,15 @@ func extractSpec(tw *trap.Writer, spec ast.Spec, parent trap.Label, idx int) {
15071507
extractNodeLocation(tw, spec, lbl)
15081508
}
15091509

1510+
// Determines whether the given type is an alias.
1511+
func isAlias(tp types.Type) bool {
1512+
_, ok := tp.(*types.Alias)
1513+
return ok
1514+
}
1515+
15101516
// If the given type is a type alias, this function resolves it to its underlying type.
15111517
func resolveTypeAlias(tp types.Type) types.Type {
1512-
if _, ok := tp.(*types.Alias); ok {
1518+
if isAlias(tp) {
15131519
return tp.Underlying()
15141520
}
15151521
return tp

0 commit comments

Comments
 (0)