aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-08-08 16:59:32 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-20 14:20:44 +0200
commite43b6bd9c7a3d584e488cd3c84f9deb2d8955b64 (patch)
tree0d1a33571d2f75630db3dfe84b1a4ead23f87958 /src/qml/compiler/qv4codegen_p.h
parent42b2685d0069e746dee344054831b6f08e482860 (diff)
Remove QV4::DiagnosticMessage
QQmlError provides the same functionality, so let's rather use that where required. Remove the dependency of codegen onto the ExecutionContext that was only required for error handling. Change-Id: Ib0b61c0e138f89ff989c32996c93c339e4b62223 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r--src/qml/compiler/qv4codegen_p.h37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 75ca915a13..c55a45b107 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -46,12 +46,12 @@
#include <private/qqmljsastvisitor_p.h>
#include <private/qqmljsast_p.h>
#include <QtCore/QStringList>
+#include <qqmlerror.h>
#include <assert.h>
QT_BEGIN_NAMESPACE
namespace QV4 {
-struct DiagnosticMessage;
struct ExecutionContext;
}
@@ -61,18 +61,10 @@ class UiParameterList;
}
-
-class ErrorHandler
-{
-public:
- virtual void syntaxError(QV4::DiagnosticMessage *message) = 0;
-};
-
class Q_QML_EXPORT Codegen: protected AST::Visitor
{
public:
- Codegen(QV4::ExecutionContext *ctx, bool strict);
- Codegen(ErrorHandler *errorHandler, bool strictMode);
+ Codegen(bool strict);
enum Mode {
GlobalCode,
@@ -415,11 +407,12 @@ protected:
virtual bool visit(AST::UiSourceElement *ast);
void throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr* expr, const AST::SourceLocation &loc);
+ virtual void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
+ virtual void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
- void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
- void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
+ QList<QQmlError> errors();
-private:
+protected:
QString _fileName;
Result _expr;
QString _property;
@@ -437,13 +430,27 @@ private:
ScopeAndFinally *_scopeAndFinally;
QHash<AST::Node *, Environment *> _envMap;
QHash<AST::FunctionExpression *, int> _functionMap;
- QV4::ExecutionContext *_context;
bool _strictMode;
- ErrorHandler *_errorHandler;
+
+ QList<QQmlError> _errors;
class ScanFunctions;
};
+class RuntimeCodegen : public Codegen
+{
+public:
+ RuntimeCodegen(QV4::ExecutionContext *ctx, bool strict)
+ : Codegen(strict)
+ , context(ctx)
+ {}
+
+ virtual void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
+ virtual void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
+private:
+ QV4::ExecutionContext *context;
+};
+
}
QT_END_NAMESPACE