From e43b6bd9c7a3d584e488cd3c84f9deb2d8955b64 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 8 Aug 2013 16:59:32 +0200 Subject: 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 --- src/qml/compiler/qv4codegen_p.h | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'src/qml/compiler/qv4codegen_p.h') 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 #include #include +#include #include 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 errors(); -private: +protected: QString _fileName; Result _expr; QString _property; @@ -437,13 +430,27 @@ private: ScopeAndFinally *_scopeAndFinally; QHash _envMap; QHash _functionMap; - QV4::ExecutionContext *_context; bool _strictMode; - ErrorHandler *_errorHandler; + + QList _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 -- cgit v1.2.3