1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

Add support for raw json fields in structs

This commit is contained in:
teggot
2019-08-14 17:38:28 +03:00
committed by Alexander Medvednikov
parent 100bb7c54c
commit 79c727f014
2 changed files with 25 additions and 11 deletions

View File

@@ -645,6 +645,9 @@ fn (p mut Parser) struct_decl() {
attr = p.check_name()
p.check(.rsbr)
}
if attr == 'raw' && field_type != 'string' {
p.error('struct field with attribute "raw" should be of type "string" but got "$field_type"')
}
did_gen_something = true
typ.add_field(field_name, field_type, is_mut, attr, access_mod)