Cleanup
Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS units it means a slight increase of memory usage by a few bytes, but overall it makes the code a lot simpler. Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
ddb134af99
commit
82fc196252
|
@ -544,7 +544,7 @@ void Document::removeScriptPragmas(QString &script)
|
|||
Document::Document(bool debugMode)
|
||||
: jsModule(debugMode)
|
||||
, program(0)
|
||||
, jsGenerator(&jsModule, sizeof(QV4::CompiledData::QmlUnit))
|
||||
, jsGenerator(&jsModule)
|
||||
, unitFlags(0)
|
||||
, javaScriptCompilationUnit(0)
|
||||
{
|
||||
|
@ -1508,7 +1508,7 @@ bool IRBuilder::isStatementNodeScript(QQmlJS::AST::Statement *statement)
|
|||
return true;
|
||||
}
|
||||
|
||||
QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(Document &output)
|
||||
QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output)
|
||||
{
|
||||
QV4::CompiledData::CompilationUnit *compilationUnit = output.javaScriptCompilationUnit;
|
||||
QV4::CompiledData::Unit *jsUnit = compilationUnit->createUnitData(&output);
|
||||
|
@ -1538,10 +1538,10 @@ QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(Document &output)
|
|||
free(jsUnit);
|
||||
jsUnit = 0;
|
||||
|
||||
QV4::CompiledData::QmlUnit *qmlUnit = reinterpret_cast<QV4::CompiledData::QmlUnit *>(data);
|
||||
qmlUnit->qmlUnitSize = totalSize;
|
||||
qmlUnit->header.flags |= output.unitFlags;
|
||||
qmlUnit->header.flags |= QV4::CompiledData::Unit::IsQml;
|
||||
QV4::CompiledData::Unit *qmlUnit = reinterpret_cast<QV4::CompiledData::Unit *>(data);
|
||||
qmlUnit->unitSize = totalSize;
|
||||
qmlUnit->flags |= output.unitFlags;
|
||||
qmlUnit->flags |= QV4::CompiledData::Unit::IsQml;
|
||||
qmlUnit->offsetToImports = unitSize;
|
||||
qmlUnit->nImports = output.imports.count();
|
||||
qmlUnit->offsetToObjects = unitSize + importSize;
|
||||
|
@ -1633,7 +1633,7 @@ QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(Document &output)
|
|||
// enable flag if we encountered pragma Singleton
|
||||
foreach (Pragma *p, output.pragmas) {
|
||||
if (p->type == Pragma::PragmaSingleton) {
|
||||
qmlUnit->header.flags |= QV4::CompiledData::Unit::IsSingleton;
|
||||
qmlUnit->flags |= QV4::CompiledData::Unit::IsSingleton;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ public:
|
|||
|
||||
struct Q_QML_PRIVATE_EXPORT QmlUnitGenerator
|
||||
{
|
||||
QV4::CompiledData::QmlUnit *generate(Document &output);
|
||||
QV4::CompiledData::Unit *generate(Document &output);
|
||||
|
||||
private:
|
||||
typedef bool (Binding::*BindingFilter)() const;
|
||||
|
|
|
@ -232,17 +232,15 @@ bool QQmlTypeCompiler::compile()
|
|||
// Generate QML compiled type data structures
|
||||
|
||||
QmlIR::QmlUnitGenerator qmlGenerator;
|
||||
QV4::CompiledData::QmlUnit *qmlUnit = qmlGenerator.generate(*document);
|
||||
QV4::CompiledData::Unit *qmlUnit = qmlGenerator.generate(*document);
|
||||
|
||||
Q_ASSERT(document->javaScriptCompilationUnit);
|
||||
Q_ASSERT((void*)qmlUnit == (void*)&qmlUnit->header);
|
||||
// The js unit owns the data and will free the qml unit.
|
||||
document->javaScriptCompilationUnit->data = &qmlUnit->header;
|
||||
document->javaScriptCompilationUnit->data = qmlUnit;
|
||||
|
||||
compiledData->compilationUnit = document->javaScriptCompilationUnit;
|
||||
if (compiledData->compilationUnit)
|
||||
compiledData->compilationUnit->ref();
|
||||
compiledData->qmlUnit = qmlUnit; // ownership transferred to m_compiledData
|
||||
|
||||
// Add to type registry of composites
|
||||
if (compiledData->isCompositeType())
|
||||
|
@ -290,7 +288,7 @@ bool QQmlTypeCompiler::compile()
|
|||
compiledData->totalParserStatusCount = parserStatusCount;
|
||||
compiledData->totalObjectCount = objectCount;
|
||||
|
||||
Q_ASSERT(compiledData->propertyCaches.count() == static_cast<int>(compiledData->qmlUnit->nObjects));
|
||||
Q_ASSERT(compiledData->propertyCaches.count() == static_cast<int>(compiledData->compilationUnit->data->nObjects));
|
||||
|
||||
return errors.isEmpty();
|
||||
}
|
||||
|
@ -317,9 +315,9 @@ QV4::IR::Module *QQmlTypeCompiler::jsIRModule() const
|
|||
return &document->jsModule;
|
||||
}
|
||||
|
||||
const QV4::CompiledData::QmlUnit *QQmlTypeCompiler::qmlUnit() const
|
||||
const QV4::CompiledData::Unit *QQmlTypeCompiler::qmlUnit() const
|
||||
{
|
||||
return compiledData->qmlUnit;
|
||||
return compiledData->compilationUnit->data;
|
||||
}
|
||||
|
||||
const QQmlImports *QQmlTypeCompiler::imports() const
|
||||
|
@ -2035,7 +2033,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
if (binding->flags & QV4::CompiledData::Binding::IsResolvedEnum)
|
||||
return true;
|
||||
|
||||
QString value = binding->valueAsString(&qmlUnit->header);
|
||||
QString value = binding->valueAsString(qmlUnit);
|
||||
QMetaProperty p = propertyCache->firstCppMetaObject()->property(property->coreIndex);
|
||||
bool ok;
|
||||
if (p.isFlagType()) {
|
||||
|
@ -2117,7 +2115,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::Color: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::rgbaFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::rgbaFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: color expected"));
|
||||
return false;
|
||||
|
@ -2127,7 +2125,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
#ifndef QT_NO_DATESTRING
|
||||
case QVariant::Date: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::dateFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::dateFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: date expected"));
|
||||
return false;
|
||||
|
@ -2136,7 +2134,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::Time: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::timeFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::timeFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: time expected"));
|
||||
return false;
|
||||
|
@ -2145,7 +2143,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::DateTime: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::dateTimeFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::dateTimeFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: datetime expected"));
|
||||
return false;
|
||||
|
@ -2155,7 +2153,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
#endif // QT_NO_DATESTRING
|
||||
case QVariant::Point: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::pointFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::pointFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: point expected"));
|
||||
return false;
|
||||
|
@ -2164,7 +2162,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::PointF: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::pointFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::pointFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: point expected"));
|
||||
return false;
|
||||
|
@ -2173,7 +2171,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::Size: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::sizeFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::sizeFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: size expected"));
|
||||
return false;
|
||||
|
@ -2182,7 +2180,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::SizeF: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::sizeFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::sizeFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: size expected"));
|
||||
return false;
|
||||
|
@ -2191,7 +2189,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::Rect: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::rectFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::rectFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: rect expected"));
|
||||
return false;
|
||||
|
@ -2200,7 +2198,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
break;
|
||||
case QVariant::RectF: {
|
||||
bool ok = false;
|
||||
QQmlStringConverters::rectFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QQmlStringConverters::rectFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
if (!ok) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: point expected"));
|
||||
return false;
|
||||
|
@ -2220,7 +2218,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
float yp;
|
||||
float zy;
|
||||
} vec;
|
||||
if (!QQmlStringConverters::createFromString(QMetaType::QVector3D, binding->valueAsString(&qmlUnit->header), &vec, sizeof(vec))) {
|
||||
if (!QQmlStringConverters::createFromString(QMetaType::QVector3D, binding->valueAsString(qmlUnit), &vec, sizeof(vec))) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: 3D vector expected"));
|
||||
return false;
|
||||
}
|
||||
|
@ -2233,7 +2231,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
|
|||
float zy;
|
||||
float wp;
|
||||
} vec;
|
||||
if (!QQmlStringConverters::createFromString(QMetaType::QVector4D, binding->valueAsString(&qmlUnit->header), &vec, sizeof(vec))) {
|
||||
if (!QQmlStringConverters::createFromString(QMetaType::QVector4D, binding->valueAsString(qmlUnit), &vec, sizeof(vec))) {
|
||||
recordError(binding->valueLocation, tr("Invalid property assignment: 4D vector expected"));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
QV4::IR::Module *jsIRModule() const;
|
||||
|
||||
const QV4::CompiledData::QmlUnit *qmlUnit() const;
|
||||
const QV4::CompiledData::Unit *qmlUnit() const;
|
||||
|
||||
QUrl url() const { return typeData->finalUrl(); }
|
||||
QQmlEnginePrivate *enginePrivate() const { return engine; }
|
||||
|
@ -293,7 +293,7 @@ private:
|
|||
bool canCoerce(int to, QQmlPropertyCache *fromMo);
|
||||
|
||||
QQmlEnginePrivate *enginePrivate;
|
||||
const QV4::CompiledData::QmlUnit *qmlUnit;
|
||||
const QV4::CompiledData::Unit *qmlUnit;
|
||||
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
|
||||
const QHash<int, QQmlCustomParser*> &customParsers;
|
||||
const QVector<QQmlPropertyCache *> &propertyCaches;
|
||||
|
|
|
@ -68,6 +68,7 @@ struct String;
|
|||
struct Function;
|
||||
struct Lookup;
|
||||
struct RegExp;
|
||||
struct Unit;
|
||||
|
||||
#if defined(Q_CC_MSVC) || defined(Q_CC_GNU)
|
||||
#pragma pack(push, 1)
|
||||
|
@ -140,85 +141,6 @@ struct String
|
|||
}
|
||||
};
|
||||
|
||||
static const char magic_str[] = "qv4cdata";
|
||||
|
||||
struct Unit
|
||||
{
|
||||
char magic[8];
|
||||
qint16 architecture;
|
||||
qint16 version;
|
||||
quint32 unitSize; // Size of the Unit and any depending data. Does _not_ include size of data needed by QmlUnit.
|
||||
|
||||
enum {
|
||||
IsJavascript = 0x1,
|
||||
IsQml = 0x2,
|
||||
StaticData = 0x4, // Unit data persistent in memory?
|
||||
IsSingleton = 0x8,
|
||||
IsSharedLibrary = 0x10 // .pragma shared?
|
||||
};
|
||||
quint32 flags;
|
||||
uint stringTableSize;
|
||||
uint offsetToStringTable;
|
||||
uint functionTableSize;
|
||||
uint offsetToFunctionTable;
|
||||
uint lookupTableSize;
|
||||
uint offsetToLookupTable;
|
||||
uint regexpTableSize;
|
||||
uint offsetToRegexpTable;
|
||||
uint constantTableSize;
|
||||
uint offsetToConstantTable;
|
||||
uint jsClassTableSize;
|
||||
uint offsetToJSClassTable;
|
||||
qint32 indexOfRootFunction;
|
||||
quint32 sourceFileIndex;
|
||||
|
||||
QString stringAt(int idx) const {
|
||||
const uint *offsetTable = reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
|
||||
const uint offset = offsetTable[idx];
|
||||
const String *str = reinterpret_cast<const String*>(reinterpret_cast<const char *>(this) + offset);
|
||||
if (str->size == 0)
|
||||
return QString();
|
||||
const QChar *characters = reinterpret_cast<const QChar *>(str + 1);
|
||||
if (flags & StaticData)
|
||||
return QString::fromRawData(characters, str->size);
|
||||
return QString(characters, str->size);
|
||||
}
|
||||
|
||||
const uint *functionOffsetTable() const { return reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); }
|
||||
|
||||
const Function *functionAt(int idx) const {
|
||||
const uint *offsetTable = functionOffsetTable();
|
||||
const uint offset = offsetTable[idx];
|
||||
return reinterpret_cast<const Function*>(reinterpret_cast<const char *>(this) + offset);
|
||||
}
|
||||
|
||||
const Lookup *lookupTable() const { return reinterpret_cast<const Lookup*>(reinterpret_cast<const char *>(this) + offsetToLookupTable); }
|
||||
const RegExp *regexpAt(int index) const {
|
||||
return reinterpret_cast<const RegExp*>(reinterpret_cast<const char *>(this) + offsetToRegexpTable + index * sizeof(RegExp));
|
||||
}
|
||||
const QV4::Value *constants() const {
|
||||
return reinterpret_cast<const QV4::Value*>(reinterpret_cast<const char *>(this) + offsetToConstantTable);
|
||||
}
|
||||
|
||||
const JSClassMember *jsClassAt(int idx, int *nMembers) const {
|
||||
const uint *offsetTable = reinterpret_cast<const uint *>(reinterpret_cast<const char *>(this) + offsetToJSClassTable);
|
||||
const uint offset = offsetTable[idx];
|
||||
const char *ptr = reinterpret_cast<const char *>(this) + offset;
|
||||
const JSClass *klass = reinterpret_cast<const JSClass *>(ptr);
|
||||
*nMembers = klass->nMembers;
|
||||
return reinterpret_cast<const JSClassMember*>(ptr + sizeof(JSClass));
|
||||
}
|
||||
|
||||
static int calculateSize(uint headerSize, uint nFunctions, uint nRegExps, uint nConstants,
|
||||
uint nLookups, uint nClasses) {
|
||||
return (headerSize
|
||||
+ (nFunctions + nClasses) * sizeof(uint)
|
||||
+ nRegExps * RegExp::calculateSize()
|
||||
+ nConstants * sizeof(QV4::ReturnedValue)
|
||||
+ nLookups * Lookup::calculateSize()
|
||||
+ 7) & ~7; }
|
||||
};
|
||||
|
||||
struct Function
|
||||
{
|
||||
enum Flags {
|
||||
|
@ -509,10 +431,39 @@ struct Import
|
|||
Import(): type(0), uriIndex(0), qualifierIndex(0), majorVersion(0), minorVersion(0) {}
|
||||
};
|
||||
|
||||
struct QmlUnit
|
||||
static const char magic_str[] = "qv4cdata";
|
||||
|
||||
struct Unit
|
||||
{
|
||||
Unit header;
|
||||
quint32 qmlUnitSize; // size including header and all surrounding data.
|
||||
char magic[8];
|
||||
qint16 architecture;
|
||||
qint16 version;
|
||||
quint32 unitSize; // Size of the Unit and any depending data.
|
||||
|
||||
enum {
|
||||
IsJavascript = 0x1,
|
||||
IsQml = 0x2,
|
||||
StaticData = 0x4, // Unit data persistent in memory?
|
||||
IsSingleton = 0x8,
|
||||
IsSharedLibrary = 0x10 // .pragma shared?
|
||||
};
|
||||
quint32 flags;
|
||||
uint stringTableSize;
|
||||
uint offsetToStringTable;
|
||||
uint functionTableSize;
|
||||
uint offsetToFunctionTable;
|
||||
uint lookupTableSize;
|
||||
uint offsetToLookupTable;
|
||||
uint regexpTableSize;
|
||||
uint offsetToRegexpTable;
|
||||
uint constantTableSize;
|
||||
uint offsetToConstantTable;
|
||||
uint jsClassTableSize;
|
||||
uint offsetToJSClassTable;
|
||||
qint32 indexOfRootFunction;
|
||||
quint32 sourceFileIndex;
|
||||
|
||||
/* QML specific fields */
|
||||
quint32 nImports;
|
||||
quint32 offsetToImports;
|
||||
quint32 nObjects;
|
||||
|
@ -530,8 +481,55 @@ struct QmlUnit
|
|||
}
|
||||
|
||||
bool isSingleton() const {
|
||||
return header.flags & Unit::IsSingleton;
|
||||
return flags & Unit::IsSingleton;
|
||||
}
|
||||
/* end QML specific fields*/
|
||||
|
||||
QString stringAt(int idx) const {
|
||||
const uint *offsetTable = reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
|
||||
const uint offset = offsetTable[idx];
|
||||
const String *str = reinterpret_cast<const String*>(reinterpret_cast<const char *>(this) + offset);
|
||||
if (str->size == 0)
|
||||
return QString();
|
||||
const QChar *characters = reinterpret_cast<const QChar *>(str + 1);
|
||||
if (flags & StaticData)
|
||||
return QString::fromRawData(characters, str->size);
|
||||
return QString(characters, str->size);
|
||||
}
|
||||
|
||||
const uint *functionOffsetTable() const { return reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); }
|
||||
|
||||
const Function *functionAt(int idx) const {
|
||||
const uint *offsetTable = functionOffsetTable();
|
||||
const uint offset = offsetTable[idx];
|
||||
return reinterpret_cast<const Function*>(reinterpret_cast<const char *>(this) + offset);
|
||||
}
|
||||
|
||||
const Lookup *lookupTable() const { return reinterpret_cast<const Lookup*>(reinterpret_cast<const char *>(this) + offsetToLookupTable); }
|
||||
const RegExp *regexpAt(int index) const {
|
||||
return reinterpret_cast<const RegExp*>(reinterpret_cast<const char *>(this) + offsetToRegexpTable + index * sizeof(RegExp));
|
||||
}
|
||||
const QV4::Value *constants() const {
|
||||
return reinterpret_cast<const QV4::Value*>(reinterpret_cast<const char *>(this) + offsetToConstantTable);
|
||||
}
|
||||
|
||||
const JSClassMember *jsClassAt(int idx, int *nMembers) const {
|
||||
const uint *offsetTable = reinterpret_cast<const uint *>(reinterpret_cast<const char *>(this) + offsetToJSClassTable);
|
||||
const uint offset = offsetTable[idx];
|
||||
const char *ptr = reinterpret_cast<const char *>(this) + offset;
|
||||
const JSClass *klass = reinterpret_cast<const JSClass *>(ptr);
|
||||
*nMembers = klass->nMembers;
|
||||
return reinterpret_cast<const JSClassMember*>(ptr + sizeof(JSClass));
|
||||
}
|
||||
|
||||
static int calculateSize(uint nFunctions, uint nRegExps, uint nConstants,
|
||||
uint nLookups, uint nClasses) {
|
||||
return (sizeof(Unit)
|
||||
+ (nFunctions + nClasses) * sizeof(uint)
|
||||
+ nRegExps * RegExp::calculateSize()
|
||||
+ nConstants * sizeof(QV4::ReturnedValue)
|
||||
+ nLookups * Lookup::calculateSize()
|
||||
+ 7) & ~7; }
|
||||
};
|
||||
|
||||
#if defined(Q_CC_MSVC) || defined(Q_CC_GNU)
|
||||
|
|
|
@ -89,13 +89,10 @@ void QV4::Compiler::StringTableGenerator::serialize(uint *stringTable, char *dat
|
|||
}
|
||||
}
|
||||
|
||||
QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QV4::IR::Module *module, int headerSize)
|
||||
QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QV4::IR::Module *module)
|
||||
: irModule(module)
|
||||
, jsClassDataSize(0)
|
||||
{
|
||||
if (headerSize == -1)
|
||||
headerSize = sizeof(QV4::CompiledData::Unit);
|
||||
this->headerSize = headerSize;
|
||||
// Make sure the empty string always gets index 0
|
||||
registerString(QString());
|
||||
}
|
||||
|
@ -212,7 +209,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit()
|
|||
registerString(*f->locals.at(i));
|
||||
}
|
||||
|
||||
int unitSize = QV4::CompiledData::Unit::calculateSize(headerSize, irModule->functions.size(), regexps.size(),
|
||||
int unitSize = QV4::CompiledData::Unit::calculateSize(irModule->functions.size(), regexps.size(),
|
||||
constants.size(), lookups.size(), jsClasses.count());
|
||||
|
||||
uint functionDataSize = 0;
|
||||
|
@ -236,7 +233,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit()
|
|||
unit->version = 1;
|
||||
unit->unitSize = totalSize;
|
||||
unit->functionTableSize = irModule->functions.size();
|
||||
unit->offsetToFunctionTable = headerSize;
|
||||
unit->offsetToFunctionTable = sizeof(*unit);
|
||||
unit->lookupTableSize = lookups.count();
|
||||
unit->offsetToLookupTable = unit->offsetToFunctionTable + unit->functionTableSize * sizeof(uint);
|
||||
unit->regexpTableSize = regexps.size();
|
||||
|
@ -249,6 +246,11 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit()
|
|||
unit->offsetToStringTable = unitSize + functionDataSize + jsClassDataSize;
|
||||
unit->indexOfRootFunction = -1;
|
||||
unit->sourceFileIndex = getStringId(irModule->fileName);
|
||||
unit->nImports = 0;
|
||||
unit->offsetToImports = 0;
|
||||
unit->nObjects = 0;
|
||||
unit->offsetToObjects = 0;
|
||||
unit->indexOfRootObject = 0;
|
||||
|
||||
uint *functionTable = (uint *)(data + unit->offsetToFunctionTable);
|
||||
for (int i = 0; i < irModule->functions.size(); ++i)
|
||||
|
|
|
@ -80,7 +80,7 @@ private:
|
|||
};
|
||||
|
||||
struct Q_QML_PRIVATE_EXPORT JSUnitGenerator {
|
||||
JSUnitGenerator(IR::Module *module, int headerSize = -1);
|
||||
JSUnitGenerator(IR::Module *module);
|
||||
|
||||
int registerString(const QString &str) { return stringTable.registerString(str); }
|
||||
int getStringId(const QString &string) const { return stringTable.getStringId(string); }
|
||||
|
@ -112,7 +112,6 @@ private:
|
|||
QVector<ReturnedValue> constants;
|
||||
QList<QList<CompiledData::JSClassMember> > jsClasses;
|
||||
uint jsClassDataSize;
|
||||
uint headerSize;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
QQmlCompiledData::QQmlCompiledData(QQmlEngine *engine)
|
||||
: engine(engine), importCache(0), metaTypeId(-1), listMetaTypeId(-1), isRegisteredWithEngine(false),
|
||||
rootPropertyCache(0), compilationUnit(0), qmlUnit(0), totalBindingsCount(0), totalParserStatusCount(0)
|
||||
rootPropertyCache(0), compilationUnit(0), totalBindingsCount(0), totalParserStatusCount(0)
|
||||
{
|
||||
Q_ASSERT(engine);
|
||||
}
|
||||
|
@ -101,8 +101,6 @@ QQmlCompiledData::~QQmlCompiledData()
|
|||
if (rootPropertyCache)
|
||||
rootPropertyCache->release();
|
||||
|
||||
qmlUnit = 0;
|
||||
|
||||
if (compilationUnit)
|
||||
compilationUnit->deref();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
|
|||
namespace QV4 {
|
||||
namespace CompiledData {
|
||||
struct CompilationUnit;
|
||||
struct QmlUnit;
|
||||
struct Unit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,6 @@ public:
|
|||
QList<QQmlScriptData *> scripts;
|
||||
|
||||
QV4::CompiledData::CompilationUnit *compilationUnit;
|
||||
QV4::CompiledData::QmlUnit *qmlUnit;
|
||||
// index in first hash is component index, hash inside maps from object index in that scope to integer id
|
||||
QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
|
||||
QHash<int, int> objectIndexToIdForRoot;
|
||||
|
@ -144,7 +143,7 @@ public:
|
|||
int totalObjectCount; // Number of objects explicitly instantiated
|
||||
|
||||
bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
|
||||
bool isCompositeType() const { return !metaObjects.at(qmlUnit->indexOfRootObject).isEmpty(); }
|
||||
bool isCompositeType() const { return !metaObjects.at(compilationUnit->data->indexOfRootObject).isEmpty(); }
|
||||
|
||||
bool isInitialized() const { return hasEngine(); }
|
||||
void initialize(QQmlEngine *);
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
void clearErrors();
|
||||
Flags flags() const { return m_flags; }
|
||||
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *, const QList<const QV4::CompiledData::Binding *> &) = 0;
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *, const QList<const QV4::CompiledData::Binding *> &) = 0;
|
||||
virtual void applyBindings(QObject *, QQmlCompiledData *, const QList<const QV4::CompiledData::Binding *> &) = 0;
|
||||
|
||||
QList<QQmlError> errors() const { return exceptions; }
|
||||
|
|
|
@ -127,7 +127,7 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext)
|
|||
if (!compiledData->isInitialized())
|
||||
compiledData->initialize(engine);
|
||||
|
||||
qmlUnit = compiledData->qmlUnit;
|
||||
qmlUnit = compiledData->compilationUnit->data;
|
||||
context = 0;
|
||||
_qobject = 0;
|
||||
_scopeObject = 0;
|
||||
|
@ -323,7 +323,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
propertyType = QMetaType::Int;
|
||||
} else {
|
||||
// ### This should be resolved earlier at compile time and the binding value should be changed accordingly.
|
||||
QVariant value = binding->valueAsString(&qmlUnit->header);
|
||||
QVariant value = binding->valueAsString(qmlUnit);
|
||||
bool ok = QQmlPropertyPrivate::write(_qobject, *property, value, context);
|
||||
Q_ASSERT(ok);
|
||||
Q_UNUSED(ok);
|
||||
|
@ -362,7 +362,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
}
|
||||
} else {
|
||||
QString stringValue = binding->valueAsString(&qmlUnit->header);
|
||||
QString stringValue = binding->valueAsString(qmlUnit);
|
||||
if (property->isVarProperty()) {
|
||||
QV4::ScopedString s(scope, v4->newString(stringValue));
|
||||
_vmeMetaObject->setVMEProperty(property->coreIndex, s);
|
||||
|
@ -376,28 +376,28 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::String: {
|
||||
Q_ASSERT(binding->evaluatesToString());
|
||||
QString value = binding->valueAsString(&qmlUnit->header);
|
||||
QString value = binding->valueAsString(qmlUnit);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
}
|
||||
break;
|
||||
case QVariant::StringList: {
|
||||
Q_ASSERT(binding->evaluatesToString());
|
||||
QStringList value(binding->valueAsString(&qmlUnit->header));
|
||||
QStringList value(binding->valueAsString(qmlUnit));
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
}
|
||||
break;
|
||||
case QVariant::ByteArray: {
|
||||
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String);
|
||||
QByteArray value(binding->valueAsString(&qmlUnit->header).toUtf8());
|
||||
QByteArray value(binding->valueAsString(qmlUnit).toUtf8());
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
}
|
||||
break;
|
||||
case QVariant::Url: {
|
||||
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String);
|
||||
QString string = binding->valueAsString(&qmlUnit->header);
|
||||
QString string = binding->valueAsString(qmlUnit);
|
||||
// Encoded dir-separators defeat QUrl processing - decode them first
|
||||
string.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive);
|
||||
QUrl value = string.isEmpty() ? QUrl() : compiledData->url().resolved(QUrl(string));
|
||||
|
@ -442,7 +442,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::Color: {
|
||||
bool ok = false;
|
||||
uint colorValue = QQmlStringConverters::rgbaFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
uint colorValue = QQmlStringConverters::rgbaFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
Q_ASSERT(ok);
|
||||
struct { void *data[4]; } buffer;
|
||||
if (QQml_valueTypeProvider()->storeValueType(property->propType, &colorValue, &buffer, sizeof(buffer))) {
|
||||
|
@ -454,7 +454,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
#ifndef QT_NO_DATESTRING
|
||||
case QVariant::Date: {
|
||||
bool ok = false;
|
||||
QDate value = QQmlStringConverters::dateFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QDate value = QQmlStringConverters::dateFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -462,7 +462,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::Time: {
|
||||
bool ok = false;
|
||||
QTime value = QQmlStringConverters::timeFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QTime value = QQmlStringConverters::timeFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -470,7 +470,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::DateTime: {
|
||||
bool ok = false;
|
||||
QDateTime value = QQmlStringConverters::dateTimeFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QDateTime value = QQmlStringConverters::dateTimeFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
// ### VME compatibility :(
|
||||
{
|
||||
const qint64 date = value.date().toJulianDay();
|
||||
|
@ -485,7 +485,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
#endif // QT_NO_DATESTRING
|
||||
case QVariant::Point: {
|
||||
bool ok = false;
|
||||
QPoint value = QQmlStringConverters::pointFFromString(binding->valueAsString(&qmlUnit->header), &ok).toPoint();
|
||||
QPoint value = QQmlStringConverters::pointFFromString(binding->valueAsString(qmlUnit), &ok).toPoint();
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -493,7 +493,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::PointF: {
|
||||
bool ok = false;
|
||||
QPointF value = QQmlStringConverters::pointFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QPointF value = QQmlStringConverters::pointFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -501,7 +501,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::Size: {
|
||||
bool ok = false;
|
||||
QSize value = QQmlStringConverters::sizeFFromString(binding->valueAsString(&qmlUnit->header), &ok).toSize();
|
||||
QSize value = QQmlStringConverters::sizeFFromString(binding->valueAsString(qmlUnit), &ok).toSize();
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -509,7 +509,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::SizeF: {
|
||||
bool ok = false;
|
||||
QSizeF value = QQmlStringConverters::sizeFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QSizeF value = QQmlStringConverters::sizeFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -517,7 +517,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::Rect: {
|
||||
bool ok = false;
|
||||
QRect value = QQmlStringConverters::rectFFromString(binding->valueAsString(&qmlUnit->header), &ok).toRect();
|
||||
QRect value = QQmlStringConverters::rectFFromString(binding->valueAsString(qmlUnit), &ok).toRect();
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -525,7 +525,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
case QVariant::RectF: {
|
||||
bool ok = false;
|
||||
QRectF value = QQmlStringConverters::rectFFromString(binding->valueAsString(&qmlUnit->header), &ok);
|
||||
QRectF value = QQmlStringConverters::rectFFromString(binding->valueAsString(qmlUnit), &ok);
|
||||
Q_ASSERT(ok);
|
||||
argv[0] = &value;
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -544,7 +544,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
float yp;
|
||||
float zy;
|
||||
} vec;
|
||||
bool ok = QQmlStringConverters::createFromString(QMetaType::QVector3D, binding->valueAsString(&qmlUnit->header), &vec, sizeof(vec));
|
||||
bool ok = QQmlStringConverters::createFromString(QMetaType::QVector3D, binding->valueAsString(qmlUnit), &vec, sizeof(vec));
|
||||
Q_ASSERT(ok);
|
||||
Q_UNUSED(ok);
|
||||
argv[0] = reinterpret_cast<void *>(&vec);
|
||||
|
@ -558,7 +558,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
float zy;
|
||||
float wp;
|
||||
} vec;
|
||||
bool ok = QQmlStringConverters::createFromString(QMetaType::QVector4D, binding->valueAsString(&qmlUnit->header), &vec, sizeof(vec));
|
||||
bool ok = QQmlStringConverters::createFromString(QMetaType::QVector4D, binding->valueAsString(qmlUnit), &vec, sizeof(vec));
|
||||
Q_ASSERT(ok);
|
||||
Q_UNUSED(ok);
|
||||
argv[0] = reinterpret_cast<void *>(&vec);
|
||||
|
@ -594,7 +594,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
break;
|
||||
} else if (property->propType == qMetaTypeId<QList<QUrl> >()) {
|
||||
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String);
|
||||
QString urlString = binding->valueAsString(&qmlUnit->header);
|
||||
QString urlString = binding->valueAsString(qmlUnit);
|
||||
QUrl u = urlString.isEmpty() ? QUrl() : compiledData->url().resolved(QUrl(urlString));
|
||||
QList<QUrl> value;
|
||||
value.append(u);
|
||||
|
@ -604,7 +604,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
} else if (property->propType == qMetaTypeId<QList<QString> >()) {
|
||||
Q_ASSERT(binding->evaluatesToString());
|
||||
QList<QString> value;
|
||||
value.append(binding->valueAsString(&qmlUnit->header));
|
||||
value.append(binding->valueAsString(qmlUnit));
|
||||
argv[0] = reinterpret_cast<void *>(&value);
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
break;
|
||||
|
@ -619,7 +619,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
} else
|
||||
value = QJSValue(n);
|
||||
} else {
|
||||
value = QJSValue(binding->valueAsString(&qmlUnit->header));
|
||||
value = QJSValue(binding->valueAsString(qmlUnit));
|
||||
}
|
||||
argv[0] = reinterpret_cast<void *>(&value);
|
||||
QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex, argv);
|
||||
|
@ -627,7 +627,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
|
|||
}
|
||||
|
||||
// otherwise, try a custom type assignment
|
||||
QString stringValue = binding->valueAsString(&qmlUnit->header);
|
||||
QString stringValue = binding->valueAsString(qmlUnit);
|
||||
QQmlMetaType::StringConverter converter = QQmlMetaType::customStringConverter(property->propType);
|
||||
Q_ASSERT(converter);
|
||||
QVariant value = (*converter)(stringValue);
|
||||
|
@ -760,7 +760,7 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
|
|||
|
||||
// ### resolve this at compile time
|
||||
if (property && property->propType == qMetaTypeId<QQmlScriptString>()) {
|
||||
QQmlScriptString ss(binding->valueAsScriptString(&qmlUnit->header), context->asQQmlContext(), _scopeObject);
|
||||
QQmlScriptString ss(binding->valueAsScriptString(qmlUnit), context->asQQmlContext(), _scopeObject);
|
||||
ss.d.data()->bindingId = binding->value.compiledScriptIndex;
|
||||
ss.d.data()->lineNumber = binding->location.line;
|
||||
ss.d.data()->columnNumber = binding->location.column;
|
||||
|
@ -1081,7 +1081,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
|
|||
Q_ASSERT(typeRef->component);
|
||||
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(typeRef->component->fileName(),
|
||||
context->url, obj->location.line, obj->location.column));
|
||||
if (typeRef->component->qmlUnit->isSingleton())
|
||||
if (typeRef->component->compilationUnit->data->isSingleton())
|
||||
{
|
||||
recordError(obj->location, tr("Composite Singleton Type %1 is not creatable").arg(stringAt(obj->inheritedTypeNameIndex)));
|
||||
return 0;
|
||||
|
|
|
@ -108,7 +108,7 @@ private:
|
|||
void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
|
||||
void setupFunctions();
|
||||
|
||||
QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); }
|
||||
QString stringAt(int idx) const { return qmlUnit->stringAt(idx); }
|
||||
void recordError(const QV4::CompiledData::Location &location, const QString &description);
|
||||
|
||||
enum Phase {
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
|
||||
QQmlEngine *engine;
|
||||
QQmlCompiledData *compiledData;
|
||||
const QV4::CompiledData::QmlUnit *qmlUnit;
|
||||
const QV4::CompiledData::Unit *qmlUnit;
|
||||
QQmlContextData *parentContext;
|
||||
QQmlContextData *context;
|
||||
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
|
||||
|
|
|
@ -68,7 +68,7 @@ struct CachedQmlUnit;
|
|||
namespace QV4 {
|
||||
struct ExecutionEngine;
|
||||
namespace CompiledData {
|
||||
struct QmlUnit;
|
||||
struct Unit;
|
||||
struct CompilationUnit;
|
||||
}
|
||||
typedef CompiledData::CompilationUnit *(*CompilationUnitFactoryFunction)();
|
||||
|
@ -285,7 +285,7 @@ namespace QQmlPrivate
|
|||
};
|
||||
|
||||
struct CachedQmlUnit {
|
||||
const QV4::CompiledData::QmlUnit *qmlData;
|
||||
const QV4::CompiledData::Unit *qmlData;
|
||||
QV4::CompilationUnitFactoryFunction createCompilationUnit;
|
||||
QmlIR::IRLoaderFunction loadIR;
|
||||
};
|
||||
|
|
|
@ -2715,11 +2715,10 @@ void QQmlScriptBlob::dataReceived(const Data &data)
|
|||
irUnit.javaScriptCompilationUnit = unit;
|
||||
|
||||
QmlIR::QmlUnitGenerator qmlGenerator;
|
||||
QV4::CompiledData::QmlUnit *qmlUnit = qmlGenerator.generate(irUnit);
|
||||
QV4::CompiledData::Unit *unitData = qmlGenerator.generate(irUnit);
|
||||
Q_ASSERT(!unit->data);
|
||||
Q_ASSERT((void*)qmlUnit == (void*)&qmlUnit->header);
|
||||
// The js unit owns the data and will free the qml unit.
|
||||
unit->data = &qmlUnit->header;
|
||||
unit->data = unitData;
|
||||
|
||||
initializeFromCompilationUnit(unit);
|
||||
unit->deref();
|
||||
|
@ -2801,7 +2800,7 @@ void QQmlScriptBlob::initializeFromCompilationUnit(QV4::CompiledData::Compilatio
|
|||
m_importCache.setBaseUrl(finalUrl(), finalUrlString());
|
||||
|
||||
Q_ASSERT(m_scriptData->m_precompiledScript->data->flags & QV4::CompiledData::Unit::IsQml);
|
||||
const QV4::CompiledData::QmlUnit *qmlUnit = reinterpret_cast<const QV4::CompiledData::QmlUnit*>(m_scriptData->m_precompiledScript->data);
|
||||
const QV4::CompiledData::Unit *qmlUnit = m_scriptData->m_precompiledScript->data;
|
||||
|
||||
QList<QQmlError> errors;
|
||||
for (quint32 i = 0; i < qmlUnit->nImports; ++i) {
|
||||
|
|
|
@ -205,11 +205,11 @@ void QQmlConnections::setIgnoreUnknownSignals(bool ignore)
|
|||
d->ignoreUnknownSignals = ignore;
|
||||
}
|
||||
|
||||
void QQmlConnectionsParser::verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
|
||||
void QQmlConnectionsParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
|
||||
{
|
||||
for (int ii = 0; ii < props.count(); ++ii) {
|
||||
const QV4::CompiledData::Binding *binding = props.at(ii);
|
||||
QString propName = qmlUnit->header.stringAt(binding->propertyNameIndex);
|
||||
QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
|
||||
|
||||
if (!propName.startsWith(QLatin1String("on")) || !propName.at(2).isUpper()) {
|
||||
error(props.at(ii), QQmlConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
|
||||
|
@ -219,7 +219,7 @@ void QQmlConnectionsParser::verifyBindings(const QV4::CompiledData::QmlUnit *qml
|
|||
|
||||
if (binding->type >= QV4::CompiledData::Binding::Type_Object) {
|
||||
const QV4::CompiledData::Object *target = qmlUnit->objectAt(binding->value.objectIndex);
|
||||
if (!qmlUnit->header.stringAt(target->inheritedTypeNameIndex).isEmpty())
|
||||
if (!qmlUnit->stringAt(target->inheritedTypeNameIndex).isEmpty())
|
||||
error(binding, QQmlConnections::tr("Connections: nested objects not allowed"));
|
||||
else
|
||||
error(binding, QQmlConnections::tr("Connections: syntax error"));
|
||||
|
@ -251,10 +251,10 @@ void QQmlConnections::connectSignals()
|
|||
QQmlData *ddata = QQmlData::get(this);
|
||||
QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0;
|
||||
|
||||
const QV4::CompiledData::QmlUnit *qmlUnit = d->cdata->qmlUnit;
|
||||
const QV4::CompiledData::Unit *qmlUnit = d->cdata->compilationUnit->data;
|
||||
foreach (const QV4::CompiledData::Binding *binding, d->bindings) {
|
||||
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script);
|
||||
QString propName = qmlUnit->header.stringAt(binding->propertyNameIndex);
|
||||
QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
|
||||
|
||||
QQmlProperty prop(target, propName);
|
||||
if (prop.isValid() && (prop.type() & QQmlProperty::SignalProperty)) {
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
class QQmlConnectionsParser : public QQmlCustomParser
|
||||
{
|
||||
public:
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
|
||||
virtual void applyBindings(QObject *object, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings);
|
||||
};
|
||||
|
||||
|
|
|
@ -2285,12 +2285,12 @@ void QQmlListModel::sync()
|
|||
qmlInfo(this) << "List sync() can only be called from a WorkerScript";
|
||||
}
|
||||
|
||||
bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
||||
bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
||||
{
|
||||
if (binding->type >= QV4::CompiledData::Binding::Type_Object) {
|
||||
const quint32 targetObjectIndex = binding->value.objectIndex;
|
||||
const QV4::CompiledData::Object *target = qmlUnit->objectAt(targetObjectIndex);
|
||||
QString objName = qmlUnit->header.stringAt(target->inheritedTypeNameIndex);
|
||||
QString objName = qmlUnit->stringAt(target->inheritedTypeNameIndex);
|
||||
if (objName != listElementTypeName) {
|
||||
const QMetaObject *mo = resolveType(objName);
|
||||
if (mo != &QQmlListElement::staticMetaObject) {
|
||||
|
@ -2300,14 +2300,14 @@ bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::QmlUnit *qmlUn
|
|||
listElementTypeName = objName; // cache right name for next time
|
||||
}
|
||||
|
||||
if (!qmlUnit->header.stringAt(target->idIndex).isEmpty()) {
|
||||
if (!qmlUnit->stringAt(target->idIndex).isEmpty()) {
|
||||
error(target->locationOfIdProperty, QQmlListModel::tr("ListElement: cannot use reserved \"id\" property"));
|
||||
return false;
|
||||
}
|
||||
|
||||
const QV4::CompiledData::Binding *binding = target->bindingTable();
|
||||
for (quint32 i = 0; i < target->nBindings; ++i, ++binding) {
|
||||
QString propName = qmlUnit->header.stringAt(binding->propertyNameIndex);
|
||||
QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
|
||||
if (propName.isEmpty()) {
|
||||
error(binding, QQmlListModel::tr("ListElement: cannot contain nested elements"));
|
||||
return false;
|
||||
|
@ -2316,7 +2316,7 @@ bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::QmlUnit *qmlUn
|
|||
return false;
|
||||
}
|
||||
} else if (binding->type == QV4::CompiledData::Binding::Type_Script) {
|
||||
QString scriptStr = binding->valueAsScriptString(&qmlUnit->header);
|
||||
QString scriptStr = binding->valueAsScriptString(qmlUnit);
|
||||
if (!definesEmptyList(scriptStr)) {
|
||||
QByteArray script = scriptStr.toUtf8();
|
||||
bool ok;
|
||||
|
@ -2331,9 +2331,9 @@ bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::QmlUnit *qmlUn
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QQmlListModelParser::applyProperty(const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding, ListModel *model, int outterElementIndex)
|
||||
bool QQmlListModelParser::applyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding, ListModel *model, int outterElementIndex)
|
||||
{
|
||||
const QString elementName = qmlUnit->header.stringAt(binding->propertyNameIndex);
|
||||
const QString elementName = qmlUnit->stringAt(binding->propertyNameIndex);
|
||||
|
||||
bool roleSet = false;
|
||||
if (binding->type >= QV4::CompiledData::Binding::Type_Object) {
|
||||
|
@ -2366,13 +2366,13 @@ bool QQmlListModelParser::applyProperty(const QV4::CompiledData::QmlUnit *qmlUni
|
|||
QVariant value;
|
||||
|
||||
if (binding->evaluatesToString()) {
|
||||
value = binding->valueAsString(&qmlUnit->header);
|
||||
value = binding->valueAsString(qmlUnit);
|
||||
} else if (binding->type == QV4::CompiledData::Binding::Type_Number) {
|
||||
value = binding->valueAsNumber();
|
||||
} else if (binding->type == QV4::CompiledData::Binding::Type_Boolean) {
|
||||
value = binding->valueAsBoolean();
|
||||
} else if (binding->type == QV4::CompiledData::Binding::Type_Script) {
|
||||
QString scriptStr = binding->valueAsScriptString(&qmlUnit->header);
|
||||
QString scriptStr = binding->valueAsScriptString(qmlUnit);
|
||||
if (definesEmptyList(scriptStr)) {
|
||||
const ListLayout::Role &role = model->getOrCreateListRole(elementName);
|
||||
ListModel *emptyModel = new ListModel(role.subLayout, 0, -1);
|
||||
|
@ -2392,12 +2392,12 @@ bool QQmlListModelParser::applyProperty(const QV4::CompiledData::QmlUnit *qmlUni
|
|||
return roleSet;
|
||||
}
|
||||
|
||||
void QQmlListModelParser::verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
||||
void QQmlListModelParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
||||
{
|
||||
listElementTypeName = QString(); // unknown
|
||||
|
||||
foreach (const QV4::CompiledData::Binding *binding, bindings) {
|
||||
QString propName = qmlUnit->header.stringAt(binding->propertyNameIndex);
|
||||
QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
|
||||
if (!propName.isEmpty()) { // isn't default property
|
||||
error(binding, QQmlListModel::tr("ListModel: undefined property '%1'").arg(propName));
|
||||
return;
|
||||
|
@ -2414,7 +2414,7 @@ void QQmlListModelParser::applyBindings(QObject *obj, QQmlCompiledData *cdata, c
|
|||
QV8Engine *engine = QQmlEnginePrivate::getV8Engine(qmlEngine(rv));
|
||||
rv->m_engine = engine;
|
||||
|
||||
const QV4::CompiledData::QmlUnit *qmlUnit = cdata->qmlUnit;
|
||||
const QV4::CompiledData::Unit *qmlUnit = cdata->compilationUnit->data;
|
||||
|
||||
bool setRoles = false;
|
||||
|
||||
|
|
|
@ -172,13 +172,13 @@ public:
|
|||
|
||||
QQmlListModelParser() : QQmlCustomParser(QQmlCustomParser::AcceptsSignalHandlers) {}
|
||||
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings);
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings);
|
||||
virtual void applyBindings(QObject *obj, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings);
|
||||
|
||||
private:
|
||||
bool verifyProperty(const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
||||
bool verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
||||
// returns true if a role was set
|
||||
bool applyProperty(const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding, ListModel *model, int outterElementIndex);
|
||||
bool applyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding, ListModel *model, int outterElementIndex);
|
||||
|
||||
bool definesEmptyList(const QString &);
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ public:
|
|||
bool isExplicit : 1;
|
||||
|
||||
void decode();
|
||||
void decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
||||
void decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
||||
|
||||
class ExpressionChange {
|
||||
public:
|
||||
|
@ -238,7 +238,7 @@ public:
|
|||
QQmlProperty property(const QString &);
|
||||
};
|
||||
|
||||
void QQuickPropertyChangesParser::verifyList(const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
||||
void QQuickPropertyChangesParser::verifyList(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
||||
{
|
||||
if (binding->type == QV4::CompiledData::Binding::Type_Object) {
|
||||
error(qmlUnit->objectAt(binding->value.objectIndex), QQuickPropertyChanges::tr("PropertyChanges does not support creating state-specific objects."));
|
||||
|
@ -261,18 +261,18 @@ void QQuickPropertyChangesPrivate::decode()
|
|||
return;
|
||||
|
||||
foreach (const QV4::CompiledData::Binding *binding, bindings)
|
||||
decodeBinding(QString(), cdata->qmlUnit, binding);
|
||||
decodeBinding(QString(), cdata->compilationUnit->data, binding);
|
||||
|
||||
bindings.clear();
|
||||
|
||||
decoded = true;
|
||||
}
|
||||
|
||||
void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
||||
void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
||||
{
|
||||
Q_Q(QQuickPropertyChanges);
|
||||
|
||||
QString propertyName = propertyPrefix + qmlUnit->header.stringAt(binding->propertyNameIndex);
|
||||
QString propertyName = propertyPrefix + qmlUnit->stringAt(binding->propertyNameIndex);
|
||||
|
||||
if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
|
||||
|| binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
|
||||
|
@ -297,7 +297,7 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix,
|
|||
}
|
||||
|
||||
if (binding->type == QV4::CompiledData::Binding::Type_Script) {
|
||||
QString expression = binding->valueAsString(&qmlUnit->header);
|
||||
QString expression = binding->valueAsString(qmlUnit);
|
||||
QUrl url = QUrl();
|
||||
int line = -1;
|
||||
int column = -1;
|
||||
|
@ -320,7 +320,7 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix,
|
|||
case QV4::CompiledData::Binding::Type_Translation:
|
||||
case QV4::CompiledData::Binding::Type_TranslationById:
|
||||
case QV4::CompiledData::Binding::Type_String:
|
||||
var = binding->valueAsString(&qmlUnit->header);
|
||||
var = binding->valueAsString(qmlUnit);
|
||||
break;
|
||||
case QV4::CompiledData::Binding::Type_Number:
|
||||
var = binding->valueAsNumber();
|
||||
|
@ -335,7 +335,7 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix,
|
|||
properties << qMakePair(propertyName, var);
|
||||
}
|
||||
|
||||
void QQuickPropertyChangesParser::verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
|
||||
void QQuickPropertyChangesParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
|
||||
{
|
||||
for (int ii = 0; ii < props.count(); ++ii)
|
||||
verifyList(qmlUnit, props.at(ii));
|
||||
|
|
|
@ -92,9 +92,9 @@ public:
|
|||
QQuickPropertyChangesParser()
|
||||
: QQmlCustomParser(AcceptsAttachedProperties) {}
|
||||
|
||||
void verifyList(const QV4::CompiledData::QmlUnit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
||||
void verifyList(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
||||
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
|
||||
virtual void applyBindings(QObject *obj, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings);
|
||||
};
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void CustomBinding::componentComplete()
|
|||
}
|
||||
}
|
||||
|
||||
void EnumSupportingCustomParser::verifyBindings(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
||||
void EnumSupportingCustomParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
||||
{
|
||||
if (bindings.count() != 1) {
|
||||
error(bindings.first(), QStringLiteral("Custom parser invoked incorrectly for unit test"));
|
||||
|
@ -146,7 +146,7 @@ void EnumSupportingCustomParser::verifyBindings(const QV4::CompiledData::QmlUnit
|
|||
}
|
||||
|
||||
const QV4::CompiledData::Binding *binding = bindings.first();
|
||||
if (qmlUnit->header.stringAt(binding->propertyNameIndex) != QStringLiteral("foo")) {
|
||||
if (qmlUnit->stringAt(binding->propertyNameIndex) != QStringLiteral("foo")) {
|
||||
error(binding, QStringLiteral("Custom parser invoked with the wrong property name"));
|
||||
return;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void EnumSupportingCustomParser::verifyBindings(const QV4::CompiledData::QmlUnit
|
|||
error(binding, QStringLiteral("Custom parser invoked with the wrong property value. Expected script that evaluates to enum"));
|
||||
return;
|
||||
}
|
||||
QByteArray script = qmlUnit->header.stringAt(binding->stringIndex).toUtf8();
|
||||
QByteArray script = qmlUnit->stringAt(binding->stringIndex).toUtf8();
|
||||
bool ok;
|
||||
int v = evaluateEnum(script, &ok);
|
||||
if (!ok) {
|
||||
|
|
|
@ -739,14 +739,14 @@ class MyCustomParserType : public QObject
|
|||
class MyCustomParserTypeParser : public QQmlCustomParser
|
||||
{
|
||||
public:
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
virtual void applyBindings(QObject *, QQmlCompiledData *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
};
|
||||
|
||||
class EnumSupportingCustomParser : public QQmlCustomParser
|
||||
{
|
||||
public:
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *, const QList<const QV4::CompiledData::Binding *> &);
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *, const QList<const QV4::CompiledData::Binding *> &);
|
||||
virtual void applyBindings(QObject *, QQmlCompiledData *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
};
|
||||
|
||||
|
@ -1119,7 +1119,7 @@ public:
|
|||
|
||||
class CustomBindingParser : public QQmlCustomParser
|
||||
{
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
virtual void applyBindings(QObject *, QQmlCompiledData *, const QList<const QV4::CompiledData::Binding *> &);
|
||||
};
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ private:
|
|||
|
||||
class SimpleObjectCustomParser : public QQmlCustomParser
|
||||
{
|
||||
virtual void verifyBindings(const QV4::CompiledData::QmlUnit *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
virtual void verifyBindings(const QV4::CompiledData::Unit *, const QList<const QV4::CompiledData::Binding *> &) {}
|
||||
virtual void applyBindings(QObject *, QQmlCompiledData *, const QList<const QV4::CompiledData::Binding *> &);
|
||||
};
|
||||
|
||||
|
|
|
@ -1954,18 +1954,18 @@ void tst_qqmllanguage::scriptStringWithoutSourceCode()
|
|||
QQmlTypeData *td = eng->typeLoader.getType(url);
|
||||
Q_ASSERT(td);
|
||||
|
||||
QV4::CompiledData::QmlUnit *qmlUnit = td->compiledData()->qmlUnit;
|
||||
QV4::CompiledData::Unit *qmlUnit = td->compiledData()->compilationUnit->data;
|
||||
Q_ASSERT(qmlUnit);
|
||||
const QV4::CompiledData::Object *rootObject = qmlUnit->objectAt(qmlUnit->indexOfRootObject);
|
||||
QCOMPARE(qmlUnit->header.stringAt(rootObject->inheritedTypeNameIndex), QString("MyTypeObject"));
|
||||
QCOMPARE(qmlUnit->stringAt(rootObject->inheritedTypeNameIndex), QString("MyTypeObject"));
|
||||
quint32 i;
|
||||
for (i = 0; i < rootObject->nBindings; ++i) {
|
||||
const QV4::CompiledData::Binding *binding = rootObject->bindingTable() + i;
|
||||
if (qmlUnit->header.stringAt(binding->propertyNameIndex) != QString("scriptProperty"))
|
||||
if (qmlUnit->stringAt(binding->propertyNameIndex) != QString("scriptProperty"))
|
||||
continue;
|
||||
QCOMPARE(binding->valueAsScriptString(&qmlUnit->header), QString("intProperty"));
|
||||
QCOMPARE(binding->valueAsScriptString(qmlUnit), QString("intProperty"));
|
||||
const_cast<QV4::CompiledData::Binding*>(binding)->stringIndex = 0; // empty string index
|
||||
QVERIFY(binding->valueAsScriptString(&qmlUnit->header).isEmpty());
|
||||
QVERIFY(binding->valueAsScriptString(qmlUnit).isEmpty());
|
||||
break;
|
||||
}
|
||||
QVERIFY(i < rootObject->nBindings);
|
||||
|
|
|
@ -98,11 +98,11 @@ void tst_qqmltranslation::translation()
|
|||
<< QStringLiteral("disambiguation")
|
||||
<< QStringLiteral("singular") << QStringLiteral("plural");
|
||||
|
||||
const QV4::CompiledData::QmlUnit *unit = cdata->qmlUnit;
|
||||
const QV4::CompiledData::Unit *unit = cdata->compilationUnit->data;
|
||||
const QV4::CompiledData::Object *rootObject = unit->objectAt(unit->indexOfRootObject);
|
||||
const QV4::CompiledData::Binding *binding = rootObject->bindingTable();
|
||||
for (quint32 i = 0; i < rootObject->nBindings; ++i, ++binding) {
|
||||
const QString propertyName = unit->header.stringAt(binding->propertyNameIndex);
|
||||
const QString propertyName = unit->stringAt(binding->propertyNameIndex);
|
||||
|
||||
const bool expectCompiledTranslation = compiledTranslations.contains(propertyName);
|
||||
|
||||
|
@ -153,11 +153,11 @@ void tst_qqmltranslation::idTranslation()
|
|||
QQmlCompiledData *cdata = typeData->compiledData();
|
||||
QVERIFY(cdata);
|
||||
|
||||
const QV4::CompiledData::QmlUnit *unit = cdata->qmlUnit;
|
||||
const QV4::CompiledData::Unit *unit = cdata->compilationUnit->data;
|
||||
const QV4::CompiledData::Object *rootObject = unit->objectAt(unit->indexOfRootObject);
|
||||
const QV4::CompiledData::Binding *binding = rootObject->bindingTable();
|
||||
for (quint32 i = 0; i < rootObject->nBindings; ++i, ++binding) {
|
||||
const QString propertyName = unit->header.stringAt(binding->propertyNameIndex);
|
||||
const QString propertyName = unit->stringAt(binding->propertyNameIndex);
|
||||
if (propertyName == "idTranslation") {
|
||||
if (binding->type != QV4::CompiledData::Binding::Type_TranslationById)
|
||||
qDebug() << "binding for property" << propertyName << "is not a compiled translation";
|
||||
|
|
Loading…
Reference in New Issue