Commit b316939d authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Introduced expandObjectLikeMacro().

parent 55d0e4f8
...@@ -748,18 +748,8 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour ...@@ -748,18 +748,8 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
else { else {
if (! m->isFunctionLike()) { if (! m->isFunctionLike()) {
QByteArray tmp;
if (client) expandObjectLikeMacro(identifierToken, spell, m, &tmp);
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);
if (_dot->isNot(T_LPAREN)) { if (_dot->isNot(T_LPAREN)) {
_result->append(tmp); _result->append(tmp);
...@@ -827,6 +817,23 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour ...@@ -827,6 +817,23 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
_result = previousResult; _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) void Preprocessor::expandFunctionLikeMacro(TokenIterator identifierToken, Macro *m)
{ {
const char *beginOfText = startOfToken(*identifierToken); const char *beginOfText = startOfToken(*identifierToken);
......
...@@ -104,6 +104,9 @@ private: ...@@ -104,6 +104,9 @@ private:
QByteArray expand(const QByteArray &source); QByteArray expand(const QByteArray &source);
void expand(const QByteArray &source, QByteArray *result); void expand(const QByteArray &source, QByteArray *result);
void expand(const char *first, const char *last, 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 expandFunctionLikeMacro(TokenIterator identifierToken, Macro *m);
void resetIfLevel(); void resetIfLevel();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment