Introduced expandObjectLikeMacro().

This commit is contained in:
Roberto Raggi
2009-03-03 16:46:21 +01:00
parent 55d0e4f860
commit b316939dff
2 changed files with 22 additions and 12 deletions

View File

@@ -748,18 +748,8 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
else {
if (! m->isFunctionLike()) {
if (client)
client->startExpandingMacro(identifierToken->offset,
*m, spell);
m->setHidden(true);
const QByteArray tmp = expand(m->definition());
m->setHidden(false);
if (client)
client->stopExpandingMacro(_dot->offset, *m);
QByteArray tmp;
expandObjectLikeMacro(identifierToken, spell, m, &tmp);
if (_dot->isNot(T_LPAREN)) {
_result->append(tmp);
@@ -827,6 +817,23 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
_result = previousResult;
}
void Preprocessor::expandObjectLikeMacro(TokenIterator identifierToken,
const QByteArray &spell,
Macro *m,
QByteArray *result)
{
if (client)
client->startExpandingMacro(identifierToken->offset,
*m, spell);
m->setHidden(true);
expand(m->definition(), result);
m->setHidden(false);
if (client)
client->stopExpandingMacro(_dot->offset, *m);
}
void Preprocessor::expandFunctionLikeMacro(TokenIterator identifierToken, Macro *m)
{
const char *beginOfText = startOfToken(*identifierToken);

View File

@@ -104,6 +104,9 @@ private:
QByteArray expand(const QByteArray &source);
void expand(const QByteArray &source, QByteArray *result);
void expand(const char *first, const char *last, QByteArray *result);
void expandObjectLikeMacro(TokenIterator identifierToken,
const QByteArray &spell,
Macro *m, QByteArray *result);
void expandFunctionLikeMacro(TokenIterator identifierToken, Macro *m);
void resetIfLevel();