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

ci: fix failing invalid_struct_decl_script_err.vv

This commit is contained in:
Delyan Angelov 2022-07-10 18:37:42 +03:00
parent 5d8d11c989
commit 01dabe5966
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -325,11 +325,6 @@ pub fn (mut p Parser) check_expr(precedence int) ?ast.Expr {
node = p.map_init()
p.check(.rcbr)
}
.key_struct {
// Anonymous struct
p.next()
return p.struct_init('', .anon)
}
.key_fn {
if p.expecting_type {
// Anonymous function type
@ -362,6 +357,11 @@ pub fn (mut p Parser) check_expr(precedence int) ?ast.Expr {
}
}
else {
if p.tok.kind == .key_struct && p.peek_tok.kind == .lcbr {
// Anonymous struct
p.next()
return p.struct_init('', .anon)
}
if p.tok.kind != .eof && !(p.tok.kind == .rsbr && p.inside_asm) {
// eof should be handled where it happens
return none