From e73e8d843b57933e041ffff784d46d8db80a84c6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 26 Feb 2016 07:59:46 +0800 Subject: Parse/expr - Allow flow control in struct literals --- src/parse/expr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/parse/expr.cpp b/src/parse/expr.cpp index 20a7193e..8bcde31e 100644 --- a/src/parse/expr.cpp +++ b/src/parse/expr.cpp @@ -865,8 +865,9 @@ ExprNodeP Parse_ExprVal_StructLiteral(TokenStream& lex, AST::Path path) { ::std::string name = tok.str(); GET_CHECK_TOK(tok, lex, TOK_COLON); - ExprNodeP val = Parse_Expr0(lex); + ExprNodeP val = Parse_Stmt(lex); items.push_back( ::std::make_pair(::std::move(name), ::std::move(val)) ); + if( GET_TOK(tok,lex) == TOK_BRACE_CLOSE ) break; CHECK_TOK(tok, TOK_COMMA); -- cgit v1.2.3