diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-01 12:44:51 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-01 12:44:51 +0200 |
commit | b78372c4ba31da2d941d70ba23a927deae7d830c (patch) | |
tree | 25d9eeefbbb4c6ace084c56e58ac7bd1927217b5 /src/qml/compiler/qv4codegen.cpp | |
parent | 9990c0f577f6a6a67ccebffb56ad1afc7a98ed1d (diff) | |
parent | 7ea1f75fd877f312d70a90ab0405f3ca03914171 (diff) |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: I996a85744753598bb48c7e0d7954049202f4f037
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 1e067c8a1e..fdc4d5c9f2 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -41,7 +41,6 @@ #include "qv4codegen_p.h" #include "qv4util_p.h" -#include "qv4debugging_p.h" #include <QtCore/QCoreApplication> #include <QtCore/QStringList> @@ -51,8 +50,13 @@ #include <QtCore/QLinkedList> #include <QtCore/QStack> #include <private/qqmljsast_p.h> -#include <qv4runtime_p.h> +#include <private/qv4string_p.h> +#include <private/qv4value_inl_p.h> + +#ifndef V4_BOOTSTRAP #include <qv4context_p.h> +#endif + #include <cmath> #include <iostream> @@ -2810,11 +2814,9 @@ void Codegen::throwSyntaxError(const SourceLocation &loc, const QString &detail) return; hasError = true; - QQmlError error; - error.setUrl(_fileNameIsUrl ? QUrl(_module->fileName) : QUrl::fromLocalFile(_module->fileName)); - error.setDescription(detail); - error.setLine(loc.startLine); - error.setColumn(loc.startColumn); + QQmlJS::DiagnosticMessage error; + error.message = detail; + error.loc = loc; _errors << error; } @@ -2824,19 +2826,37 @@ void Codegen::throwReferenceError(const SourceLocation &loc, const QString &deta return; hasError = true; - QQmlError error; - error.setUrl(_fileNameIsUrl ? QUrl(_module->fileName) : QUrl::fromLocalFile(_module->fileName)); - error.setDescription(detail); - error.setLine(loc.startLine); - error.setColumn(loc.startColumn); + QQmlJS::DiagnosticMessage error; + error.message = detail; + error.loc = loc; _errors << error; } -QList<QQmlError> Codegen::errors() const +QList<QQmlJS::DiagnosticMessage> Codegen::errors() const { return _errors; } +#ifndef V4_BOOTSTRAP + +QList<QQmlError> Codegen::qmlErrors() const +{ + QList<QQmlError> qmlErrors; + qmlErrors.reserve(_errors.size()); + + QUrl url(_fileNameIsUrl ? QUrl(_module->fileName) : QUrl::fromLocalFile(_module->fileName)); + foreach (const QQmlJS::DiagnosticMessage &msg, _errors) { + QQmlError e; + e.setUrl(url); + e.setLine(msg.loc.startLine); + e.setColumn(msg.loc.startColumn); + e.setDescription(msg.message); + qmlErrors << e; + } + + return qmlErrors; +} + void RuntimeCodegen::throwSyntaxError(const AST::SourceLocation &loc, const QString &detail) { if (hasError) @@ -2852,3 +2872,5 @@ void RuntimeCodegen::throwReferenceError(const AST::SourceLocation &loc, const Q hasError = true; context->throwReferenceError(detail, _module->fileName, loc.startLine, loc.startColumn); } + +#endif // V4_BOOTSTRAP |