File tree Expand file tree Collapse file tree 3 files changed +30
-14
lines changed Expand file tree Collapse file tree 3 files changed +30
-14
lines changed Original file line number Diff line number Diff line change @@ -285,16 +285,23 @@ pub fn (mut f Fmt) short_module(name string) string {
285
285
286
286
pub fn (mut f Fmt) mark_types_import_as_used (typ ast.Type) {
287
287
sym := f.table.sym (typ)
288
- if sym.info is ast.Map {
289
- map_info := sym.map_info ()
290
- f.mark_types_import_as_used (map_info.key_type)
291
- f.mark_types_import_as_used (map_info.value_type)
292
- return
293
- }
294
- if sym.info is ast.GenericInst {
295
- for concrete_typ in sym.info.concrete_types {
296
- f.mark_types_import_as_used (concrete_typ)
288
+ match sym.info {
289
+ ast.Map {
290
+ map_info := sym.map_info ()
291
+ f.mark_types_import_as_used (map_info.key_type)
292
+ f.mark_types_import_as_used (map_info.value_type)
293
+ return
294
+ }
295
+ ast.Array, ast.ArrayFixed {
296
+ f.mark_types_import_as_used (sym.info.elem_type)
297
+ return
298
+ }
299
+ ast.GenericInst {
300
+ for concrete_typ in sym.info.concrete_types {
301
+ f.mark_types_import_as_used (concrete_typ)
302
+ }
297
303
}
304
+ else {}
298
305
}
299
306
name := sym.name.split ('[' )[0 ] // take `Type` from `Type[T]`
300
307
f.mark_import_as_used (name)
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import mod {
14
14
FnArgGeneric,
15
15
FnArgTypeParam1,
16
16
FnArgTypeParam2,
17
+ FnArgVariadic,
17
18
FnRet,
18
19
FnRetGeneric,
19
20
FnRetTypeParam1,
@@ -23,8 +24,10 @@ import mod {
23
24
InterfaceMethodRet,
24
25
RightOfAs,
25
26
RightOfIs,
27
+ StructArrayFieldElem,
26
28
StructEmbed,
27
29
StructField,
30
+ StructFixedArrayFieldElem,
28
31
StructMapFieldKey,
29
32
StructMapFieldValue,
30
33
StructMethodArg,
@@ -42,9 +45,11 @@ type Fn = fn (FnAliasParam) FnAliasRet
42
45
43
46
struct Struct {
44
47
StructEmbed
45
- v StructField
46
- ref &StructRefField
47
- map map[StructMapFieldKey]StructMapFieldValue
48
+ v StructField
49
+ ref &StructRefField
50
+ map map[StructMapFieldKey]StructMapFieldValue
51
+ arr []StructArrayFieldElem
52
+ arr_fixed [2]StructFixedArrayFieldElem
48
53
}
49
54
50
55
fn (s Struct) method(v StructMethodArg) StructMethodRet {
@@ -60,7 +65,7 @@ interface Interface {
60
65
f(InterfaceMethodArg) InterfaceMethodRet
61
66
}
62
67
63
- fn f(v FnArg) FnRet {
68
+ fn f(v FnArg, vv ...FnArgVariadic ) FnRet {
64
69
if v is RightOfIs {
65
70
}
66
71
_ = v as RightOfAs
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import mod {
11
11
Unused,
12
12
StructEmbed, StructField, StructRefField
13
13
StructMapFieldKey, StructMapFieldValue,
14
+ StructArrayFieldElem, StructFixedArrayFieldElem
14
15
StructMethodArg,
15
16
StructMethodArgGeneric,
16
17
StructMethodRet,
@@ -21,6 +22,7 @@ import mod {
21
22
InterfaceMethodRet,
22
23
23
24
FnArg,
25
+ FnArgVariadic
24
26
FnArgGeneric
25
27
FnArgTypeParam1
26
28
FnArgTypeParam2
@@ -48,6 +50,8 @@ struct Struct {
48
50
v StructField
49
51
ref &StructRefField
50
52
map map[StructMapFieldKey]StructMapFieldValue
53
+ arr []StructArrayFieldElem
54
+ arr_fixed [2]StructFixedArrayFieldElem
51
55
}
52
56
53
57
fn (s Struct) method(v StructMethodArg) StructMethodRet {
@@ -63,7 +67,7 @@ interface Interface {
63
67
f(InterfaceMethodArg) InterfaceMethodRet
64
68
}
65
69
66
- fn f(v FnArg) FnRet {
70
+ fn f(v FnArg, vv ...FnArgVariadic ) FnRet {
67
71
if v is RightOfIs {}
68
72
_ = v as RightOfAs
69
73
You can’t perform that action at this time.
0 commit comments