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 {
267267 // Comments after type (same line)
268268 prev_attrs := p.attrs
269269 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 {
271272 p.inside_struct_attr_decl = true
272273 // attrs are stored in `p.attrs`
273274 p.attributes ()
@@ -294,6 +295,17 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
294295 has_default_expr = true
295296 comments << p.eat_comments ()
296297 }
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+ }
297309 ast_fields << ast.StructField{
298310 name: field_name
299311 typ: typ
You can’t perform that action at this time.
0 commit comments