aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-01 12:44:51 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-01 12:44:51 +0200
commitb78372c4ba31da2d941d70ba23a927deae7d830c (patch)
tree25d9eeefbbb4c6ace084c56e58ac7bd1927217b5 /src/qml/compiler
parent9990c0f577f6a6a67ccebffb56ad1afc7a98ed1d (diff)
parent7ea1f75fd877f312d70a90ab0405f3ca03914171 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/compiler.pri22
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp93
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h30
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp5
-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
16 files changed, 191 insertions, 107 deletions
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..3438af425c 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;
@@ -227,7 +231,7 @@ struct Function
Function *next;
};
-struct Q_QML_EXPORT CompiledFunctionOrExpression
+struct Q_QML_PRIVATE_EXPORT CompiledFunctionOrExpression
{
CompiledFunctionOrExpression()
: node(0)
@@ -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 9260aba98c..1110b3f29d 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1461,7 +1461,8 @@ bool QQmlComponentAndAliasResolver::resolve()
isExplicitComponent = true;
}
if (!isExplicitComponent) {
- findAndRegisterImplicitComponents(obj, cache);
+ if (cache)
+ findAndRegisterImplicitComponents(obj, cache);
continue;
}
@@ -2477,7 +2478,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 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
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index cb87846a3b..0d52fb83fa 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 0ba71e03bf..5d30d6e3b9 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>
@@ -279,12 +281,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;
}
@@ -557,8 +561,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 9dd372b941..398d5d5fa0 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -744,7 +744,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 0308daa34a..84232a9ebb 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>
@@ -3399,8 +3396,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 40ca44dc55..372fe5cdeb 100644
--- a/src/qml/compiler/qv4ssa_p.h
+++ b/src/qml/compiler/qv4ssa_p.h
@@ -136,7 +136,7 @@ public:
}
};
-class Q_QML_EXPORT Optimizer
+class Q_QML_PRIVATE_EXPORT Optimizer
{
Q_DISABLE_COPY(Optimizer)