Fixed #8017 (AST: wrong ast for extra comma 's={1,}')
This commit is contained in:
parent
7140bae226
commit
1039c710e4
|
@ -994,7 +994,10 @@ static void compileComma(Token *&tok, AST_state& state)
|
|||
compileAssignTernary(tok, state);
|
||||
while (tok) {
|
||||
if (tok->str() == ",") {
|
||||
compileBinOp(tok, state, compileAssignTernary);
|
||||
if (Token::simpleMatch(tok, ", }"))
|
||||
tok = tok->next();
|
||||
else
|
||||
compileBinOp(tok, state, compileAssignTernary);
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8077,6 +8077,7 @@ private:
|
|||
ASSERT_EQUALS("tset{=", testAst("struct cgroup_taskset tset = {};"));
|
||||
ASSERT_EQUALS("s1a&,{2b&,{,{=", testAst("s = { {1, &a}, {2, &b} };"));
|
||||
ASSERT_EQUALS("s0[L.2[x={=", testAst("s = { [0].L[2] = x};"));
|
||||
ASSERT_EQUALS("ac.0={(=", testAst("a = (b){.c=0,};")); // <- useless comma
|
||||
|
||||
// struct initialization hang
|
||||
ASSERT_EQUALS("sbar.1{,{(={= fcmd( forfieldfield++;;(",
|
||||
|
|
Loading…
Reference in New Issue