File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
143143 }
144144 p.check (.lcbr)
145145 // if p.is_vls && p.tok.kind == .key_struct { // p.tok.is_key() {
146- if p.is_vls && p.tok.is_key () && p.tok.kind != .key_mut {
146+ if p.is_vls && p.tok.is_key () && ! (p.tok.kind in [.key_pub, .key_mut]
147+ && p.peek_tok.kind in [.colon, .key_mut]) {
147148 // End parsing after `struct Foo {` in vls mode to avoid lots of junk errors
148149 // If next token after { is a key, the struct wasn't finished
149150 p.error ('expected `}` to finish a struct definition' )
Original file line number Diff line number Diff line change 55 a int
66 b string
77}
8+
9+ struct MyPubS {
10+ pub:
11+ a int
12+ b string
13+ }
14+
15+ struct MyPubMutS {
16+ pub mut:
17+ a int
18+ b string
19+ }
20+
21+ struct Complex {
22+ mut:
23+ mm int
24+ pub:
25+ pp string
26+ pub mut:
27+ pma int
28+ pmb string
29+ }
You can’t perform that action at this time.
0 commit comments