GenEx: Add some more asserts to verify code-sanity.
This commit is contained in:
parent
6dd2b36559
commit
fd59b10e71
@ -106,6 +106,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
|
|||||||
startToken->Content, this->it->Content
|
startToken->Content, this->it->Content
|
||||||
- startToken->Content
|
- startToken->Content
|
||||||
+ this->it->Length);
|
+ this->it->Length);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
--this->NestingLevel;
|
--this->NestingLevel;
|
||||||
content->SetIdentifier(identifier);
|
content->SetIdentifier(identifier);
|
||||||
@ -122,6 +123,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
|
|||||||
{
|
{
|
||||||
colonToken = this->it;
|
colonToken = this->it;
|
||||||
parameters.resize(parameters.size() + 1);
|
parameters.resize(parameters.size() + 1);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
|
|
||||||
while (this->it != this->Tokens.end() &&
|
while (this->it != this->Tokens.end() &&
|
||||||
@ -129,12 +131,14 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
|
|||||||
{
|
{
|
||||||
commaTokens.push_back(this->it);
|
commaTokens.push_back(this->it);
|
||||||
parameters.resize(parameters.size() + 1);
|
parameters.resize(parameters.size() + 1);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
}
|
}
|
||||||
while (this->it != this->Tokens.end() &&
|
while (this->it != this->Tokens.end() &&
|
||||||
this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
|
this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
|
||||||
{
|
{
|
||||||
extendText(*(parameters.end() - 1), this->it);
|
extendText(*(parameters.end() - 1), this->it);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
}
|
}
|
||||||
while (this->it != this->Tokens.end() &&
|
while (this->it != this->Tokens.end() &&
|
||||||
@ -150,12 +154,14 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
|
|||||||
{
|
{
|
||||||
commaTokens.push_back(this->it);
|
commaTokens.push_back(this->it);
|
||||||
parameters.resize(parameters.size() + 1);
|
parameters.resize(parameters.size() + 1);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
}
|
}
|
||||||
while (this->it != this->Tokens.end() &&
|
while (this->it != this->Tokens.end() &&
|
||||||
this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
|
this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator)
|
||||||
{
|
{
|
||||||
extendText(*(parameters.end() - 1), this->it);
|
extendText(*(parameters.end() - 1), this->it);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,6 +169,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
|
|||||||
&& this->it->TokenType == cmGeneratorExpressionToken::EndExpression)
|
&& this->it->TokenType == cmGeneratorExpressionToken::EndExpression)
|
||||||
{
|
{
|
||||||
--this->NestingLevel;
|
--this->NestingLevel;
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,6 +192,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
|
|||||||
parameters.end();
|
parameters.end();
|
||||||
std::vector<TokenVector::const_iterator>::const_iterator commaIt =
|
std::vector<TokenVector::const_iterator>::const_iterator commaIt =
|
||||||
commaTokens.begin();
|
commaTokens.begin();
|
||||||
|
assert(parameters.size() > commaTokens.size());
|
||||||
for ( ; pit != pend; ++pit, ++commaIt)
|
for ( ; pit != pend; ++pit, ++commaIt)
|
||||||
{
|
{
|
||||||
extendResult(result, *pit);
|
extendResult(result, *pit);
|
||||||
@ -232,6 +240,7 @@ void cmGeneratorExpressionParser::ParseContent(
|
|||||||
TextContent *textContent =
|
TextContent *textContent =
|
||||||
static_cast<TextContent*>(*(result.end() - 1));
|
static_cast<TextContent*>(*(result.end() - 1));
|
||||||
textContent->Extend(this->it->Length);
|
textContent->Extend(this->it->Length);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,10 +248,12 @@ void cmGeneratorExpressionParser::ParseContent(
|
|||||||
cmGeneratorExpressionEvaluator* n = new TextContent(this->it->Content,
|
cmGeneratorExpressionEvaluator* n = new TextContent(this->it->Content,
|
||||||
this->it->Length);
|
this->it->Length);
|
||||||
result.push_back(n);
|
result.push_back(n);
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
case cmGeneratorExpressionToken::BeginExpression:
|
case cmGeneratorExpressionToken::BeginExpression:
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
this->ParseGeneratorExpression(result);
|
this->ParseGeneratorExpression(result);
|
||||||
return;
|
return;
|
||||||
@ -257,6 +268,7 @@ void cmGeneratorExpressionParser::ParseContent(
|
|||||||
{
|
{
|
||||||
assert(!"Got unexpected syntax token.");
|
assert(!"Got unexpected syntax token.");
|
||||||
}
|
}
|
||||||
|
assert(this->it != this->Tokens.end());
|
||||||
++this->it;
|
++this->it;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user