diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-03-12 16:55:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-23 21:16:46 +0200 |
commit | a885d10a0289da85b8c966d2fa40fb10edae4fd7 (patch) | |
tree | 7c16b5abd88d436f6596d6a424126c1b1dd2aba8 /src/qml/compiler/qv4codegen.cpp | |
parent | 937fdde5d3b26291d417f856ee05ba479a6ba730 (diff) |
Extend the QML bootstrap library by the IR builders
This is among other things needed to fix the qml import scanner to detect
dependencies from .js files correctly.
The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT
where appropriate and corrects the wrong include path for the double conversion
code to actually be relative to the file it is included from. This worked by
accident because of other include paths present in the build.
Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
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 0d4eb390d3..166fb518ff 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 |