aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-12 16:55:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-23 21:16:46 +0200
commita885d10a0289da85b8c966d2fa40fb10edae4fd7 (patch)
tree7c16b5abd88d436f6596d6a424126c1b1dd2aba8 /src
parent937fdde5d3b26291d417f856ee05ba479a6ba730 (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')
-rw-r--r--src/3rdparty/double-conversion/double-conversion.pri24
-rw-r--r--src/qml/compiler/compiler.pri22
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp93
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h28
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp2
-rw-r--r--src/qml/compiler/qv4codegen.cpp48
-rw-r--r--src/qml/compiler/qv4codegen_p.h14
-rw-r--r--src/qml/compiler/qv4compileddata.cpp12
-rw-r--r--src/qml/compiler/qv4compileddata_p.h25
-rw-r--r--src/qml/compiler/qv4compiler.cpp5
-rw-r--r--src/qml/compiler/qv4compiler_p.h4
-rw-r--r--src/qml/compiler/qv4isel_p.cpp17
-rw-r--r--src/qml/compiler/qv4isel_p.h6
-rw-r--r--src/qml/compiler/qv4jsir.cpp6
-rw-r--r--src/qml/compiler/qv4jsir_p.h2
-rw-r--r--src/qml/compiler/qv4ssa.cpp7
-rw-r--r--src/qml/compiler/qv4ssa_p.h2
-rw-r--r--src/qml/jsruntime/jsruntime.pri22
-rw-r--r--src/qml/jsruntime/qv4global_p.h5
-rw-r--r--src/qml/jsruntime/qv4managed_p.h2
-rw-r--r--src/qml/jsruntime/qv4object_p.h2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp94
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h16
-rw-r--r--src/qml/jsruntime/qv4script.cpp4
-rw-r--r--src/qml/jsruntime/qv4string.cpp16
-rw-r--r--src/qml/jsruntime/qv4string_p.h11
-rw-r--r--src/qml/jsruntime/qv4value.cpp10
-rw-r--r--src/qml/jsruntime/qv4value_inl_p.h7
-rw-r--r--src/qml/jsruntime/qv4value_p.h4
-rw-r--r--src/qml/qml/qml.pri12
-rw-r--r--src/qml/qml/qqmldirparser.cpp38
-rw-r--r--src/qml/qml/qqmldirparser_p.h17
-rw-r--r--src/qml/qml/qqmlimport.cpp5
-rw-r--r--src/qml/qml/qqmlimport_p.h1
-rw-r--r--src/qml/qml/qqmltypeloader.cpp25
-rw-r--r--src/qml/qtqmlglobal_p.h6
-rw-r--r--src/qmldevtools/qmldevtools.pro6
37 files changed, 444 insertions, 176 deletions
diff --git a/src/3rdparty/double-conversion/double-conversion.pri b/src/3rdparty/double-conversion/double-conversion.pri
index 4ad5f9f7a7..1597aca33e 100644
--- a/src/3rdparty/double-conversion/double-conversion.pri
+++ b/src/3rdparty/double-conversion/double-conversion.pri
@@ -1,4 +1,24 @@
INCLUDEPATH += $$PWD
VPATH += $$PWD
-SOURCES += $$PWD/*.cc
-HEADERS += $$PWD/*.h
+SOURCES += \
+ $$PWD/bignum.cc \
+ $$PWD/bignum-dtoa.cc \
+ $$PWD/cached-powers.cc \
+ $$PWD/diy-fp.cc \
+ $$PWD/double-conversion.cc \
+ $$PWD/fast-dtoa.cc \
+ $$PWD/fixed-dtoa.cc \
+ $$PWD/strtod.cc
+
+HEADERS += \
+ $$PWD/bignum-dtoa.h \
+ $$PWD/bignum.h \
+ $$PWD/cached-powers.h \
+ $$PWD/diy-fp.h \
+ $$PWD/double-conversion.h \
+ $$PWD/fast-dtoa.h \
+ $$PWD/fixed-dtoa.h \
+ $$PWD/ieee.h \
+ $$PWD/strtod.h \
+ $$PWD/utils.h
+
diff --git a/src/qml/compiler/compiler.pri b/src/qml/compiler/compiler.pri
index 6e3159ba4e..585fef7603 100644
--- a/src/qml/compiler/compiler.pri
+++ b/src/qml/compiler/compiler.pri
@@ -7,8 +7,6 @@ HEADERS += \
$$PWD/qv4codegen_p.h \
$$PWD/qv4isel_p.h \
$$PWD/qv4jsir_p.h \
- $$PWD/qv4instr_moth_p.h \
- $$PWD/qv4isel_moth_p.h \
$$PWD/qv4isel_util_p.h \
$$PWD/qv4ssa_p.h \
$$PWD/qqmlirbuilder_p.h \
@@ -18,10 +16,22 @@ SOURCES += \
$$PWD/qv4compileddata.cpp \
$$PWD/qv4compiler.cpp \
$$PWD/qv4codegen.cpp \
- $$PWD/qv4instr_moth.cpp \
- $$PWD/qv4isel_moth.cpp \
$$PWD/qv4isel_p.cpp \
$$PWD/qv4jsir.cpp \
$$PWD/qv4ssa.cpp \
- $$PWD/qqmlirbuilder.cpp \
- $$PWD/qqmltypecompiler.cpp
+ $$PWD/qqmlirbuilder.cpp
+
+!qmldevtools_build {
+
+HEADERS += \
+ $$PWD/qqmltypecompiler_p.h \
+ $$PWD/qv4isel_moth_p.h \
+ $$PWD/qv4instr_moth_p.h
+
+
+SOURCES += \
+ $$PWD/qqmltypecompiler.cpp \
+ $$PWD/qv4instr_moth.cpp \
+ $$PWD/qv4isel_moth.cpp
+
+}
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 0dac79f6e7..28a4e23a37 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -41,13 +41,19 @@
#include "qqmlirbuilder_p.h"
+#include <private/qv4value_inl_p.h>
#include <private/qv4compileddata_p.h>
#include <private/qqmljsparser_p.h>
#include <private/qqmljslexer_p.h>
-#include <private/qqmlcompiler_p.h>
-#include <private/qqmlglobal_p.h>
#include <QCoreApplication>
+#ifndef V4_BOOTSTRAP
+#include <private/qqmlglobal_p.h>
+#include <private/qqmltypeloader_p.h>
+#include <private/qqmlengine_p.h>
+#include <private/qqmlcompiler_p.h>
+#endif
+
#ifdef CONST
#undef CONST
#endif
@@ -56,7 +62,9 @@ QT_USE_NAMESPACE
static const quint32 emptyStringIndex = 0;
+#ifndef V4_BOOTSTRAP
DEFINE_BOOL_CONFIG_OPTION(lookupHints, QML_LOOKUP_HINTS);
+#endif // V4_BOOTSTRAP
using namespace QmlIR;
@@ -296,7 +304,7 @@ void Document::collectTypeReferences()
}
}
-void Document::extractScriptMetaData(QString &script, QQmlError *error)
+void Document::extractScriptMetaData(QString &script, QQmlJS::DiagnosticMessage *error)
{
Q_ASSERT(error);
@@ -318,8 +326,7 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
int startLine = l.tokenStartLine();
int startColumn = l.tokenStartColumn();
- QQmlError importError;
- importError.setLine(startLine + 1); // 0-based, adjust to be 1-based
+ error->loc.startLine = startLine + 1; // 0-based, adjust to be 1-based
token = l.lex();
@@ -340,9 +347,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
QString file = l.tokenText();
if (!file.endsWith(js)) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","Imported file must be a script"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","Imported file must be a script");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -361,9 +367,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
if (invalidImport) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","File import requires a qualifier"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","File import requires a qualifier");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -374,9 +379,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
token = l.lex();
if (!importId.at(0).isUpper() || (l.tokenStartLine() == startLine)) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","Invalid import qualifier"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","Invalid import qualifier");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -394,9 +398,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
while (true) {
if (!isUriToken(token)) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","Invalid module URI"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","Invalid module URI");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -414,9 +417,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
}
if (token != QQmlJSGrammar::T_NUMERIC_LITERAL) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","Module import requires a version"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","Module import requires a version");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -439,9 +441,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
if (invalidImport) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","Module import requires a qualifier"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","Module import requires a qualifier");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -452,9 +453,8 @@ void Document::extractScriptMetaData(QString &script, QQmlError *error)
token = l.lex();
if (!importId.at(0).isUpper() || (l.tokenStartLine() == startLine)) {
- importError.setDescription(QCoreApplication::translate("QQmlParser","Invalid import qualifier"));
- importError.setColumn(l.tokenStartColumn());
- *error = importError;
+ error->message = QCoreApplication::translate("QQmlParser","Invalid import qualifier");
+ error->loc.startColumn = l.tokenStartColumn();
return;
}
@@ -558,7 +558,7 @@ IRBuilder::IRBuilder(const QSet<QString> &illegalNames)
{
}
-bool IRBuilder::generateFromQml(const QString &code, const QUrl &url, const QString &urlString, Document *output)
+bool IRBuilder::generateFromQml(const QString &code, const QString &url, const QString &urlString, Document *output)
{
this->url = url;
QQmlJS::AST::UiProgram *program = 0;
@@ -602,7 +602,6 @@ bool IRBuilder::generateFromQml(const QString &code, const QUrl &url, const QStr
accept(program->headers);
if (program->members->next) {
- QQmlError error;
QQmlJS::AST::SourceLocation loc = program->members->next->firstSourceLocation();
recordError(loc, QCoreApplication::translate("QQmlParser", "Unexpected object definition"));
return false;
@@ -971,8 +970,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node)
const TypeNameToType *type = 0;
for (int typeIndex = 0; typeIndex < propTypeNameToTypesCount; ++typeIndex) {
const TypeNameToType *t = propTypeNameToTypes + typeIndex;
- if (t->nameLength == size_t(memberType.length()) &&
- QHashedString::compare(memberType.constData(), t->name, static_cast<int>(t->nameLength))) {
+ if (memberType == QLatin1String(t->name, static_cast<int>(t->nameLength))) {
type = t;
break;
}
@@ -1023,16 +1021,14 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node)
bool typeFound = false;
QV4::CompiledData::Property::Type type;
- if ((unsigned)memberType.length() == strlen("alias") &&
- QHashedString::compare(memberType.constData(), "alias", static_cast<int>(strlen("alias")))) {
+ if (memberType == QLatin1String("alias")) {
type = QV4::CompiledData::Property::Alias;
typeFound = true;
}
for (int ii = 0; !typeFound && ii < propTypeNameToTypesCount; ++ii) {
const TypeNameToType *t = propTypeNameToTypes + ii;
- if (t->nameLength == size_t(memberType.length()) &&
- QHashedString::compare(memberType.constData(), t->name, static_cast<int>(t->nameLength))) {
+ if (memberType == QLatin1String(t->name, static_cast<int>(t->nameLength))) {
type = t->type;
typeFound = true;
}
@@ -1043,8 +1039,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node)
if (typeModifier.isEmpty()) {
type = QV4::CompiledData::Property::Custom;
- } else if ((unsigned)typeModifier.length() == strlen("list") &&
- QHashedString::compare(typeModifier.constData(), "list", static_cast<int>(strlen("list")))) {
+ } else if (typeModifier == QLatin1String("list")) {
type = QV4::CompiledData::Property::CustomList;
} else {
recordError(node->typeModifierToken, QCoreApplication::translate("QQmlParser","Invalid property type modifier"));
@@ -1483,11 +1478,9 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O
void IRBuilder::recordError(const QQmlJS::AST::SourceLocation &location, const QString &description)
{
- QQmlError error;
- error.setUrl(url);
- error.setLine(location.startLine);
- error.setColumn(location.startColumn);
- error.setDescription(description);
+ QQmlJS::DiagnosticMessage error;
+ error.loc = location;
+ error.message = description;
errors << error;
}
@@ -1766,6 +1759,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil
return runtimeFunctionIndices;
}
+#ifndef V4_BOOTSTRAP
QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup)
{
if (propertyExistsButForceNameLookup)
@@ -1967,6 +1961,8 @@ static void initMetaObjectResolver(QV4::IR::MemberExpressionResolver *resolver,
resolver->isQObjectResolver = true;
}
+#endif // V4_BOOTSTRAP
+
void JSCodeGen::beginFunctionBodyHook()
{
_contextObjectTemp = _block->newTemp();
@@ -1974,6 +1970,7 @@ void JSCodeGen::beginFunctionBodyHook()
_importedScriptsTemp = _block->newTemp();
_idArrayTemp = _block->newTemp();
+#ifndef V4_BOOTSTRAP
QV4::IR::Temp *temp = _block->TEMP(_contextObjectTemp);
initMetaObjectResolver(&temp->memberResolver, _contextObject);
move(temp, _block->NAME(QV4::IR::Name::builtin_qml_context_object, 0, 0));
@@ -1984,15 +1981,16 @@ void JSCodeGen::beginFunctionBodyHook()
move(_block->TEMP(_importedScriptsTemp), _block->NAME(QV4::IR::Name::builtin_qml_imported_scripts_object, 0, 0));
move(_block->TEMP(_idArrayTemp), _block->NAME(QV4::IR::Name::builtin_qml_id_array, 0, 0));
+#endif
}
QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
{
- if (_disableAcceleratedLookups)
- return 0;
-
Q_UNUSED(line)
Q_UNUSED(col)
+#ifndef V4_BOOTSTRAP
+ if (_disableAcceleratedLookups)
+ return 0;
// Implement QML lookup semantics in the current file context.
//
// Note: We do not check if properties of the qml scope object or context object
@@ -2073,10 +2071,15 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
}
}
+#else
+ Q_UNUSED(name)
+#endif // V4_BOOTSTRAP
// fall back to name lookup at run-time.
return 0;
}
+#ifndef V4_BOOTSTRAP
+
QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRevision, QObject *object, QQmlContextData *context)
{
if (notInRevision) *notInRevision = false;
@@ -2123,3 +2126,5 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis
return 0;
}
+
+#endif // V4_BOOTSTRAP
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index 4ea7e05639..3ea6baff2e 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -49,12 +49,16 @@
#include <private/qqmljsmemorypool_p.h>
#include <private/qv4codegen_p.h>
#include <private/qv4compiler_p.h>
-#include <private/qqmlpropertycache_p.h>
#include <QTextStream>
#include <QCoreApplication>
+#ifndef V4_BOOTSTRAP
+#include <private/qqmlpropertycache_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
+class QQmlPropertyCache;
class QQmlContextData;
class QQmlTypeNameCache;
@@ -247,7 +251,7 @@ struct Q_QML_EXPORT CompiledFunctionOrExpression
CompiledFunctionOrExpression *next;
};
-struct Q_QML_EXPORT Object
+struct Q_QML_PRIVATE_EXPORT Object
{
Q_DECLARE_TR_FUNCTIONS(Object)
public:
@@ -297,7 +301,7 @@ private:
PoolList<Function> *functions;
};
-struct Q_QML_EXPORT Pragma
+struct Q_QML_PRIVATE_EXPORT Pragma
{
enum PragmaType {
PragmaSingleton = 0x1
@@ -307,7 +311,7 @@ struct Q_QML_EXPORT Pragma
QV4::CompiledData::Location location;
};
-struct Q_QML_EXPORT Document
+struct Q_QML_PRIVATE_EXPORT Document
{
Document(bool debugMode);
QString code;
@@ -330,16 +334,16 @@ struct Q_QML_EXPORT Document
int registerString(const QString &str) { return jsGenerator.registerString(str); }
QString stringAt(int index) const { return jsGenerator.stringForIndex(index); }
- void extractScriptMetaData(QString &script, QQmlError *error);
+ void extractScriptMetaData(QString &script, QQmlJS::DiagnosticMessage *error);
static void removeScriptPragmas(QString &script);
};
-struct Q_QML_EXPORT IRBuilder : public QQmlJS::AST::Visitor
+struct Q_QML_PRIVATE_EXPORT IRBuilder : public QQmlJS::AST::Visitor
{
Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator)
public:
IRBuilder(const QSet<QString> &illegalNames);
- bool generateFromQml(const QString &code, const QUrl &url, const QString &urlString, Document *output);
+ bool generateFromQml(const QString &code, const QString &url, const QString &urlString, Document *output);
static bool isSignalPropertyName(const QString &name);
@@ -401,7 +405,7 @@ public:
static bool isStatementNodeScript(QQmlJS::AST::Statement *statement);
- QList<QQmlError> errors;
+ QList<QQmlJS::DiagnosticMessage> errors;
QSet<QString> illegalNames;
@@ -416,11 +420,11 @@ public:
QQmlJS::MemoryPool *pool;
QString sourceCode;
- QUrl url;
+ QString url;
QV4::Compiler::JSUnitGenerator *jsGenerator;
};
-struct Q_QML_EXPORT QmlUnitGenerator
+struct Q_QML_PRIVATE_EXPORT QmlUnitGenerator
{
QV4::CompiledData::QmlUnit *generate(Document &output);
@@ -429,6 +433,7 @@ private:
char *writeBindings(char *bindingPtr, Object *o, BindingFilter filter) const;
};
+#ifndef V4_BOOTSTRAP
struct Q_QML_EXPORT PropertyResolver
{
PropertyResolver(QQmlPropertyCache *cache)
@@ -447,8 +452,9 @@ struct Q_QML_EXPORT PropertyResolver
QQmlPropertyCache *cache;
};
+#endif
-struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
+struct Q_QML_PRIVATE_EXPORT JSCodeGen : public QQmlJS::Codegen
{
JSCodeGen(const QString &fileName, const QString &sourceCode, QV4::IR::Module *jsModule,
QQmlJS::Engine *jsEngine, QQmlJS::AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports,
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index b5ddf3bc59..30410ac311 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -2477,7 +2477,7 @@ bool QQmlJSCodeGenerator::compileJavaScriptCodeInObjectsRecursively(int objectIn
functionsToCompile << *foe;
}
const QVector<int> runtimeFunctionIndices = v4CodeGen->generateJSCodeForFunctionsAndBindings(functionsToCompile);
- QList<QQmlError> jsErrors = v4CodeGen->errors();
+ QList<QQmlError> jsErrors = v4CodeGen->qmlErrors();
if (!jsErrors.isEmpty()) {
foreach (const QQmlError &e, jsErrors)
compiler->recordError(e);
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
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index c495437622..fafcfdd04e 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -45,9 +45,12 @@
#include "qv4jsir_p.h"
#include <private/qqmljsastvisitor_p.h>
#include <private/qqmljsast_p.h>
+#include <private/qqmljsengine_p.h>
#include <QtCore/QStringList>
#include <QStack>
+#ifndef V4_BOOTSTRAP
#include <qqmlerror.h>
+#endif
#include <private/qv4util_p.h>
QT_BEGIN_NAMESPACE
@@ -62,7 +65,7 @@ class UiParameterList;
}
-class Q_QML_EXPORT Codegen: protected AST::Visitor
+class Q_QML_PRIVATE_EXPORT Codegen: protected AST::Visitor
{
public:
Codegen(bool strict);
@@ -434,7 +437,10 @@ protected:
virtual void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
public:
- QList<QQmlError> errors() const;
+ QList<DiagnosticMessage> errors() const;
+#ifndef V4_BOOTSTRAP
+ QList<QQmlError> qmlErrors() const;
+#endif
protected:
Result _expr;
@@ -456,7 +462,7 @@ protected:
bool _fileNameIsUrl;
bool hasError;
- QList<QQmlError> _errors;
+ QList<QQmlJS::DiagnosticMessage> _errors;
class ScanFunctions: protected Visitor
{
@@ -532,6 +538,7 @@ protected:
};
+#ifndef V4_BOOTSTRAP
class RuntimeCodegen : public Codegen
{
public:
@@ -545,6 +552,7 @@ public:
private:
QV4::ExecutionContext *context;
};
+#endif // V4_BOOTSTRAP
}
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 56497ed8a3..cd9d8fe8a9 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -41,11 +41,14 @@
#include "qv4compileddata_p.h"
#include "qv4jsir_p.h"
+#include <private/qv4value_inl_p.h>
+#ifndef V4_BOOTSTRAP
#include <private/qv4engine_p.h>
#include <private/qv4function_p.h>
#include <private/qv4objectproto_p.h>
#include <private/qv4lookup_p.h>
#include <private/qv4regexpobject_p.h>
+#endif
#include <private/qqmlirbuilder_p.h>
#include <QCoreApplication>
@@ -57,6 +60,7 @@ namespace QV4 {
namespace CompiledData {
+#ifndef V4_BOOTSTRAP
CompilationUnit::~CompilationUnit()
{
unlink();
@@ -181,6 +185,8 @@ void CompilationUnit::markObjects(QV4::ExecutionEngine *e)
}
}
+#endif // V4_BOOTSTRAP
+
Unit *CompilationUnit::createUnitData(QmlIR::Document *irDocument)
{
return irDocument->jsGenerator.generateUnit();
@@ -198,6 +204,11 @@ QString Binding::valueAsString(const Unit *unit) const
return QString::number(value.d);
case Type_Invalid:
return QString();
+#ifdef QT_NO_TRANSLATION
+ case Type_TranslationById:
+ case Type_Translation:
+ return unit->stringAt(stringIndex);
+#else
case Type_TranslationById: {
QByteArray id = unit->stringAt(stringIndex).toUtf8();
return qtTrId(id.constData(), value.translationData.number);
@@ -214,6 +225,7 @@ QString Binding::valueAsString(const Unit *unit) const
return QCoreApplication::translate(contextUtf8.constData(), text.constData(),
comment.constData(), value.translationData.number);
}
+#endif
default:
break;
}
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index a4dcfd9209..1fba6c0d3c 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -150,7 +150,6 @@ struct JSClass
struct String
{
- quint32 hash;
quint32 flags; // isArrayIndex
QArrayData str;
// uint16 strdata[]
@@ -295,7 +294,7 @@ struct Q_QML_EXPORT TranslationData {
int number;
};
-struct Q_QML_EXPORT Binding
+struct Q_QML_PRIVATE_EXPORT Binding
{
quint32 propertyNameIndex;
@@ -561,26 +560,38 @@ struct QmlUnit
// CompilationUnit * (for functions that need to clean up)
// CompiledData::Function *compiledFunction
-struct Q_QML_EXPORT CompilationUnit
+struct Q_QML_PRIVATE_EXPORT CompilationUnit
{
+#ifdef V4_BOOTSTRAP
+ CompilationUnit()
+ : refCount(0)
+ , data(0)
+ {}
+ virtual ~CompilationUnit() {}
+#else
CompilationUnit()
: refCount(0)
- , engine(0)
, data(0)
+ , engine(0)
, runtimeStrings(0)
, runtimeLookups(0)
, runtimeRegularExpressions(0)
, runtimeClasses(0)
{}
virtual ~CompilationUnit();
+#endif
void ref() { ++refCount; }
void deref() { if (!--refCount) delete this; }
int refCount;
- ExecutionEngine *engine;
Unit *data;
+ // Called only when building QML, when we build the header for JS first and append QML data
+ virtual QV4::CompiledData::Unit *createUnitData(QmlIR::Document *irDocument);
+
+#ifndef V4_BOOTSTRAP
+ ExecutionEngine *engine;
QString fileName() const { return data->stringAt(data->sourceFileIndex); }
QV4::StringValue *runtimeStrings; // Array
@@ -589,9 +600,6 @@ struct Q_QML_EXPORT CompilationUnit
QV4::InternalClass **runtimeClasses;
QVector<QV4::Function *> runtimeFunctions;
- // Called only when building QML, when we build the header for JS first and append QML data
- virtual QV4::CompiledData::Unit *createUnitData(QmlIR::Document *irDocument);
-
QV4::Function *linkToEngine(QV4::ExecutionEngine *engine);
void unlink();
@@ -601,6 +609,7 @@ struct Q_QML_EXPORT CompilationUnit
protected:
virtual void linkBackendToEngine(QV4::ExecutionEngine *engine) = 0;
+#endif // V4_BOOTSTRAP
};
}
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 17e0851b4a..65ef5c4b5e 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -42,8 +42,8 @@
#include <qv4compiler_p.h>
#include <qv4compileddata_p.h>
#include <qv4isel_p.h>
-#include <qv4engine_p.h>
-#include <private/qqmlpropertycache_p.h>
+#include <private/qv4string_p.h>
+#include <private/qv4value_inl_p.h>
QV4::Compiler::StringTableGenerator::StringTableGenerator()
{
@@ -81,7 +81,6 @@ void QV4::Compiler::StringTableGenerator::serialize(uint *stringTable, char *dat
const QString &qstr = strings.at(i);
QV4::CompiledData::String *s = (QV4::CompiledData::String*)(stringData);
- s->hash = QV4::String::createHashValue(qstr.constData(), qstr.length());
s->flags = 0; // ###
s->str.ref.atomic.store(-1);
s->str.size = qstr.length();
diff --git a/src/qml/compiler/qv4compiler_p.h b/src/qml/compiler/qv4compiler_p.h
index e04f13aaf3..a52128f653 100644
--- a/src/qml/compiler/qv4compiler_p.h
+++ b/src/qml/compiler/qv4compiler_p.h
@@ -59,7 +59,7 @@ struct JSClassMember;
namespace Compiler {
-struct Q_QML_EXPORT StringTableGenerator {
+struct Q_QML_PRIVATE_EXPORT StringTableGenerator {
StringTableGenerator();
int registerString(const QString &str);
@@ -79,7 +79,7 @@ private:
uint stringDataSize;
};
-struct Q_QML_EXPORT JSUnitGenerator {
+struct Q_QML_PRIVATE_EXPORT JSUnitGenerator {
JSUnitGenerator(IR::Module *module, int headerSize = -1);
int registerString(const QString &str) { return stringTable.registerString(str); }
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 9864135702..429688090c 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -39,14 +39,13 @@
**
****************************************************************************/
-#include "qv4debugging_p.h"
-#include "qv4engine_p.h"
#include "qv4jsir_p.h"
#include "qv4isel_p.h"
#include "qv4isel_util_p.h"
-#include "qv4functionobject_p.h"
-#include "qv4function_p.h"
+#include <private/qv4value_inl_p.h>
+#ifndef V4_BOOTSTRAP
#include <private/qqmlpropertycache_p.h>
+#endif
#include <QString>
@@ -68,7 +67,9 @@ EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutableAllocator *exe
ownJSGenerator.reset(jsGenerator);
}
this->jsGenerator = jsGenerator;
+#ifndef V4_BOOTSTRAP
Q_ASSERT(execAllocator);
+#endif
Q_ASSERT(module);
}
@@ -144,6 +145,9 @@ void IRDecoder::visitMove(IR::Move *s)
}
} else if (IR::Member *m = s->source->asMember()) {
if (m->property) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
bool captureRequired = true;
Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
@@ -159,6 +163,7 @@ void IRDecoder::visitMove(IR::Move *s)
}
}
getQObjectProperty(m->base, m->property->coreIndex, captureRequired, attachedPropertiesId, t);
+#endif // V4_BOOTSTRAP
return;
} else if (m->base->asTemp() || m->base->asConst()) {
getProperty(m->base, *m->name, t);
@@ -200,7 +205,11 @@ void IRDecoder::visitMove(IR::Move *s)
Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
if (m->property && attachedPropertiesId == 0) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
setQObjectProperty(s->source, m->base, m->property->coreIndex);
+#endif
return;
} else {
setProperty(s->source, m->base, *m->name);
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h
index c0de4ec8bf..74e6ba8200 100644
--- a/src/qml/compiler/qv4isel_p.h
+++ b/src/qml/compiler/qv4isel_p.h
@@ -59,7 +59,7 @@ namespace QV4 {
class ExecutableAllocator;
struct Function;
-class Q_QML_EXPORT EvalInstructionSelection
+class Q_QML_PRIVATE_EXPORT EvalInstructionSelection
{
public:
EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
@@ -90,7 +90,7 @@ protected:
IR::Module *irModule;
};
-class Q_QML_EXPORT EvalISelFactory
+class Q_QML_PRIVATE_EXPORT EvalISelFactory
{
public:
virtual ~EvalISelFactory() = 0;
@@ -99,7 +99,7 @@ public:
};
namespace IR {
-class Q_QML_EXPORT IRDecoder: protected IR::StmtVisitor
+class Q_QML_PRIVATE_EXPORT IRDecoder: protected IR::StmtVisitor
{
public:
IRDecoder() : _function(0) {}
diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp
index efce64bf7a..a5ccaeb3fc 100644
--- a/src/qml/compiler/qv4jsir.cpp
+++ b/src/qml/compiler/qv4jsir.cpp
@@ -42,7 +42,9 @@
#include "qv4jsir_p.h"
#include <private/qqmljsast_p.h>
+#ifndef V4_BOOTSTRAP
#include <private/qqmlpropertycache_p.h>
+#endif
#include <QtCore/qtextstream.h>
#include <QtCore/qdebug.h>
#include <QtCore/qset.h>
@@ -276,12 +278,14 @@ static QString dumpStart(const Expr *e) {
return QString();
QString result = typeName(e->type);
+#ifndef V4_BOOTSTRAP
const Temp *temp = const_cast<Expr*>(e)->asTemp();
if (e->type == QObjectType && temp && temp->memberResolver.isQObjectResolver) {
result += QLatin1Char('<');
result += QString::fromUtf8(static_cast<QQmlPropertyCache*>(temp->memberResolver.data)->className());
result += QLatin1Char('>');
}
+#endif
result += QLatin1Char('{');
return result;
}
@@ -554,8 +558,10 @@ void Member::dump(QTextStream &out) const
else
base->dump(out);
out << '.' << *name;
+#ifndef V4_BOOTSTRAP
if (property)
out << " (meta-property " << property->coreIndex << " <" << QMetaType::typeName(property->propType) << ">)";
+#endif
}
void Exp::dump(QTextStream &out, Mode)
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index a333214a8b..71120e6054 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -742,7 +742,7 @@ struct Phi: Stmt {
virtual void dump(QTextStream &out, Mode mode);
};
-struct Q_QML_EXPORT Module {
+struct Q_QML_PRIVATE_EXPORT Module {
QQmlJS::MemoryPool pool;
QVector<Function *> functions;
Function *rootFunction;
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 338041ad5d..6112c490f7 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -54,9 +54,6 @@
#include <QtCore/QLinkedList>
#include <QtCore/QStack>
#include <qv4runtime_p.h>
-#include <qv4context_p.h>
-#include <private/qqmlpropertycache_p.h>
-#include <private/qqmlengine_p.h>
#include <cmath>
#include <iostream>
#include <cassert>
@@ -3373,8 +3370,8 @@ void optimizeSSA(IR::Function *function, DefUsesCalculator &defUses, DominatorTr
QV4::Primitive lc = convertToValue(leftConst);
QV4::Primitive rc = convertToValue(rightConst);
- double l = RuntimeHelpers::toNumber(&lc);
- double r = RuntimeHelpers::toNumber(&rc);
+ double l = lc.toNumber();
+ double r = rc.toNumber();
switch (binop->op) {
case OpMul:
diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h
index 87f28d0eb2..0fa6f146f3 100644
--- a/src/qml/compiler/qv4ssa_p.h
+++ b/src/qml/compiler/qv4ssa_p.h
@@ -137,7 +137,7 @@ public:
}
};
-class Q_QML_EXPORT Optimizer
+class Q_QML_PRIVATE_EXPORT Optimizer
{
public:
Optimizer(Function *function)
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri
index 9d5757b5a0..72010d3fa8 100644
--- a/src/qml/jsruntime/jsruntime.pri
+++ b/src/qml/jsruntime/jsruntime.pri
@@ -1,11 +1,10 @@
INCLUDEPATH += $$PWD
INCLUDEPATH += $$OUT_PWD
+!qmldevtools_build {
SOURCES += \
$$PWD/qv4engine.cpp \
$$PWD/qv4context.cpp \
- $$PWD/qv4runtime.cpp \
- $$PWD/qv4value.cpp \
$$PWD/qv4persistent.cpp \
$$PWD/qv4debugging.cpp \
$$PWD/qv4lookup.cpp \
@@ -33,7 +32,6 @@ SOURCES += \
$$PWD/qv4regexpobject.cpp \
$$PWD/qv4stringobject.cpp \
$$PWD/qv4variantobject.cpp \
- $$PWD/qv4string.cpp \
$$PWD/qv4objectiterator.cpp \
$$PWD/qv4regexp.cpp \
$$PWD/qv4serialize.cpp \
@@ -50,10 +48,7 @@ HEADERS += \
$$PWD/qv4global_p.h \
$$PWD/qv4engine_p.h \
$$PWD/qv4context_p.h \
- $$PWD/qv4runtime_p.h \
$$PWD/qv4math_p.h \
- $$PWD/qv4value_inl_p.h \
- $$PWD/qv4value_p.h \
$$PWD/qv4persistent_p.h \
$$PWD/qv4debugging_p.h \
$$PWD/qv4lookup_p.h \
@@ -81,7 +76,6 @@ HEADERS += \
$$PWD/qv4regexpobject_p.h \
$$PWD/qv4stringobject_p.h \
$$PWD/qv4variantobject_p.h \
- $$PWD/qv4string_p.h \
$$PWD/qv4property_p.h \
$$PWD/qv4objectiterator_p.h \
$$PWD/qv4regexp_p.h \
@@ -97,6 +91,20 @@ HEADERS += \
$$PWD/qv4vme_moth_p.h \
$$PWD/qv4profiling_p.h
+}
+
+
+HEADERS += \
+ $$PWD/qv4runtime_p.h \
+ $$PWD/qv4value_inl_p.h \
+ $$PWD/qv4string_p.h \
+ $$PWD/qv4value_p.h
+
+SOURCES += \
+ $$PWD/qv4runtime.cpp \
+ $$PWD/qv4string.cpp \
+ $$PWD/qv4value.cpp
+
# Use SSE2 floating point math on 32 bit instead of the default
# 387 to make test results pass on 32 and on 64 bit builds.
linux-g++*:isEqual(QT_ARCH,i386) {
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h
index 4e05bb81ab..b5dc6742f9 100644
--- a/src/qml/jsruntime/qv4global_p.h
+++ b/src/qml/jsruntime/qv4global_p.h
@@ -45,6 +45,7 @@
#include <QtCore/qglobal.h>
#include <QString>
#include <qtqmlglobal.h>
+#include <private/qtqmlglobal_p.h>
#if defined(Q_CC_MSVC)
#include <float.h>
@@ -66,6 +67,10 @@ inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); }
#define qOffsetOf(s, m) ((size_t)((((char *)&(((s *)64)->m)) - 64)))
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+#define V4_BOOTSTRAP
+#endif
+
// Decide whether to enable or disable the JIT
// White list architectures
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index 5ad4c28970..06d3e4884b 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -187,7 +187,7 @@ const QV4::ObjectVTable classname::static_vtbl = \
}
-struct Q_QML_EXPORT Managed
+struct Q_QML_PRIVATE_EXPORT Managed
{
V4_MANAGED
enum {
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 0dfaffc132..40f38ee347 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -410,11 +410,13 @@ inline ArrayObject *value_cast(const Value &v) {
return v.asArrayObject();
}
+#ifndef V4_BOOTSTRAP
template<>
inline ReturnedValue value_convert<Object>(ExecutionEngine *e, const Value &v)
{
return v.toObject(e->currentContext())->asReturnedValue();
}
+#endif
struct ObjectRef : public ManagedRef
{
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 4923c217b6..e44d1a07a6 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -41,6 +41,7 @@
#include "qv4global_p.h"
#include "qv4runtime_p.h"
+#ifndef V4_BOOTSTRAP
#include "qv4object_p.h"
#include "qv4jsir_p.h"
#include "qv4objectproto_p.h"
@@ -54,6 +55,7 @@
#include <private/qqmlcontextwrapper_p.h>
#include "qv4qobjectwrapper_p.h"
#include <private/qv8engine_p.h>
+#endif
#include <QtCore/qmath.h>
#include <QtCore/qnumeric.h>
@@ -63,7 +65,7 @@
#include <typeinfo>
#include <stdlib.h>
-#include "../../../3rdparty/double-conversion/double-conversion.h"
+#include "../../3rdparty/double-conversion/double-conversion.h"
QT_BEGIN_NAMESPACE
@@ -207,6 +209,7 @@ void RuntimeCounters::count(const char *func, uint tag1, uint tag2)
#endif // QV4_COUNT_RUNTIME_FUNCTIONS
+#ifndef V4_BOOTSTRAP
void RuntimeHelpers::numberToString(QString *result, double num, int radix)
{
Q_ASSERT(result);
@@ -414,10 +417,7 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
return ctx->throwTypeError();
}
-Bool Runtime::toBoolean(const ValueRef value)
-{
- return value->toBoolean();
-}
+
Returned<Object> *RuntimeHelpers::convertToObject(ExecutionContext *ctx, const ValueRef value)
{
@@ -677,6 +677,8 @@ ReturnedValue Runtime::getActivationProperty(ExecutionContext *ctx, const String
return ctx->getProperty(name);
}
+#endif // V4_BOOTSTRAP
+
uint RuntimeHelpers::equalHelper(const ValueRef x, const ValueRef y)
{
Q_ASSERT(x->type() != y->type() || (x->isManaged() && (x->isString() != y->isString())));
@@ -697,14 +699,20 @@ uint RuntimeHelpers::equalHelper(const ValueRef x, const ValueRef y)
return Runtime::compareEqual(Primitive::fromDouble((double) x->booleanValue()), y);
} else if (y->isBoolean()) {
return Runtime::compareEqual(x, Primitive::fromDouble((double) y->booleanValue()));
- } else if ((x->isNumber() || x->isString()) && y->isObject()) {
- Scope scope(y->objectValue()->engine());
- ScopedValue py(scope, RuntimeHelpers::toPrimitive(y, PREFERREDTYPE_HINT));
- return Runtime::compareEqual(x, py);
- } else if (x->isObject() && (y->isNumber() || y->isString())) {
- Scope scope(x->objectValue()->engine());
- ScopedValue px(scope, RuntimeHelpers::toPrimitive(x, PREFERREDTYPE_HINT));
- return Runtime::compareEqual(px, y);
+ } else {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
+ if ((x->isNumber() || x->isString()) && y->isObject()) {
+ Scope scope(y->objectValue()->engine());
+ ScopedValue py(scope, RuntimeHelpers::toPrimitive(y, PREFERREDTYPE_HINT));
+ return Runtime::compareEqual(x, py);
+ } else if (x->isObject() && (y->isNumber() || y->isString())) {
+ Scope scope(x->objectValue()->engine());
+ ScopedValue px(scope, RuntimeHelpers::toPrimitive(x, PREFERREDTYPE_HINT));
+ return Runtime::compareEqual(px, y);
+ }
+#endif
}
return false;
@@ -732,15 +740,25 @@ QV4::Bool Runtime::compareGreaterThan(const QV4::ValueRef l, const QV4::ValueRef
return l->integerValue() > r->integerValue();
if (l->isNumber() && r->isNumber())
return l->asDouble() > r->asDouble();
- if (l->isString() && r->isString())
+ if (l->isString() && r->isString()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+ return false;
+#else
return r->stringValue()->compare(l->stringValue());
+#endif
+ }
if (l->isObject() || r->isObject()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
return Runtime::compareGreaterThan(pl, pr);
+#endif
}
double dl = RuntimeHelpers::toNumber(l);
@@ -755,15 +773,25 @@ QV4::Bool Runtime::compareLessThan(const QV4::ValueRef l, const QV4::ValueRef r)
return l->integerValue() < r->integerValue();
if (l->isNumber() && r->isNumber())
return l->asDouble() < r->asDouble();
- if (l->isString() && r->isString())
+ if (l->isString() && r->isString()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+ return false;
+#else
return l->stringValue()->compare(r->stringValue());
+#endif
+ }
if (l->isObject() || r->isObject()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
return Runtime::compareLessThan(pl, pr);
+#endif
}
double dl = RuntimeHelpers::toNumber(l);
@@ -778,15 +806,25 @@ QV4::Bool Runtime::compareGreaterEqual(const QV4::ValueRef l, const QV4::ValueRe
return l->integerValue() >= r->integerValue();
if (l->isNumber() && r->isNumber())
return l->asDouble() >= r->asDouble();
- if (l->isString() && r->isString())
+ if (l->isString() && r->isString()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+ return false;
+#else
return !l->stringValue()->compare(r->stringValue());
+#endif
+ }
if (l->isObject() || r->isObject()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
return Runtime::compareGreaterEqual(pl, pr);
+#endif
}
double dl = RuntimeHelpers::toNumber(l);
@@ -801,15 +839,25 @@ QV4::Bool Runtime::compareLessEqual(const QV4::ValueRef l, const QV4::ValueRef r
return l->integerValue() <= r->integerValue();
if (l->isNumber() && r->isNumber())
return l->asDouble() <= r->asDouble();
- if (l->isString() && r->isString())
+ if (l->isString() && r->isString()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+ return false;
+#else
return !r->stringValue()->compare(l->stringValue());
+#endif
+ }
if (l->isObject() || r->isObject()) {
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
return Runtime::compareLessEqual(pl, pr);
+#endif
}
double dl = RuntimeHelpers::toNumber(l);
@@ -817,7 +865,7 @@ QV4::Bool Runtime::compareLessEqual(const QV4::ValueRef l, const QV4::ValueRef r
return dl <= dr;
}
-
+#ifndef V4_BOOTSTRAP
ReturnedValue Runtime::callGlobalLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
Scope scope(context);
@@ -1144,6 +1192,8 @@ QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionContext *ctx)
return (new (c->engine->memoryManager) ArgumentsObject(c))->asReturnedValue();
}
+#endif // V4_BOOTSTRAP
+
QV4::ReturnedValue Runtime::increment(const QV4::ValueRef value)
{
TRACE1(value);
@@ -1168,6 +1218,8 @@ QV4::ReturnedValue Runtime::decrement(const QV4::ValueRef value)
}
}
+#ifndef V4_BOOTSTRAP
+
QV4::ReturnedValue RuntimeHelpers::toString(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
{
if (value->isString())
@@ -1187,6 +1239,8 @@ QV4::ReturnedValue RuntimeHelpers::toObject(QV4::ExecutionContext *ctx, const QV
return Encode(o);
}
+#endif // V4_BOOTSTRAP
+
ReturnedValue Runtime::toDouble(const ValueRef value)
{
TRACE1(value);
@@ -1217,6 +1271,8 @@ unsigned Runtime::doubleToUInt(const double &d)
return Primitive::toUInt32(d);
}
+#ifndef V4_BOOTSTRAP
+
ReturnedValue Runtime::regexpLiteral(ExecutionContext *ctx, int id)
{
return ctx->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
@@ -1301,6 +1357,8 @@ void Runtime::convertThisToObject(ExecutionContext *ctx)
}
}
+#endif // V4_BOOTSTRAP
+
} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index d00c579283..0979105680 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -103,7 +103,7 @@ struct NoThrowContext : public ExecutionContext
{
};
-struct Q_QML_EXPORT Runtime {
+struct Q_QML_PRIVATE_EXPORT Runtime {
// call
static ReturnedValue callGlobalLookup(ExecutionContext *context, uint index, CallDataRef callData);
static ReturnedValue callActivationProperty(ExecutionContext *, const StringRef name, CallDataRef callData);
@@ -232,7 +232,7 @@ struct Q_QML_EXPORT Runtime {
static void setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value);
};
-struct Q_QML_EXPORT RuntimeHelpers {
+struct Q_QML_PRIVATE_EXPORT RuntimeHelpers {
static ReturnedValue objectDefaultValue(Object *object, int typeHint);
static ReturnedValue toPrimitive(const ValueRef value, int typeHint);
@@ -255,6 +255,7 @@ struct Q_QML_EXPORT RuntimeHelpers {
// type conversion and testing
+#ifndef V4_BOOTSTRAP
inline ReturnedValue RuntimeHelpers::toPrimitive(const ValueRef value, int typeHint)
{
Object *o = value->asObject();
@@ -262,6 +263,7 @@ inline ReturnedValue RuntimeHelpers::toPrimitive(const ValueRef value, int typeH
return value.asReturnedValue();
return RuntimeHelpers::objectDefaultValue(o, typeHint);
}
+#endif
inline double RuntimeHelpers::toNumber(const ValueRef value)
{
@@ -338,6 +340,7 @@ inline ReturnedValue Runtime::bitAnd(const ValueRef left, const ValueRef right)
return Encode(lval & rval);
}
+#ifndef V4_BOOTSTRAP
inline ReturnedValue Runtime::add(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -349,6 +352,7 @@ inline ReturnedValue Runtime::add(ExecutionContext *ctx, const ValueRef left, co
return RuntimeHelpers::addHelper(ctx, left, right);
}
+#endif // V4_BOOTSTRAP
inline ReturnedValue Runtime::sub(const ValueRef left, const ValueRef right)
{
@@ -532,6 +536,7 @@ inline Bool Runtime::compareStrictNotEqual(const ValueRef left, const ValueRef r
return ! RuntimeHelpers::strictEqual(left, right);
}
+#ifndef V4_BOOTSTRAP
inline Bool Runtime::compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -550,6 +555,13 @@ inline uint Runtime::compareIn(ExecutionContext *ctx, const ValueRef left, const
return v->booleanValue();
}
+#endif // V4_BOOTSTRAP
+
+inline Bool Runtime::toBoolean(const ValueRef value)
+{
+ return value->toBoolean();
+}
+
} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 33922684da..36f61a1df5 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -385,10 +385,10 @@ QV4::CompiledData::CompilationUnit *Script::precompile(IR::Module *module, Compi
QQmlJS::Codegen cg(/*strict mode*/false);
cg.generateFromProgram(url.toString(), source, program, module, QQmlJS::Codegen::EvalCode);
- errors = cg.errors();
+ errors = cg.qmlErrors();
if (!errors.isEmpty()) {
if (reportedErrors)
- *reportedErrors << cg.errors();
+ *reportedErrors << errors;
return 0;
}
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 575f605e45..d9aa881f21 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -40,10 +40,13 @@
****************************************************************************/
#include "qv4string_p.h"
+#include "qv4value_inl_p.h"
+#ifndef V4_BOOTSTRAP
#include "qv4identifiertable_p.h"
#include "qv4runtime_p.h"
#include "qv4objectproto_p.h"
#include "qv4stringobject_p.h"
+#endif
#include <QtCore/QHash>
using namespace QV4;
@@ -74,6 +77,8 @@ static uint toArrayIndex(const QChar *ch, const QChar *end, bool *ok)
return i;
}
+#ifndef V4_BOOTSTRAP
+
static uint toArrayIndex(const char *ch, const char *end, bool *ok)
{
*ok = false;
@@ -407,13 +412,16 @@ uint String::createHashValue(const char *ch, int length)
return h;
}
+uint String::getLength(const Managed *m)
+{
+ return static_cast<const String *>(m)->length();
+}
+
+#endif // V4_BOOTSTRAP
+
uint String::toArrayIndex(const QString &str)
{
bool ok;
return ::toArrayIndex(str.constData(), str.constData() + str.length(), &ok);
}
-uint String::getLength(const Managed *m)
-{
- return static_cast<const String *>(m)->length();
-}
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index ade64d1352..ed2a4e3646 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -51,7 +51,8 @@ namespace QV4 {
struct ExecutionEngine;
struct Identifier;
-struct Q_QML_EXPORT String : public Managed {
+struct Q_QML_PRIVATE_EXPORT String : public Managed {
+#ifndef V4_BOOTSTRAP
// ### FIXME: Should this be a V4_OBJECT
V4_OBJECT
Q_MANAGED_TYPE(String)
@@ -143,8 +144,6 @@ struct Q_QML_EXPORT String : public Managed {
return len;
}
- static uint toArrayIndex(const QString &str);
-
union {
mutable QStringData *_text;
mutable String *left;
@@ -174,8 +173,13 @@ protected:
private:
QChar *recursiveAppend(QChar *ch) const;
+#endif
+
+public:
+ static uint toArrayIndex(const QString &str);
};
+#ifndef V4_BOOTSTRAP
template<>
inline String *value_cast(const Value &v) {
return v.asString();
@@ -188,6 +192,7 @@ inline ReturnedValue value_convert<String>(ExecutionEngine *e, const Value &v)
}
DEFINE_REF(String, Managed);
+#endif
}
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index fa16662b46..e9246f7a14 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -39,9 +39,11 @@
**
****************************************************************************/
#include <qv4engine_p.h>
+#ifndef V4_BOOTSTRAP
#include <qv4object_p.h>
#include <qv4objectproto_p.h>
#include "qv4mm_p.h"
+#endif
#include <wtf/MathExtras.h>
@@ -87,6 +89,9 @@ double Value::toNumberImpl() const
case QV4::Value::Undefined_Type:
return std::numeric_limits<double>::quiet_NaN();
case QV4::Value::Managed_Type:
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
if (isString())
return RuntimeHelpers::stringToNumber(stringValue()->toQString());
{
@@ -95,6 +100,7 @@ double Value::toNumberImpl() const
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), NUMBER_HINT));
return prim->toNumber();
}
+#endif
case QV4::Value::Null_Type:
case QV4::Value::Boolean_Type:
case QV4::Value::Integer_Type:
@@ -104,6 +110,7 @@ double Value::toNumberImpl() const
}
}
+#ifndef V4_BOOTSTRAP
QString Value::toQStringNoThrow() const
{
switch (type()) {
@@ -192,6 +199,7 @@ QString Value::toQString() const
}
} // switch
}
+#endif // V4_BOOTSTRAP
bool Value::sameValue(Value other) const {
if (val == other.val)
@@ -263,6 +271,7 @@ double Primitive::toInteger(double number)
return std::signbit(number) ? -v : v;
}
+#ifndef V4_BOOTSTRAP
String *Value::toString(ExecutionEngine *e) const
{
return toString(e->currentContext());
@@ -282,3 +291,4 @@ Object *Value::toObject(ExecutionContext *ctx) const
return RuntimeHelpers::convertToObject(ctx, ValueRef::fromRawValue(this))->getPointer();
}
+#endif // V4_BOOTSTRAP
diff --git a/src/qml/jsruntime/qv4value_inl_p.h b/src/qml/jsruntime/qv4value_inl_p.h
index 35508f442a..1fe9e1c165 100644
--- a/src/qml/jsruntime/qv4value_inl_p.h
+++ b/src/qml/jsruntime/qv4value_inl_p.h
@@ -180,14 +180,19 @@ inline bool Value::toBoolean() const
case Value::Integer_Type:
return (bool)int_32;
case Value::Managed_Type:
+#ifdef V4_BOOTSTRAP
+ Q_UNIMPLEMENTED();
+#else
if (isString())
return stringValue()->toQString().length() > 0;
+#endif
return true;
default: // double
return doubleValue() && !std::isnan(doubleValue());
}
}
+#ifndef V4_BOOTSTRAP
inline uint Value::asArrayIndex() const
{
#if QT_POINTER_SIZE == 8
@@ -278,6 +283,8 @@ inline ErrorObject *Value::asErrorObject() const
template<typename T>
inline T *Value::as() const { Managed *m = isObject() ? managed() : 0; return m ? m->as<T>() : 0; }
+#endif
+
} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 27c81d59a5..2c780622dc 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -64,7 +64,7 @@ struct Returned : private T
using T::asReturnedValue;
};
-struct Q_QML_EXPORT Value
+struct Q_QML_PRIVATE_EXPORT Value
{
/*
We use two different ways of encoding JS values. One for 32bit and one for 64bit systems.
@@ -372,7 +372,7 @@ inline String *Value::asString() const
return 0;
}
-struct Q_QML_EXPORT Primitive : public Value
+struct Q_QML_PRIVATE_EXPORT Primitive : public Value
{
inline static Primitive emptyValue();
static inline Primitive fromBoolean(bool b);
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index b6250ee35d..013f757c90 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -1,4 +1,12 @@
SOURCES += \
+ $$PWD/qqmldirparser.cpp \
+
+HEADERS += \
+ $$PWD/qqmldirparser_p.h \
+
+!qmldevtools_build {
+
+SOURCES += \
$$PWD/qqmlopenmetaobject.cpp \
$$PWD/qqmlvmemetaobject.cpp \
$$PWD/qqmlengine.cpp \
@@ -31,7 +39,6 @@ SOURCES += \
$$PWD/qqmltypenamecache.cpp \
$$PWD/qqmlscriptstring.cpp \
$$PWD/qqmlnetworkaccessmanagerfactory.cpp \
- $$PWD/qqmldirparser.cpp \
$$PWD/qqmlextensionplugin.cpp \
$$PWD/qqmlimport.cpp \
$$PWD/qqmllist.cpp \
@@ -102,7 +109,6 @@ HEADERS += \
$$PWD/qqmlscriptstring.h \
$$PWD/qqmlguard_p.h \
$$PWD/qqmlnetworkaccessmanagerfactory.h \
- $$PWD/qqmldirparser_p.h \
$$PWD/qqmlextensioninterface.h \
$$PWD/qqmlimport_p.h \
$$PWD/qqmlextensionplugin.h \
@@ -133,3 +139,5 @@ HEADERS += \
include(ftw/ftw.pri)
include(v8/v8.pri)
+
+}
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp
index c1d0132c61..a2b4b5edd0 100644
--- a/src/qml/qml/qqmldirparser.cpp
+++ b/src/qml/qml/qqmldirparser.cpp
@@ -41,9 +41,7 @@
#include "qqmldirparser_p.h"
#include "qqmlerror.h"
-#include "qqmlglobal_p.h"
-#include <QtQml/qqmlfile.h>
#include <QtCore/QtDebug>
QT_BEGIN_NAMESPACE
@@ -281,10 +279,10 @@ bool QQmlDirParser::parse(const QString &source)
void QQmlDirParser::reportError(quint16 line, quint16 column, const QString &description)
{
- QQmlError error;
- error.setLine(line);
- error.setColumn(column);
- error.setDescription(description);
+ QQmlJS::DiagnosticMessage error;
+ error.loc.startLine = line;
+ error.loc.startColumn = column;
+ error.message = description;
_errors.append(error);
}
@@ -296,25 +294,41 @@ bool QQmlDirParser::hasError() const
return false;
}
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+QList<QQmlJS::DiagnosticMessage> QQmlDirParser::errors(const QString &uri) const
+{
+ QList<QQmlJS::DiagnosticMessage> errors = _errors;
+ for (int i = 0; i < errors.size(); ++i) {
+ QQmlJS::DiagnosticMessage &msg = errors[i];
+ msg.message.replace(QLatin1String("$$URI$$"), uri);
+ }
+ return errors;
+}
+#else
void QQmlDirParser::setError(const QQmlError &e)
{
_errors.clear();
- _errors.append(e);
+ reportError(e.line(), e.column(), e.description());
}
QList<QQmlError> QQmlDirParser::errors(const QString &uri) const
{
QUrl url(uri);
- QList<QQmlError> errors = _errors;
- for (int i = 0; i < errors.size(); ++i) {
- QQmlError &e = errors[i];
- QString description = e.description();
+ QList<QQmlError> errors;
+ for (int i = 0; i < _errors.size(); ++i) {
+ const QQmlJS::DiagnosticMessage &msg = _errors.at(i);
+ QQmlError e;
+ QString description = msg.message;
description.replace(QLatin1String("$$URI$$"), uri);
e.setDescription(description);
e.setUrl(url);
+ e.setLine(msg.loc.startLine);
+ e.setColumn(msg.loc.startColumn);
+ errors << e;
}
return errors;
}
+#endif
QString QQmlDirParser::typeNamespace() const
{
@@ -331,7 +345,7 @@ QList<QQmlDirParser::Plugin> QQmlDirParser::plugins() const
return _plugins;
}
-QHash<QHashedStringRef,QQmlDirParser::Component> QQmlDirParser::components() const
+QHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const
{
return _components;
}
diff --git a/src/qml/qml/qqmldirparser_p.h b/src/qml/qml/qqmldirparser_p.h
index e3607d1e72..bcdb366c6c 100644
--- a/src/qml/qml/qqmldirparser_p.h
+++ b/src/qml/qml/qqmldirparser_p.h
@@ -56,13 +56,14 @@
#include <QtCore/QUrl>
#include <QtCore/QHash>
#include <QtCore/QDebug>
-#include <private/qhashedstring_p.h>
+#include <private/qqmljsengine_p.h>
+#include <private/qtqmlglobal_p.h>
QT_BEGIN_NAMESPACE
class QQmlError;
class QQmlEngine;
-class Q_AUTOTEST_EXPORT QQmlDirParser
+class Q_QML_PRIVATE_EXPORT QQmlDirParser
{
Q_DISABLE_COPY(QQmlDirParser)
@@ -73,8 +74,12 @@ public:
bool parse(const QString &source);
bool hasError() const;
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+ QList<QQmlJS::DiagnosticMessage> errors(const QString &uri) const;
+#else
void setError(const QQmlError &);
QList<QQmlError> errors(const QString &uri) const;
+#endif
QString typeNamespace() const;
void setTypeNamespace(const QString &s);
@@ -121,7 +126,7 @@ public:
int minorVersion;
};
- QHash<QHashedStringRef,Component> components() const;
+ QHash<QString,Component> components() const;
QList<Script> scripts() const;
QList<Plugin> plugins() const;
@@ -142,9 +147,9 @@ private:
void reportError(quint16 line, quint16 column, const QString &message);
private:
- QList<QQmlError> _errors;
+ QList<QQmlJS::DiagnosticMessage> _errors;
QString _typeNamespace;
- QHash<QHashedStringRef,Component> _components; // multi hash
+ QHash<QString,Component> _components; // multi hash
QList<Script> _scripts;
QList<Plugin> _plugins;
#ifdef QT_CREATOR
@@ -152,7 +157,7 @@ private:
#endif
};
-typedef QHash<QHashedStringRef,QQmlDirParser::Component> QQmlDirComponents;
+typedef QHash<QString,QQmlDirParser::Component> QQmlDirComponents;
typedef QList<QQmlDirParser::Script> QQmlDirScripts;
typedef QList<QQmlDirParser::Plugin> QQmlDirPlugins;
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 980d4ed026..c0b21a943f 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -624,12 +624,13 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
}
}
- QQmlDirComponents::ConstIterator it = qmlDirComponents.find(type), end = qmlDirComponents.end();
+ const QString typeStr = type.toString();
+ QQmlDirComponents::ConstIterator it = qmlDirComponents.find(typeStr), end = qmlDirComponents.end();
if (it != end) {
QString componentUrl;
bool isCompositeSingleton = false;
QQmlDirComponents::ConstIterator candidate = end;
- for ( ; it != end && it.key() == type; ++it) {
+ for ( ; it != end && it.key() == typeStr; ++it) {
const QQmlDirParser::Component &c = *it;
// importing version -1 means import ALL versions
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h
index e0c630e9d3..3c9452963c 100644
--- a/src/qml/qml/qqmlimport_p.h
+++ b/src/qml/qml/qqmlimport_p.h
@@ -48,6 +48,7 @@
#include <QtCore/qstringlist.h>
#include <private/qqmldirparser_p.h>
#include <private/qqmlmetatype_p.h>
+#include <private/qhashedstring_p.h>
//
// W A R N I N G
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index c6693c2ae8..7fc08bd114 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2207,8 +2207,17 @@ void QQmlTypeData::dataReceived(const Data &data)
QQmlEngine *qmlEngine = typeLoader()->engine();
m_document.reset(new QmlIR::Document(QV8Engine::getV4(qmlEngine)->debugger != 0));
QmlIR::IRBuilder compiler(QV8Engine::get(qmlEngine)->illegalNames());
- if (!compiler.generateFromQml(code, finalUrl(), finalUrlString(), m_document.data())) {
- setError(compiler.errors);
+ if (!compiler.generateFromQml(code, finalUrlString(), finalUrlString(), m_document.data())) {
+ QList<QQmlError> errors;
+ foreach (const QQmlJS::DiagnosticMessage &msg, compiler.errors) {
+ QQmlError e;
+ e.setUrl(finalUrl());
+ e.setLine(msg.loc.startLine);
+ e.setColumn(msg.loc.startColumn);
+ e.setDescription(msg.message);
+ errors << e;
+ }
+ setError(errors);
return;
}
@@ -2673,11 +2682,15 @@ void QQmlScriptBlob::dataReceived(const Data &data)
QV4::ExecutionEngine *v4 = QV8Engine::getV4(m_typeLoader->engine());
QmlIR::Document irUnit(v4->debugger != 0);
- QQmlError metaDataError;
+ QQmlJS::DiagnosticMessage metaDataError;
irUnit.extractScriptMetaData(source, &metaDataError);
- if (metaDataError.isValid()) {
- metaDataError.setUrl(finalUrl());
- setError(metaDataError);
+ if (!metaDataError.message.isEmpty()) {
+ QQmlError e;
+ e.setUrl(finalUrl());
+ e.setLine(metaDataError.loc.startLine);
+ e.setColumn(metaDataError.loc.startColumn);
+ e.setDescription(metaDataError.message);
+ setError(e);
return;
}
diff --git a/src/qml/qtqmlglobal_p.h b/src/qml/qtqmlglobal_p.h
index 564540e147..e1900b72c3 100644
--- a/src/qml/qtqmlglobal_p.h
+++ b/src/qml/qtqmlglobal_p.h
@@ -55,6 +55,10 @@
#include "qtqmlglobal.h"
-#define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+# define Q_QML_PRIVATE_EXPORT
+#else
+# define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT
+#endif
#endif // QTQMLGLOBAL_P_H
diff --git a/src/qmldevtools/qmldevtools.pro b/src/qmldevtools/qmldevtools.pro
index 963fb1be5a..25d6494558 100644
--- a/src/qmldevtools/qmldevtools.pro
+++ b/src/qmldevtools/qmldevtools.pro
@@ -1,7 +1,7 @@
option(host_build)
TARGET = QtQmlDevTools
QT = core
-CONFIG += static no_module_headers internal_module
+CONFIG += static no_module_headers internal_module qmldevtools_build
MODULE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE \
@@ -12,4 +12,8 @@ MODULE_PRIVATE_INCLUDES = \
load(qt_module)
+include(../3rdparty/masm/masm-defs.pri)
include(../qml/parser/parser.pri)
+include(../qml/jsruntime/jsruntime.pri)
+include(../qml/compiler/compiler.pri)
+include(../qml/qml/qml.pri)