@@ -94,14 +94,19 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
94
94
mut is_field_pub := false
95
95
mut is_field_global := false
96
96
mut is_implements := false
97
- mut implements_type := ast.void_type
97
+ mut implements_types := []ast.Type{cap: 3 } // ast.void_type
98
98
mut last_line := p.prev_tok.pos ().line_nr + 1
99
99
mut end_comments := []ast.Comment{}
100
100
if ! no_body {
101
101
if p.tok.kind == .key_implements {
102
- p.next ()
103
- implements_type = p.parse_type ()
104
102
is_implements = true
103
+ for {
104
+ p.next ()
105
+ implements_types << p.parse_type ()
106
+ if p.tok.kind != .comma {
107
+ break
108
+ }
109
+ }
105
110
}
106
111
p.check (.lcbr)
107
112
pre_comments << p.eat_comments ()
@@ -378,24 +383,24 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
378
383
}
379
384
p.expr_mod = ''
380
385
return ast.StructDecl{
381
- name: name
382
- is_pub: is_pub
383
- fields: ast_fields
384
- pos: start_pos.extend_with_last_line (name_pos, last_line)
385
- mut_pos: mut_pos
386
- pub_pos: pub_pos
387
- pub_mut_pos: pub_mut_pos
388
- global_pos: global_pos
389
- module_pos: module_pos
390
- language: language
391
- is_union: is_union
392
- attrs: if is_anon { []ast.Attr{} } else { attrs } // anon structs can't have attributes
393
- pre_comments: pre_comments
394
- end_comments: end_comments
395
- generic_types: generic_types
396
- embeds: embeds
397
- is_implements: is_implements
398
- implements_type: implements_type
386
+ name: name
387
+ is_pub: is_pub
388
+ fields: ast_fields
389
+ pos: start_pos.extend_with_last_line (name_pos, last_line)
390
+ mut_pos: mut_pos
391
+ pub_pos: pub_pos
392
+ pub_mut_pos: pub_mut_pos
393
+ global_pos: global_pos
394
+ module_pos: module_pos
395
+ language: language
396
+ is_union: is_union
397
+ attrs: if is_anon { []ast.Attr{} } else { attrs } // anon structs can't have attributes
398
+ pre_comments: pre_comments
399
+ end_comments: end_comments
400
+ generic_types: generic_types
401
+ embeds: embeds
402
+ is_implements: is_implements
403
+ implements_types: implements_types
399
404
}
400
405
}
401
406
0 commit comments