aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp48
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