mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v: support $for attr in Test.attributes (#9836)
This commit is contained in:
@@ -253,8 +253,15 @@ fn (mut p Parser) comp_for() ast.CompFor {
|
||||
pos: var_pos
|
||||
})
|
||||
kind = .fields
|
||||
} else if for_val == 'attributes' {
|
||||
p.scope.register(ast.Var{
|
||||
name: val_var
|
||||
typ: p.table.find_type_idx('StructAttribute')
|
||||
pos: var_pos
|
||||
})
|
||||
kind = .attributes
|
||||
} else {
|
||||
p.error_with_pos('unknown kind `$for_val`, available are: `methods` or `fields`',
|
||||
p.error_with_pos('unknown kind `$for_val`, available are: `methods`, `fields` or `attributes`',
|
||||
p.prev_tok.position())
|
||||
return ast.CompFor{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user