File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,8 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
267
267
// Comments after type (same line)
268
268
prev_attrs := p.attrs
269
269
p.attrs = []
270
- if p.tok.kind == .lsbr || p.tok.kind == .at {
270
+ // TODO: remove once old syntax is no longer supported
271
+ if p.tok.kind == .lsbr {
271
272
p.inside_struct_attr_decl = true
272
273
// attrs are stored in `p.attrs`
273
274
p.attributes ()
@@ -294,6 +295,17 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
294
295
has_default_expr = true
295
296
comments << p.eat_comments ()
296
297
}
298
+ if p.tok.kind == .at {
299
+ p.inside_struct_attr_decl = true
300
+ // attrs are stored in `p.attrs`
301
+ p.attributes ()
302
+ for fa in p.attrs {
303
+ if fa.name == 'deprecated' {
304
+ is_field_deprecated = true
305
+ }
306
+ }
307
+ p.inside_struct_attr_decl = false
308
+ }
297
309
ast_fields << ast.StructField{
298
310
name: field_name
299
311
typ: typ
You can’t perform that action at this time.
0 commit comments