From 01dabe596654824de8ef3a0c98954d598b873d42 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 10 Jul 2022 18:37:42 +0300 Subject: [PATCH] ci: fix failing invalid_struct_decl_script_err.vv --- vlib/v/parser/expr.v | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vlib/v/parser/expr.v b/vlib/v/parser/expr.v index 7afe792a53..5541be252e 100644 --- a/vlib/v/parser/expr.v +++ b/vlib/v/parser/expr.v @@ -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