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

More cleanup

parent 2553e250
......@@ -139,7 +139,6 @@ QString TypeOfExpression::preprocessedExpression(const QString &expression,
&env, &processed);
const QByteArray code = expression.toUtf8();
Preprocessor preproc(0, env);
QByteArray preprocessedCode;
preproc("<expression>", code, &preprocessedCode);
const QByteArray preprocessedCode = preproc("<expression>", code);
return QString::fromUtf8(preprocessedCode.constData(), preprocessedCode.size());
}
......@@ -485,25 +485,25 @@ QByteArray Preprocessor::operator()(const QByteArray &filename,
const QByteArray &source)
{
QByteArray preprocessed;
operator()(filename, source, &preprocessed);
preprocess(filename, source, &preprocessed);
return preprocessed;
}
QByteArray Preprocessor::operator()(const QByteArray &source)
{
QByteArray preprocessed;
operator()(source, &preprocessed);
preprocess(source, &preprocessed);
return preprocessed;
}
void Preprocessor::operator () (const QByteArray &filename,
const QByteArray &source,
QByteArray *result)
void Preprocessor::preprocess(const QByteArray &filename,
const QByteArray &source,
QByteArray *result)
{
const QByteArray previousFile = env.currentFile;
env.currentFile = filename;
operator () (source, result);
preprocess(source, result);
env.currentFile = previousFile;
}
......@@ -523,7 +523,7 @@ Preprocessor::State Preprocessor::createStateFromSource(const QByteArray &source
return state;
}
void Preprocessor::operator()(const QByteArray &source, QByteArray *result)
void Preprocessor::preprocess(const QByteArray &source, QByteArray *result)
{
pushState(createStateFromSource(source));
......
......@@ -186,14 +186,14 @@ namespace CPlusPlus {
QByteArray operator()(const QByteArray &source);
void operator()(const QByteArray &filename,
private:
void preprocess(const QByteArray &filename,
const QByteArray &source,
QByteArray *result);
void operator()(const QByteArray &source,
void preprocess(const QByteArray &source,
QByteArray *result);
private:
void resetIfLevel();
bool testIfLevel();
int skipping() const;
......
......@@ -202,7 +202,7 @@ protected:
private:
QPointer<CppModelManager> m_modelManager;
Environment env;
Preprocessor m_proc;
Preprocessor preprocess;
QStringList m_includePaths;
QStringList m_systemIncludePaths;
QMap<QString, QByteArray> m_workingCopy;
......@@ -220,7 +220,7 @@ private:
CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
: snapshot(modelManager->snapshot()),
m_modelManager(modelManager),
m_proc(this, env)
preprocess(this, env)
{ }
void CppPreprocessor::setWorkingCopy(const QMap<QString, QByteArray> &workingCopy)
......@@ -506,8 +506,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
Document::Ptr previousDoc = switchDocument(doc);
QByteArray preprocessedCode;
m_proc(fileName.toUtf8(), contents, &preprocessedCode);
const QByteArray preprocessedCode = preprocess(fileName.toUtf8(), contents);
doc->setSource(preprocessedCode);
doc->tokenize();
......
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