preprocessor: the state stack seems unused. remove it.

Change-Id: Id53c5ebc2867c1ea1e62bb9be6eebe9732774713
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
hjk
2012-04-19 10:25:13 +02:00
committed by hjk
parent 538901d441
commit a9a894558f
2 changed files with 4 additions and 21 deletions

View File

@@ -583,20 +583,6 @@ Preprocessor::Preprocessor(Client *client, Environment *env)
{
}
void Preprocessor::pushState(const State &newState)
{
m_savedStates.append(m_state);
m_state = newState;
}
void Preprocessor::popState()
{
const State &s = m_savedStates.last();
delete m_state.m_lexer;
m_state = s;
m_savedStates.removeLast();
}
QByteArray Preprocessor::operator()(const QString &fileName, const QString &source)
{
const QString previousOriginalSource = m_originalSource;
@@ -940,7 +926,8 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
if (source.isEmpty())
return;
pushState(createStateFromSource(fileName, source, result, noLines, markGeneratedTokens, inCondition));
const State savedState = m_state;
m_state = createStateFromSource(fileName, source, result, noLines, markGeneratedTokens, inCondition);
const QString previousFileName = m_env->currentFile;
m_env->currentFile = fileName;
@@ -1030,7 +1017,8 @@ _Lrestart:
prevTk = tk;
} while (tk.isNot(T_EOF_SYMBOL));
popState();
delete m_state.m_lexer;
m_state = savedState;
m_env->currentFile = previousFileName;
m_env->currentLine = previousCurrentLine;

View File

@@ -149,9 +149,6 @@ private:
static bool isQtReservedWord(const ByteArrayRef &name);
void pushState(const State &newState);
void popState();
State createStateFromSource(const QString &fileName, const QByteArray &source, QByteArray *result, bool noLines, bool markGeneratedTokens, bool inCondition) const;
inline bool atStartOfOutputLine() const
@@ -187,8 +184,6 @@ private:
Environment *m_env;
QByteArray m_scratchBuffer;
QList<State> m_savedStates;
QString m_originalSource;
bool m_expandMacros;
bool m_keepComments;