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

use get_type2 in struct.v

This commit is contained in:
Alexander Medvednikov
2019-12-05 19:02:33 +03:00
parent cca650c655
commit 79b26b1654
3 changed files with 16 additions and 4 deletions

View File

@ -194,9 +194,10 @@ fn (p mut Parser) struct_decl() {
// `pub` access mod
access_mod := if is_pub_field { AccessMod.public } else { AccessMod.private}
p.fspace()
field_type := p.get_type()
tt := p.get_type2()
field_type := tt.name
if field_type == name {
p.error_with_token_index( 'cannot embed struct `$name` in itself (field `$field_name`)', field_name_token_idx)
p.error_with_token_index('cannot embed struct `$name` in itself (field `$field_name`)', field_name_token_idx)
}
// Register ?option type
if field_type.starts_with('Option_') {