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

Added Engine::blockDiagnosticMessages()

parent bc982796
......@@ -320,20 +320,12 @@ private:
void warning(int line, const QString &message)
{
DiagnosticMessage m;
m.setKind(DiagnosticMessage::Warning);
m.setLine(line);
m.setMessage(message);
_engine->addDiagnosticMessage(m);
_engine->warning(line, message);
}
void error(int line, const QString &message)
{
DiagnosticMessage m;
m.setKind(DiagnosticMessage::Error);
m.setLine(line);
m.setMessage(message);
_engine->addDiagnosticMessage(m);
_engine->error(line, message);
}
template <typename T>
......
......@@ -80,6 +80,7 @@ void DiagnosticMessage::setMessage(const QString &message)
}
Engine::Engine()
: _blockDiagnosticMessages(false)
{
}
......@@ -176,7 +177,8 @@ void Engine::clearDiagnosticMessages()
void Engine::addDiagnosticMessage(const DiagnosticMessage &m)
{
_diagnosticMessages.append(m);
if (! _blockDiagnosticMessages)
_diagnosticMessages.append(m);
}
void Engine::warning(int line, const QString &message)
......@@ -258,3 +260,10 @@ Variable *Engine::newVariable(Scope *scope, const QString &name, const Type *typ
return var;
}
bool Engine::blockDiagnosticMessages(bool block)
{
bool previous = _blockDiagnosticMessages;
_blockDiagnosticMessages = block;
return previous;
}
......@@ -120,6 +120,7 @@ public:
MemoryPool *pool();
bool blockDiagnosticMessages(bool block);
QList<DiagnosticMessage> diagnosticMessages() const;
void clearDiagnosticMessages();
void addDiagnosticMessage(const DiagnosticMessage &m);
......@@ -134,6 +135,7 @@ private:
MemoryPool _pool;
QList<DiagnosticMessage> _diagnosticMessages;
QList<Symbol *> _symbols;
bool _blockDiagnosticMessages;
};
} // namespace GLSL
......
......@@ -404,18 +404,10 @@ int Lexer::findKeyword(const char *word, int length) const
void Lexer::warning(int line, const QString &message)
{
DiagnosticMessage m;
m.setKind(DiagnosticMessage::Warning);
m.setLine(line);
m.setMessage(message);
_engine->addDiagnosticMessage(m);
_engine->warning(line, message);
}
void Lexer::error(int line, const QString &message)
{
DiagnosticMessage m;
m.setKind(DiagnosticMessage::Error);
m.setLine(line);
m.setMessage(message);
_engine->addDiagnosticMessage(m);
_engine->error(line, message);
}
This diff is collapsed.
......@@ -109,20 +109,12 @@ private:
void warning(int line, const QString &message)
{
DiagnosticMessage m;
m.setKind(DiagnosticMessage::Warning);
m.setLine(line);
m.setMessage(message);
_engine->addDiagnosticMessage(m);
_engine->warning(line, message);
}
void error(int line, const QString &message)
{
DiagnosticMessage m;
m.setKind(DiagnosticMessage::Error);
m.setLine(line);
m.setMessage(message);
_engine->addDiagnosticMessage(m);
_engine->error(line, message);
}
template <typename T>
......
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