CheckCondition: Fix FP for undeclared variables (daca)
This commit is contained in:
parent
e7f469c4ba
commit
c34fdd1905
|
@ -526,7 +526,7 @@ void CheckCondition::multiCondition2()
|
|||
}
|
||||
} else if (!nonlocal && cond->isName()) {
|
||||
// varid is 0. this is possibly a nonlocal variable..
|
||||
nonlocal = Token::Match(cond->astParent(), "%cop%|(|[") || (_tokenizer->isCPP() && cond->str() == "this");
|
||||
nonlocal = Token::Match(cond->astParent(), "%cop%|(|[") || Token::Match(cond, "%name% .") || (_tokenizer->isCPP() && cond->str() == "this");
|
||||
} else {
|
||||
tokens.push(cond->astOperand1());
|
||||
tokens.push(cond->astOperand2());
|
||||
|
|
|
@ -1627,6 +1627,15 @@ private:
|
|||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// daca hyphy
|
||||
check("bool f() {\n"
|
||||
" if (rec.lLength==0) {\n"
|
||||
" rec.Delete(i);\n"
|
||||
" if (rec.lLength!=0) {}\n"
|
||||
" }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void oppositeInnerConditionAlias() {
|
||||
|
|
Loading…
Reference in New Issue