diff options
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 76 | ||||
-rw-r--r-- | src/qml/compiler/qqmlirbuilder_p.h | 22 | ||||
-rw-r--r-- | src/qml/compiler/qqmlpropertycachecreator_p.h | 8 | ||||
-rw-r--r-- | src/qml/compiler/qqmlpropertyvalidator.cpp | 18 | ||||
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 30 | ||||
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator_p.h | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 20 | ||||
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 6 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 18 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilercontext_p.h | 10 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilercontrolflow_p.h | 12 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 8 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions_p.h | 2 |
13 files changed, 116 insertions, 116 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 6c8ca4bbfc..237cd9bf3b 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -93,7 +93,7 @@ void Object::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int idIndex, cons bindings = pool->New<PoolList<Binding> >(); functions = pool->New<PoolList<Function> >(); functionsAndExpressions = pool->New<PoolList<CompiledFunctionOrExpression> >(); - declarationsOverride = 0; + declarationsOverride = nullptr; } QString Object::sanityCheckFunctionNames(const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation) @@ -233,7 +233,7 @@ Binding *Object::findBinding(quint32 nameIndex) const for (Binding *b = bindings->first; b; b = b->next) if (b->propertyNameIndex == nameIndex) return b; - return 0; + return nullptr; } void Object::insertSorted(Binding *b) @@ -275,7 +275,7 @@ void Document::removeScriptPragmas(QString &script) const QLatin1String pragma("pragma"); const QLatin1String library("library"); - QQmlJS::Lexer l(0); + QQmlJS::Lexer l(nullptr); l.setCode(script, 0); int token = l.lex(); @@ -317,7 +317,7 @@ void Document::removeScriptPragmas(QString &script) Document::Document(bool debugMode) : jsModule(debugMode) - , program(0) + , program(nullptr) , jsGenerator(&jsModule) { } @@ -363,16 +363,16 @@ void ScriptDirectivesCollector::importModule(const QString &uri, const QString & IRBuilder::IRBuilder(const QSet<QString> &illegalNames) : illegalNames(illegalNames) - , _object(0) - , _propertyDeclaration(0) - , pool(0) - , jsGenerator(0) + , _object(nullptr) + , _propertyDeclaration(nullptr) + , pool(nullptr) + , jsGenerator(nullptr) { } bool IRBuilder::generateFromQml(const QString &code, const QString &url, Document *output) { - QQmlJS::AST::UiProgram *program = 0; + QQmlJS::AST::UiProgram *program = nullptr; { QQmlJS::Lexer lexer(&output->jsParserEngine); lexer.setCode(code, /*line = */ 1); @@ -479,7 +479,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiObjectDefinition *node) appendBinding(nameLocation, nameLocation, emptyStringIndex, idx); } else { int idx = 0; - if (!defineQMLObject(&idx, /*qualfied type name id*/0, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, /*declarations should go here*/_object)) + if (!defineQMLObject(&idx, /*qualfied type name id*/nullptr, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, /*declarations should go here*/_object)) return false; appendBinding(node->qualifiedTypeNameId, idx); } @@ -504,7 +504,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiScriptBinding *node) bool IRBuilder::visit(QQmlJS::AST::UiArrayBinding *node) { const QQmlJS::AST::SourceLocation qualifiedNameLocation = node->qualifiedId->identifierToken; - Object *object = 0; + Object *object = nullptr; QQmlJS::AST::UiQualifiedId *name = node->qualifiedId; if (!resolveQualifiedId(&name, &object)) return false; @@ -513,7 +513,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiArrayBinding *node) const int propertyNameIndex = registerString(name->name.toString()); - if (bindingsTarget()->findBinding(propertyNameIndex) != 0) { + if (bindingsTarget()->findBinding(propertyNameIndex) != nullptr) { recordError(name->identifierToken, tr("Property value set multiple times")); return false; } @@ -588,7 +588,7 @@ bool IRBuilder::defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qu _object->declarationsOverride = declarationsOverride; // A new object is also a boundary for property declarations. - Property *declaration = 0; + Property *declaration = nullptr; qSwap(_propertyDeclaration, declaration); accept(initializer); @@ -831,7 +831,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node) return false; } - const TypeNameToType *type = 0; + const TypeNameToType *type = nullptr; for (int typeIndex = 0; typeIndex < propTypeNameToTypesCount; ++typeIndex) { const TypeNameToType *t = propTypeNameToTypes + typeIndex; if (memberType == QLatin1String(t->name, static_cast<int>(t->nameLength))) { @@ -1219,7 +1219,7 @@ void IRBuilder::tryGeneratingTranslationBinding(const QStringRef &base, AST::Arg void IRBuilder::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Statement *value) { const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken; - Object *object = 0; + Object *object = nullptr; if (!resolveQualifiedId(&name, &object)) return; if (_object == object && name->name == QLatin1String("id")) { @@ -1234,7 +1234,7 @@ void IRBuilder::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Sta void IRBuilder::appendBinding(QQmlJS::AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment) { const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken; - Object *object = 0; + Object *object = nullptr; if (!resolveQualifiedId(&name, &object, isOnAssignment)) return; qSwap(_object, object); @@ -1385,7 +1385,7 @@ bool IRBuilder::setId(const QQmlJS::AST::SourceLocation &idLocation, QQmlJS::AST if (QQmlJS::AST::ExpressionStatement *stmt = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement *>(node)) { if (QQmlJS::AST::StringLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::StringLiteral *>(stmt->expression)) { str = lit->value; - node = 0; + node = nullptr; } else node = stmt->expression; } @@ -1456,9 +1456,9 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O if (binding) { if (isAttachedProperty) { if (!binding->isAttachedProperty()) - binding = 0; + binding = nullptr; } else if (!binding->isGroupProperty()) { - binding = 0; + binding = nullptr; } } if (!binding) { @@ -1480,7 +1480,7 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O binding->type = QV4::CompiledData::Binding::Type_GroupProperty; int objIndex = 0; - if (!defineQMLObject(&objIndex, 0, QQmlJS::AST::SourceLocation(), 0, 0)) + if (!defineQMLObject(&objIndex, nullptr, QQmlJS::AST::SourceLocation(), nullptr, nullptr)) return false; binding->value.objectIndex = objIndex; @@ -1582,7 +1582,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, const QV4: memset(data + unitSize, 0, totalSize - unitSize); if (jsUnit != compilationUnit->data) free(jsUnit); - jsUnit = 0; + jsUnit = nullptr; QV4::CompiledData::Unit *qmlUnit = reinterpret_cast<QV4::CompiledData::Unit *>(data); qmlUnit->unitSize = totalSize; @@ -1782,8 +1782,8 @@ JSCodeGen::JSCodeGen(const QString &sourceCode, QV4::Compiler::JSUnitGenerator * , imports(imports) , stringPool(stringPool) , _disableAcceleratedLookups(false) - , _contextObject(0) - , _scopeObject(0) + , _contextObject(nullptr) + , _scopeObject(nullptr) , _qmlContextSlot(-1) , _importedScriptsSlot(-1) , m_globalNames(globalNames) @@ -1796,7 +1796,7 @@ void JSCodeGen::beginContextScope(const JSCodeGen::ObjectIdMapping &objectIds, Q { _idObjects = objectIds; _contextObject = contextObject; - _scopeObject = 0; + _scopeObject = nullptr; } void JSCodeGen::beginObjectScope(QQmlPropertyCache *scopeObject) @@ -1809,7 +1809,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil QVector<int> runtimeFunctionIndices(functions.size()); QV4::Compiler::ScanFunctions scan(this, sourceCode, QV4::Compiler::GlobalCode); - scan.enterEnvironment(0, QV4::Compiler::QmlBinding); + scan.enterEnvironment(nullptr, QV4::Compiler::QmlBinding); scan.enterQmlScope(qmlRoot, QStringLiteral("context scope")); for (const CompiledFunctionOrExpression &f : functions) { Q_ASSERT(f.node != qmlRoot); @@ -1826,7 +1826,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil scan.leaveEnvironment(); scan.leaveEnvironment(); - _context = 0; + _context = nullptr; for (int i = 0; i < functions.count(); ++i) { const CompiledFunctionOrExpression &qmlFunction = functions.at(i); @@ -1845,7 +1845,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil QQmlJS::AST::SourceElements *body; if (function) - body = function->body ? function->body->elements : 0; + body = function->body ? function->body->elements : nullptr; else { // Synthesize source elements. QQmlJS::MemoryPool *pool = jsEngine->pool(); @@ -1863,7 +1863,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil _disableAcceleratedLookups = qmlFunction.disableAcceleratedLookups; int idx = defineFunction(name, node, - function ? function->formals : 0, + function ? function->formals : nullptr, body); runtimeFunctionIndices[i] = idx; } @@ -1889,14 +1889,14 @@ int JSCodeGen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPa #ifndef V4_BOOTSTRAP QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name) { - QQmlPropertyData *pd = cache->property(name, /*object*/0, /*context*/0); + QQmlPropertyData *pd = cache->property(name, /*object*/nullptr, /*context*/nullptr); // Q_INVOKABLEs can't be FINAL, so we have to look them up at run-time if (!pd || pd->isFunction()) - return 0; + return nullptr; if (!cache->isAllowedInRevision(pd)) - return 0; + return nullptr; return pd; } @@ -2273,7 +2273,7 @@ QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRev { if (notInRevision) *notInRevision = false; - QQmlPropertyData *d = cache->property(name, 0, 0); + QQmlPropertyData *d = cache->property(name, nullptr, nullptr); // Find the first property while (d && d->isFunction()) @@ -2281,7 +2281,7 @@ QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRev if (check != IgnoreRevision && d && !cache->isAllowedInRevision(d)) { if (notInRevision) *notInRevision = true; - return 0; + return nullptr; } else { return d; } @@ -2292,7 +2292,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis { if (notInRevision) *notInRevision = false; - QQmlPropertyData *d = cache->property(name, 0, 0); + QQmlPropertyData *d = cache->property(name, nullptr, nullptr); if (notInRevision) *notInRevision = false; while (d && !(d->isFunction())) @@ -2300,7 +2300,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis if (d && !cache->isAllowedInRevision(d)) { if (notInRevision) *notInRevision = true; - return 0; + return nullptr; } else if (d && d->isSignal()) { return d; } @@ -2313,7 +2313,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis return cache->signal(d->notifyIndex()); } - return 0; + return nullptr; } IRLoader::IRLoader(const QV4::CompiledData::Unit *qmlData, QmlIR::Document *output) @@ -2450,7 +2450,7 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO f->location = compiledFunction->location; f->nameIndex = compiledFunction->nameIndex; - QQmlJS::AST::FormalParameterList *paramList = 0; + QQmlJS::AST::FormalParameterList *paramList = nullptr; const quint32_le *formalNameIdx = compiledFunction->formalsTable(); for (uint i = 0; i < compiledFunction->nFormals; ++i, ++formalNameIdx) { const QString formal = unit->stringAt(*formalNameIdx); @@ -2466,7 +2466,7 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO paramList = paramList->finish(); const QString name = unit->stringAt(compiledFunction->nameIndex); - f->functionDeclaration = new(pool) QQmlJS::AST::FunctionDeclaration(jsParserEngine->newStringRef(name), paramList, /*body*/0); + f->functionDeclaration = new(pool) QQmlJS::AST::FunctionDeclaration(jsParserEngine->newStringRef(name), paramList, /*body*/nullptr); f->formals.allocate(pool, int(compiledFunction->nFormals)); formalNameIdx = compiledFunction->formalsTable(); diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index f8f8649fc7..673bc2c481 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -80,8 +80,8 @@ template <typename T> struct PoolList { PoolList() - : first(0) - , last(0) + : first(nullptr) + , last(nullptr) , count(0) {} @@ -90,7 +90,7 @@ struct PoolList int count; int append(T *item) { - item->next = 0; + item->next = nullptr; if (last) last->next = item; else @@ -110,7 +110,7 @@ struct PoolList template <typename Sortable, typename Base, Sortable Base::*sortMember> T *findSortedInsertionPoint(T *item) const { - T *insertPos = 0; + T *insertPos = nullptr; for (T *it = first; it; it = it->next) { if (!(it->*sortMember <= item->*sortMember)) @@ -208,7 +208,7 @@ public: int count; FixedPoolArray() - : data(0) + : data(nullptr) , count(0) {} @@ -343,16 +343,16 @@ struct Function struct Q_QML_PRIVATE_EXPORT CompiledFunctionOrExpression { CompiledFunctionOrExpression() - : node(0) + : node(nullptr) , nameIndex(0) , disableAcceleratedLookups(false) - , next(0) + , next(nullptr) {} CompiledFunctionOrExpression(QQmlJS::AST::Node *n) : node(n) , nameIndex(0) , disableAcceleratedLookups(false) - , next(0) + , next(nullptr) {} QQmlJS::AST::Node *node; // FunctionDeclaration, Statement or Expression quint32 nameIndex; @@ -514,8 +514,8 @@ public: void accept(QQmlJS::AST::Node *node); // returns index in _objects - bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, Object *declarationsOverride = 0); - bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiObjectDefinition *node, Object *declarationsOverride = 0) + bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, Object *declarationsOverride = nullptr); + bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiObjectDefinition *node, Object *declarationsOverride = nullptr) { return defineQMLObject(objectIndex, node->qualifiedTypeNameId, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, declarationsOverride); } static QString asString(QQmlJS::AST::UiQualifiedId *node); @@ -598,7 +598,7 @@ struct Q_QML_EXPORT PropertyResolver IgnoreRevision }; - QQmlPropertyData *property(const QString &name, bool *notInRevision = 0, RevisionCheck check = CheckRevision) const; + QQmlPropertyData *property(const QString &name, bool *notInRevision = nullptr, RevisionCheck check = CheckRevision) const; // This code must match the semantics of QQmlPropertyPrivate::findSignalByName QQmlPropertyData *signal(const QString &name, bool *notInRevision) const; diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h index 7a52f3a12c..2af0fe0036 100644 --- a/src/qml/compiler/qqmlpropertycachecreator_p.h +++ b/src/qml/compiler/qqmlpropertycachecreator_p.h @@ -214,7 +214,7 @@ inline QQmlPropertyCache *QQmlPropertyCacheCreator<ObjectContainer>::propertyCac QQmlType qmltype = typeRef->type; if (!qmltype.isValid()) { QString propertyName = stringAt(context.instantiatingBinding->propertyNameIndex); - if (imports->resolveType(propertyName, &qmltype, 0, 0, 0)) { + if (imports->resolveType(propertyName, &qmltype, nullptr, nullptr, nullptr)) { if (qmltype.isComposite()) { QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype.sourceUrl()); Q_ASSERT(tdata); @@ -411,7 +411,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj Q_ASSERT(param->type == QV4::CompiledData::Property::Custom); const QString customTypeName = stringAt(param->customTypeNameIndex); QQmlType qmltype; - if (!imports->resolveType(customTypeName, &qmltype, 0, 0, 0)) + if (!imports->resolveType(customTypeName, &qmltype, nullptr, nullptr, nullptr)) return QQmlCompileError(s->location, QQmlPropertyCacheCreatorBase::tr("Invalid signal parameter type: %1").arg(customTypeName)); if (qmltype.isComposite()) { @@ -441,7 +441,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj seenSignals.insert(signalName); cache->appendSignal(signalName, flags, effectiveMethodIndex++, - paramCount?paramTypes.constData():0, names); + paramCount?paramTypes.constData():nullptr, names); } @@ -492,7 +492,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj p->type == QV4::CompiledData::Property::Custom); QQmlType qmltype; - if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, 0, 0, 0)) { + if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, nullptr, nullptr, nullptr)) { return QQmlCompileError(p->location, QQmlPropertyCacheCreatorBase::tr("Invalid property type")); } diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 3aa8befa2c..00bb694ef4 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -58,7 +58,7 @@ QQmlPropertyValidator::QQmlPropertyValidator(QQmlEnginePrivate *enginePrivate, c QVector<QQmlCompileError> QQmlPropertyValidator::validate() { - return validateObject(/*root object*/0, /*instantiatingBinding*/0); + return validateObject(/*root object*/0, /*instantiatingBinding*/nullptr); } typedef QVarLengthArray<const QV4::CompiledData::Binding *, 8> GroupPropertyVector; @@ -94,7 +94,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, if (!propertyCache) return QVector<QQmlCompileError>(); - QQmlCustomParser *customParser = 0; + QQmlCustomParser *customParser = nullptr; if (auto typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex)) { if (typeRef->type.isValid()) customParser = typeRef->type.customParser(); @@ -124,7 +124,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, QmlIR::PropertyResolver propertyResolver(propertyCache); QString defaultPropertyName; - QQmlPropertyData *defaultProperty = 0; + QQmlPropertyData *defaultProperty = nullptr; if (obj->indexOfDefaultPropertyOrAlias != -1) { QQmlPropertyCache *cache = propertyCache->parent(); defaultPropertyName = cache->defaultPropertyName(); @@ -157,7 +157,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, bool isGroupProperty = instantiatingBinding && instantiatingBinding->type == QV4::CompiledData::Binding::Type_GroupProperty; bool notInRevision = false; - QQmlPropertyData *pd = 0; + QQmlPropertyData *pd = nullptr; if (!name.isEmpty()) { if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression || binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject) @@ -188,8 +188,8 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, if (name.constData()->isUpper() && !binding->isAttachedProperty()) { QQmlType type; - QQmlImportNamespace *typeNamespace = 0; - imports.resolveType(stringAt(binding->propertyNameIndex), &type, 0, 0, &typeNamespace); + QQmlImportNamespace *typeNamespace = nullptr; + imports.resolveType(stringAt(binding->propertyNameIndex), &type, nullptr, nullptr, &typeNamespace); if (typeNamespace) return recordError(binding->location, tr("Invalid use of namespace")); return recordError(binding->location, tr("Invalid attached object assignment")); @@ -306,9 +306,9 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, customParser->engine = enginePrivate; customParser->imports = &imports; customParser->verifyBindings(qmlUnit, customBindings); - customParser->validator = 0; - customParser->engine = 0; - customParser->imports = (QQmlImports*)0; + customParser->validator = nullptr; + customParser->engine = nullptr; + customParser->imports = (QQmlImports*)nullptr; QVector<QQmlCompileError> parserErrors = customParser->errors(); if (!parserErrors.isEmpty()) return parserErrors; diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index ac373aafb4..3415e1c073 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -332,7 +332,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio auto *typeRef = resolvedTypes.value(binding->propertyNameIndex); QQmlType type = typeRef ? typeRef->type : QQmlType(); if (!type.isValid()) { - if (imports->resolveType(propertyName, &type, 0, 0, 0)) { + if (imports->resolveType(propertyName, &type, nullptr, nullptr, nullptr)) { if (type.isComposite()) { QQmlTypeData *tdata = enginePrivate->typeLoader.getType(type.sourceUrl()); Q_ASSERT(tdata); @@ -397,7 +397,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio } else { if (notInRevision) { // Try assinging it as a property later - if (resolver.property(propertyName, /*notInRevision ptr*/0)) + if (resolver.property(propertyName, /*notInRevision ptr*/nullptr)) continue; const QString &originalPropertyName = stringAt(binding->propertyNameIndex); @@ -457,7 +457,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio QQmlJS::MemoryPool *pool = compiler->memoryPool(); - QQmlJS::AST::FormalParameterList *paramList = 0; + QQmlJS::AST::FormalParameterList *paramList = nullptr; for (const QString ¶m : qAsConst(parameters)) { QStringRef paramNameRef = compiler->newStringRef(param); @@ -471,7 +471,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio paramList = paramList->finish(); QmlIR::CompiledFunctionOrExpression *foe = obj->functionsAndExpressions->slowAt(binding->value.compiledScriptIndex); - QQmlJS::AST::FunctionDeclaration *functionDeclaration = 0; + QQmlJS::AST::FunctionDeclaration *functionDeclaration = nullptr; if (QQmlJS::AST::ExpressionStatement *es = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement*>(foe->node)) { if (QQmlJS::AST::FunctionExpression *fe = QQmlJS::AST::cast<QQmlJS::AST::FunctionExpression*>(es->expression)) { functionDeclaration = new (pool) QQmlJS::AST::FunctionDeclaration(fe->name, fe->formals, fe->body); @@ -611,7 +611,7 @@ bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, return true; } QQmlType type; - imports->resolveType(typeName, &type, 0, 0, 0); + imports->resolveType(typeName, &type, nullptr, nullptr, nullptr); if (!type.isValid() && !isQtObject) return true; @@ -663,7 +663,7 @@ int QQmlEnumTypeResolver::evaluateEnum(const QString &scope, const QStringRef &e if (scope != QLatin1String("Qt")) { QQmlType type; - imports->resolveType(scope, &type, 0, 0, 0); + imports->resolveType(scope, &type, nullptr, nullptr, nullptr); if (!type.isValid()) return -1; if (!enumName.isEmpty()) @@ -814,7 +814,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI continue; } - QQmlPropertyData *pd = 0; + QQmlPropertyData *pd = nullptr; if (binding->propertyNameIndex != quint32(0)) { bool notInRevision = false; pd = propertyResolver.property(stringAt(binding->propertyNameIndex), ¬InRevision); @@ -825,7 +825,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI continue; QQmlPropertyCache *pc = enginePrivate->rawPropertyCacheForType(pd->propType(), pd->typeMinorVersion()); - const QMetaObject *mo = pc ? pc->firstCppMetaObject() : 0; + const QMetaObject *mo = pc ? pc->firstCppMetaObject() : nullptr; while (mo) { if (mo == &QQmlComponent::staticMetaObject) break; @@ -1204,7 +1204,7 @@ bool QQmlDeferredAndCustomParserBindingScanner::scanObject(int objectIndex) return true; QString defaultPropertyName; - QQmlPropertyData *defaultProperty = 0; + QQmlPropertyData *defaultProperty = nullptr; if (obj->indexOfDefaultPropertyOrAlias != -1) { QQmlPropertyCache *cache = propertyCache->parent(); defaultPropertyName = cache->defaultPropertyName(); @@ -1229,7 +1229,7 @@ bool QQmlDeferredAndCustomParserBindingScanner::scanObject(int objectIndex) } for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) { - QQmlPropertyData *pd = 0; + QQmlPropertyData *pd = nullptr; QString name = stringAt(binding->propertyNameIndex); if (customParser) { @@ -1334,7 +1334,7 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject) auto *tref = resolvedTypes.value(obj->inheritedTypeNameIndex); if (tref && tref->isFullyDynamicType) - m.type = 0; + m.type = nullptr; idMapping << m; } @@ -1412,10 +1412,10 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex) QmlIR::Object *object = qmlObjects.at(objectIndex); QString defaultProperty = object->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultPropertyName() : propertyCache->defaultPropertyName(); - QmlIR::Binding *bindingsToReinsert = 0; - QmlIR::Binding *tail = 0; + QmlIR::Binding *bindingsToReinsert = nullptr; + QmlIR::Binding *tail = nullptr; - QmlIR::Binding *previousBinding = 0; + QmlIR::Binding *previousBinding = nullptr; QmlIR::Binding *binding = object->firstBinding(); while (binding) { if (binding->propertyNameIndex == quint32(0) || stringAt(binding->propertyNameIndex) != defaultProperty) { @@ -1434,7 +1434,7 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex) tail->next = toReinsert; tail = tail->next; } - tail->next = 0; + tail->next = nullptr; } binding = bindingsToReinsert; diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h index 3d516da922..3b3c766bfe 100644 --- a/src/qml/compiler/qv4bytecodegenerator_p.h +++ b/src/qml/compiler/qv4bytecodegenerator_p.h @@ -94,7 +94,7 @@ public: generator->labels[index] = generator->instructions.size(); } - BytecodeGenerator *generator = 0; + BytecodeGenerator *generator = nullptr; int index = -1; }; diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index f236683506..eb5772e1bc 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -89,10 +89,10 @@ static inline void setJumpOutLocation(QV4::Moth::BytecodeGenerator *bytecodeGene } Codegen::Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict) - : _module(0) + : _module(nullptr) , _returnAddress(0) - , _context(0) - , _labelledStatement(0) + , _context(nullptr) + , _labelledStatement(nullptr) , jsUnitGenerator(jsUnitGenerator) , _strictMode(strict) , _fileNameIsUrl(false) @@ -111,7 +111,7 @@ void Codegen::generateFromProgram(const QString &fileName, Q_ASSERT(node); _module = module; - _context = 0; + _context = nullptr; // ### should be set on the module outside of this method _module->fileName = fileName; @@ -120,7 +120,7 @@ void Codegen::generateFromProgram(const QString &fileName, ScanFunctions scan(this, sourceCode, mode); scan(node); - defineFunction(QStringLiteral("%entry"), node, 0, node->elements); + defineFunction(QStringLiteral("%entry"), node, nullptr, node->elements); } void Codegen::enterContext(Node *node) @@ -635,14 +635,14 @@ bool Codegen::visit(ArrayLiteral *ast) for (ElementList *it = ast->elements; it; it = it->next) { for (Elision *elision = it->elision; elision; elision = elision->next) - push(0); + push(nullptr); push(it->expression); if (hasError) return false; } for (Elision *elision = ast->elision; elision; elision = elision->next) - push(0); + push(nullptr); if (args == -1) { Q_ASSERT(argc == 0); @@ -1496,7 +1496,7 @@ bool Codegen::visit(FunctionExpression *ast) RegisterScope scope(this); - int function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0); + int function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : nullptr); loadClosure(function); _expr.setResult(Reference::fromAccumulator(this)); return false; @@ -1720,7 +1720,7 @@ bool Codegen::visit(ObjectLiteral *ast) v.rvalue = value.storeOnStack(); } else if (PropertyGetterSetter *gs = AST::cast<AST::PropertyGetterSetter *>(it->assignment)) { - const int function = defineFunction(name, gs, gs->formals, gs->functionBody ? gs->functionBody->elements : 0); + const int function = defineFunction(name, gs, gs->formals, gs->functionBody ? gs->functionBody->elements : nullptr); ObjectPropertyValue &v = valueMap[name]; if (v.rvalue.isValid() || (gs->type == PropertyGetterSetter::Getter && v.hasGetter()) || @@ -2142,7 +2142,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, for (const Context::Member &member : qAsConst(_context->members)) { if (member.function) { const int function = defineFunction(member.function->name.toString(), member.function, member.function->formals, - member.function->body ? member.function->body->elements : 0); + member.function->body ? member.function->body->elements : nullptr); loadClosure(function); if (! _context->parent) { Reference::fromName(this, member.function->name.toString()).storeConsumeAccumulator(); diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index e52f63e1f4..27c8e96e16 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -423,8 +423,8 @@ protected: } explicit Result(Format requested = ex) - : _iftrue(0) - , _iffalse(0) + : _iftrue(nullptr) + , _iffalse(nullptr) , _format(ex) , _requested(requested) {} @@ -671,7 +671,7 @@ protected: Context *_context; AST::LabelledStatement *_labelledStatement; QV4::Compiler::JSUnitGenerator *jsUnitGenerator; - BytecodeGenerator *bytecodeGenerator = 0; + BytecodeGenerator *bytecodeGenerator = nullptr; bool _strictMode; bool useFastLookups = true; bool requiresReturnValue = false; diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 05869c3287..cc11b250f3 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -109,7 +109,7 @@ CompilationUnit::~CompilationUnit() unlink(); if (data && !(data->flags & QV4::CompiledData::Unit::StaticData)) free(const_cast<Unit *>(data)); - data = 0; + data = nullptr; } QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) @@ -201,7 +201,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) if (data->indexOfRootFunction != -1) return runtimeFunctions[data->indexOfRootFunction]; else - return 0; + return nullptr; } void CompilationUnit::unlink() @@ -228,16 +228,16 @@ void CompilationUnit::unlink() qDeleteAll(resolvedTypes); resolvedTypes.clear(); - engine = 0; - qmlEngine = 0; + engine = nullptr; + qmlEngine = nullptr; free(runtimeStrings); - runtimeStrings = 0; + runtimeStrings = nullptr; delete [] runtimeLookups; - runtimeLookups = 0; + runtimeLookups = nullptr; delete [] runtimeRegularExpressions; - runtimeRegularExpressions = 0; + runtimeRegularExpressions = nullptr; free(runtimeClasses); - runtimeClasses = 0; + runtimeClasses = nullptr; qDeleteAll(runtimeFunctions); runtimeFunctions.clear(); #if Q_BYTE_ORDER == Q_BIG_ENDIAN @@ -676,7 +676,7 @@ bool qtTypeInherits(const QMetaObject *mo) { void ResolvedTypeReference::doDynamicTypeCheck() { - const QMetaObject *mo = 0; + const QMetaObject *mo = nullptr; if (typePropertyCache) mo = typePropertyCache->firstCppMetaObject(); else if (type.isValid()) diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index bd68ea513e..d375942d0e 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -120,7 +120,7 @@ struct Context { int index = -1; QQmlJS::AST::VariableDeclaration::VariableScope scope = QQmlJS::AST::VariableDeclaration::FunctionScope; mutable bool canEscape = false; - QQmlJS::AST::FunctionExpression *function = 0; + QQmlJS::AST::FunctionExpression *function = nullptr; bool isLexicallyScoped() const { return this->scope != QQmlJS::AST::VariableDeclaration::FunctionScope; } }; @@ -128,12 +128,12 @@ struct Context { MemberMap members; QSet<QString> usedVariables; - QQmlJS::AST::FormalParameterList *formals = 0; + QQmlJS::AST::FormalParameterList *formals = nullptr; QStringList arguments; QStringList locals; QVector<Context *> nestedContexts; - ControlFlow *controlFlow = 0; + ControlFlow *controlFlow = nullptr; QByteArray code; QVector<CompiledData::CodeOffsetToLine> lineNumberMapping; @@ -245,7 +245,7 @@ struct Context { Q_ASSERT(m); MemberMap::const_iterator it = members.find(name); if (it == members.end()) { - *m = 0; + *m = nullptr; return false; } *m = &(*it); @@ -256,7 +256,7 @@ struct Context { usedVariables.insert(name); } - void addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableDeclaration::VariableScope scope, QQmlJS::AST::FunctionExpression *function = 0) + void addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableDeclaration::VariableScope scope, QQmlJS::AST::FunctionExpression *function = nullptr) { if (! name.isEmpty()) { if (type != FunctionDefinition) { diff --git a/src/qml/compiler/qv4compilercontrolflow_p.h b/src/qml/compiler/qv4compilercontrolflow_p.h index 13716fe29f..9bda20905a 100644 --- a/src/qml/compiler/qv4compilercontrolflow_p.h +++ b/src/qml/compiler/qv4compilercontrolflow_p.h @@ -159,7 +159,7 @@ struct ControlFlow { virtual Handler getHandler(HandlerType type, const QString &label = QString()) = 0; BytecodeGenerator::ExceptionHandler *parentExceptionHandler() { - return parent ? parent->exceptionHandler() : 0; + return parent ? parent->exceptionHandler() : nullptr; } virtual BytecodeGenerator::ExceptionHandler *exceptionHandler() { @@ -184,7 +184,7 @@ protected: QString label; if (cg->_labelledStatement) { label = cg->_labelledStatement->label.toString(); - cg->_labelledStatement = 0; + cg->_labelledStatement = nullptr; } return label; } @@ -196,10 +196,10 @@ protected: struct ControlFlowLoop : public ControlFlow { QString loopLabel; - BytecodeGenerator::Label *breakLabel = 0; - BytecodeGenerator::Label *continueLabel = 0; + BytecodeGenerator::Label *breakLabel = nullptr; + BytecodeGenerator::Label *continueLabel = nullptr; - ControlFlowLoop(Codegen *cg, BytecodeGenerator::Label *breakLabel, BytecodeGenerator::Label *continueLabel = 0) + ControlFlowLoop(Codegen *cg, BytecodeGenerator::Label *breakLabel, BytecodeGenerator::Label *continueLabel = nullptr) : ControlFlow(cg, Loop), loopLabel(ControlFlow::loopLabel()), breakLabel(breakLabel), continueLabel(continueLabel) { } @@ -407,7 +407,7 @@ struct ControlFlowFinally : public ControlFlowUnwind ControlFlowFinally(Codegen *cg, AST::Finally *finally) : ControlFlowUnwind(cg, Finally), finally(finally) { - Q_ASSERT(finally != 0); + Q_ASSERT(finally != nullptr); generator()->setExceptionHandler(&unwindLabel); } diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 808e79959d..89f602b409 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -59,7 +59,7 @@ using namespace QQmlJS::AST; ScanFunctions::ScanFunctions(Codegen *cg, const QString &sourceCode, CompilationMode defaultProgramMode) : _cg(cg) , _sourceCode(sourceCode) - , _context(0) + , _context(nullptr) , _allowFuncDecls(true) , defaultProgramMode(defaultProgramMode) { @@ -208,7 +208,7 @@ bool ScanFunctions::visit(VariableDeclaration *ast) return false; } QString name = ast->name.toString(); - const Context::Member *m = 0; + const Context::Member *m = nullptr; if (_context->memberInfo(name, &m)) { if (m->isLexicallyScoped() || ast->isLexicallyScoped()) { _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Identifier %1 has already been declared").arg(name)); @@ -258,7 +258,7 @@ void ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName) { if (_context->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments"))) _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Function name may not be eval or arguments in strict mode")); - enterFunction(ast, ast->name.toString(), ast->formals, ast->body, enterName ? ast : 0); + enterFunction(ast, ast->name.toString(), ast->formals, ast->body, enterName ? ast : nullptr); } void ScanFunctions::endVisit(FunctionExpression *) @@ -287,7 +287,7 @@ bool ScanFunctions::visit(ObjectLiteral *ast) bool ScanFunctions::visit(PropertyGetterSetter *ast) { TemporaryBoolAssignment allowFuncDecls(_allowFuncDecls, true); - enterFunction(ast, QString(), ast->formals, ast->functionBody, /*FunctionExpression*/0); + enterFunction(ast, QString(), ast->formals, ast->functionBody, /*FunctionExpression*/nullptr); return true; } diff --git a/src/qml/compiler/qv4compilerscanfunctions_p.h b/src/qml/compiler/qv4compilerscanfunctions_p.h index 526278fdd8..745e9f8a73 100644 --- a/src/qml/compiler/qv4compilerscanfunctions_p.h +++ b/src/qml/compiler/qv4compilerscanfunctions_p.h @@ -88,7 +88,7 @@ public: void leaveEnvironment(); void enterQmlScope(AST::Node *ast, const QString &name) - { enterFunction(ast, name, /*formals*/0, /*body*/0, /*expr*/0); } + { enterFunction(ast, name, /*formals*/nullptr, /*body*/nullptr, /*expr*/nullptr); } void enterQmlFunction(AST::FunctionDeclaration *ast) { enterFunction(ast, false); } |