ast: fixed hang for weird loop: 'for (each_window(list,p))'
This commit is contained in:
parent
fb4695fcb4
commit
85b73f7c24
|
@ -699,14 +699,14 @@ void TokenList::createAst()
|
||||||
init1 = tok2;
|
init1 = tok2;
|
||||||
std::stack<Token *> operands;
|
std::stack<Token *> operands;
|
||||||
compileExpression(tok2, operands);
|
compileExpression(tok2, operands);
|
||||||
if (tok2->str() == ";")
|
if (tok2->str() == ";" || tok2->str() == ")")
|
||||||
break;
|
break;
|
||||||
init1 = 0;
|
init1 = 0;
|
||||||
}
|
}
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
}
|
}
|
||||||
if (!tok2 || tok2->str() != ";") {
|
if (!tok2 || tok2->str() != ";") {
|
||||||
tok = tok->next();
|
tok = tok2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10103,6 +10103,7 @@ private:
|
||||||
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
ASSERT_EQUALS("for;;(", testAst("for(;;)"));
|
||||||
ASSERT_EQUALS("fora0=a8<a++;;(", testAst("for(a=0;a<8;a++)"));
|
ASSERT_EQUALS("fora0=a8<a++;;(", testAst("for(a=0;a<8;a++)"));
|
||||||
TODO_ASSERT_EQUALS("fori1=current0=,iNUM<=i++;;(", "fori1=current0=,i<NUM=i++;;(", testAst("for(i = (1), current = 0; i <= (NUM); ++i)"));
|
TODO_ASSERT_EQUALS("fori1=current0=,iNUM<=i++;;(", "fori1=current0=,i<NUM=i++;;(", testAst("for(i = (1), current = 0; i <= (NUM); ++i)"));
|
||||||
|
ASSERT_EQUALS("eachxy,(", testAst("for(each(x,y)){}")); // it's not well-defined what this ast should be
|
||||||
}
|
}
|
||||||
|
|
||||||
void astpar() const { // parentheses
|
void astpar() const { // parentheses
|
||||||
|
|
Loading…
Reference in New Issue