Skip to content

Commit 11f06e4

Browse files
authored
ast: clean up in types.v (#18793)
1 parent 2d838d5 commit 11f06e4

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

vlib/v/ast/types.v

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,7 @@ pub fn (t &Table) type_kind(typ Type) Kind {
695695
}
696696

697697
pub fn (t &Table) type_is_for_pointer_arithmetic(typ Type) bool {
698-
typ_sym := t.sym(typ)
699-
if typ_sym.kind == .struct_ {
698+
if t.sym(typ).kind == .struct_ {
700699
return false
701700
} else {
702701
return typ.is_any_kind_of_pointer() || typ.is_int_valptr()
@@ -881,9 +880,8 @@ pub fn (t &TypeSymbol) sumtype_info() SumType {
881880
}
882881

883882
pub fn (t &TypeSymbol) is_heap() bool {
884-
if t.kind == .struct_ {
885-
info := t.info as Struct
886-
return info.is_heap
883+
if t.info is Struct {
884+
return t.info.is_heap
887885
} else {
888886
return false
889887
}
@@ -1154,10 +1152,10 @@ pub fn (t &Table) type_to_str(typ Type) string {
11541152
}
11551153

11561154
// type name in code (for builtin)
1157-
pub fn (mytable &Table) type_to_code(t Type) string {
1158-
match t {
1159-
ast.int_literal_type, ast.float_literal_type { return mytable.sym(t).kind.str() }
1160-
else { return mytable.type_to_str_using_aliases(t, map[string]string{}) }
1155+
pub fn (t &Table) type_to_code(typ Type) string {
1156+
match typ {
1157+
ast.int_literal_type, ast.float_literal_type { return t.sym(typ).kind.str() }
1158+
else { return t.type_to_str_using_aliases(typ, map[string]string{}) }
11611159
}
11621160
}
11631161

0 commit comments

Comments
 (0)