From 21dd82ed236736d83754cba14df56d33c602e661 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Wed, 21 May 2014 23:31:33 +0200 Subject: [PATCH] qmljs: codestyle fixes Change-Id: I1b5a597d92e865d2235b15c62e3bbae362e5b7c0 Reviewed-by: Thomas Hartmann --- src/libs/qmljs/qmljsinterpreter.cpp | 558 ++++++++++++++-------------- src/libs/qmljs/qmljsinterpreter.h | 202 +++++----- 2 files changed, 379 insertions(+), 381 deletions(-) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 83d7f35d44a..1ab9984436e 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -27,25 +27,25 @@ ** ****************************************************************************/ -#include "qmljsinterpreter.h" +#include "parser/qmljsast_p.h" +#include "qmljscontext.h" #include "qmljsevaluate.h" +#include "qmljsinterpreter.h" +#include "qmljsmodelmanagerinterface.h" +#include "qmljsscopeastpath.h" #include "qmljsscopebuilder.h" #include "qmljsscopechain.h" -#include "qmljsscopeastpath.h" #include "qmljstypedescriptionreader.h" #include "qmljsvalueowner.h" -#include "qmljscontext.h" -#include "qmljsmodelmanagerinterface.h" -#include "parser/qmljsast_p.h" #include #include -#include +#include #include +#include #include #include -#include using namespace LanguageUtils; using namespace QmlJS; @@ -85,16 +85,16 @@ namespace { class LookupMember: public MemberProcessor { - QString _name; - const Value *_value; + QString m_name; + const Value *m_value; bool process(const QString &name, const Value *value) { - if (_value) + if (m_value) return false; - if (name == _name) { - _value = value; + if (name == m_name) { + m_value = value; return false; } @@ -103,9 +103,9 @@ class LookupMember: public MemberProcessor public: LookupMember(const QString &name) - : _name(name), _value(0) {} + : m_name(name), m_value(0) {} - const Value *value() const { return _value; } + const Value *value() const { return m_value; } virtual bool processProperty(const QString &name, const Value *value) { @@ -139,23 +139,23 @@ namespace QmlJS { namespace Internal { class MetaFunction: public FunctionValue { - FakeMetaMethod _method; + FakeMetaMethod m_method; public: MetaFunction(const FakeMetaMethod &method, ValueOwner *valueOwner) - : FunctionValue(valueOwner), _method(method) + : FunctionValue(valueOwner), m_method(method) { } virtual int namedArgumentCount() const { - return _method.parameterNames().size(); + return m_method.parameterNames().size(); } virtual QString argumentName(int index) const { - if (index < _method.parameterNames().size()) - return _method.parameterNames().at(index); + if (index < m_method.parameterNames().size()) + return m_method.parameterNames().at(index); return FunctionValue::argumentName(index); } @@ -177,28 +177,28 @@ CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const const ComponentVersion &importVersion, int metaObjectRevision, ValueOwner *valueOwner) : ObjectValue(valueOwner), - _metaObject(metaObject), - _moduleName(packageName), - _componentVersion(componentVersion), - _importVersion(importVersion), - _metaObjectRevision(metaObjectRevision) + m_metaObject(metaObject), + m_moduleName(packageName), + m_componentVersion(componentVersion), + m_importVersion(importVersion), + m_metaObjectRevision(metaObjectRevision) { setClassName(className); int nEnums = metaObject->enumeratorCount(); for (int i = 0; i < nEnums; ++i) { FakeMetaEnum fEnum = metaObject->enumerator(i); - _enums[fEnum.name()] = new QmlEnumValue(this, i); + m_enums[fEnum.name()] = new QmlEnumValue(this, i); } } CppComponentValue::~CppComponentValue() { #if QT_VERSION >= 0x050000 - delete _metaSignatures.load(); - delete _signalScopes.load(); + delete m_metaSignatures.load(); + delete m_signalScopes.load(); #else - delete _metaSignatures; - delete _signalScopes; + delete m_metaSignatures; + delete m_signalScopes; #endif } @@ -225,8 +225,8 @@ const CppComponentValue *CppComponentValue::asCppComponentValue() const void CppComponentValue::processMembers(MemberProcessor *processor) const { // process the meta enums - for (int index = _metaObject->enumeratorOffset(); index < _metaObject->enumeratorCount(); ++index) { - FakeMetaEnum e = _metaObject->enumerator(index); + for (int index = m_metaObject->enumeratorOffset(); index < m_metaObject->enumeratorCount(); ++index) { + FakeMetaEnum e = m_metaObject->enumerator(index); for (int i = 0; i < e.keyCount(); ++i) { processor->processEnumerator(e.key(i), valueOwner()->numberValue()); @@ -238,32 +238,32 @@ void CppComponentValue::processMembers(MemberProcessor *processor) const // make MetaFunction instances lazily when first needed #if QT_VERSION >= 0x050000 - QList *signatures = _metaSignatures.load(); + QList *signatures = m_metaSignatures.load(); #else - QList *signatures = _metaSignatures; + QList *signatures = m_metaSignatures; #endif if (!signatures) { signatures = new QList; - signatures->reserve(_metaObject->methodCount()); - for (int index = 0; index < _metaObject->methodCount(); ++index) - signatures->append(new Internal::MetaFunction(_metaObject->method(index), valueOwner())); - if (!_metaSignatures.testAndSetOrdered(0, signatures)) { + signatures->reserve(m_metaObject->methodCount()); + for (int index = 0; index < m_metaObject->methodCount(); ++index) + signatures->append(new Internal::MetaFunction(m_metaObject->method(index), valueOwner())); + if (!m_metaSignatures.testAndSetOrdered(0, signatures)) { delete signatures; #if QT_VERSION >= 0x050000 - signatures = _metaSignatures.load(); + signatures = m_metaSignatures.load(); #else - signatures = _metaSignatures; + signatures = m_metaSignatures; #endif } } // process the meta methods - for (int index = 0; index < _metaObject->methodCount(); ++index) { - const FakeMetaMethod method = _metaObject->method(index); - if (_metaObjectRevision < method.revision()) + for (int index = 0; index < m_metaObject->methodCount(); ++index) { + const FakeMetaMethod method = m_metaObject->method(index); + if (m_metaObjectRevision < method.revision()) continue; - const QString &methodName = _metaObject->method(index).methodName(); + const QString &methodName = m_metaObject->method(index).methodName(); const Value *signature = signatures->at(index); if (method.methodType() == FakeMetaMethod::Slot && method.access() == FakeMetaMethod::Public) { @@ -281,9 +281,9 @@ void CppComponentValue::processMembers(MemberProcessor *processor) const } // process the meta properties - for (int index = 0; index < _metaObject->propertyCount(); ++index) { - const FakeMetaProperty prop = _metaObject->property(index); - if (_metaObjectRevision < prop.revision()) + for (int index = 0; index < m_metaObject->propertyCount(); ++index) { + const FakeMetaProperty prop = m_metaObject->property(index); + if (m_metaObjectRevision < prop.revision()) continue; const QString propertyName = prop.name(); @@ -301,7 +301,7 @@ void CppComponentValue::processMembers(MemberProcessor *processor) const } // look into attached types - const QString &attachedTypeName = _metaObject->attachedTypeName(); + const QString &attachedTypeName = m_metaObject->attachedTypeName(); if (!attachedTypeName.isEmpty()) { const CppComponentValue *attachedType = valueOwner()->cppQmlTypes().objectByCppName(attachedTypeName); if (attachedType && attachedType != this) // ### only weak protection against infinite loops @@ -317,7 +317,7 @@ const Value *CppComponentValue::valueForCppName(const QString &typeName) const // check in the same package/version first const CppComponentValue *objectValue = cppTypes.objectByQualifiedName( - _moduleName, typeName, _importVersion); + m_moduleName, typeName, m_importVersion); if (objectValue) return objectValue; @@ -402,25 +402,25 @@ QList CppComponentValue::prototypes() const FakeMetaObject::ConstPtr CppComponentValue::metaObject() const { - return _metaObject; + return m_metaObject; } QString CppComponentValue::moduleName() const -{ return _moduleName; } +{ return m_moduleName; } ComponentVersion CppComponentValue::componentVersion() const -{ return _componentVersion; } +{ return m_componentVersion; } ComponentVersion CppComponentValue::importVersion() const -{ return _importVersion; } +{ return m_importVersion; } QString CppComponentValue::defaultPropertyName() const -{ return _metaObject->defaultPropertyName(); } +{ return m_metaObject->defaultPropertyName(); } QString CppComponentValue::propertyType(const QString &propertyName) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) return iter->property(propIdx).typeName(); @@ -431,7 +431,7 @@ QString CppComponentValue::propertyType(const QString &propertyName) const bool CppComponentValue::isListProperty(const QString &propertyName) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) return iter->property(propIdx).isList(); @@ -442,7 +442,7 @@ bool CppComponentValue::isListProperty(const QString &propertyName) const FakeMetaEnum CppComponentValue::getEnum(const QString &typeName, const CppComponentValue **foundInScope) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; const int index = iter->enumeratorIndex(typeName); if (index != -1) { if (foundInScope) @@ -458,7 +458,7 @@ FakeMetaEnum CppComponentValue::getEnum(const QString &typeName, const CppCompon const QmlEnumValue *CppComponentValue::getEnumValue(const QString &typeName, const CppComponentValue **foundInScope) const { foreach (const CppComponentValue *it, prototypes()) { - if (const QmlEnumValue *e = it->_enums.value(typeName)) { + if (const QmlEnumValue *e = it->m_enums.value(typeName)) { if (foundInScope) *foundInScope = it; return e; @@ -472,16 +472,16 @@ const QmlEnumValue *CppComponentValue::getEnumValue(const QString &typeName, con const ObjectValue *CppComponentValue::signalScope(const QString &signalName) const { #if QT_VERSION >= 0x050000 - QHash *scopes = _signalScopes.load(); + QHash *scopes = m_signalScopes.load(); #else - QHash *scopes = _signalScopes; + QHash *scopes = m_signalScopes; #endif if (!scopes) { scopes = new QHash; // usually not all methods are signals - scopes->reserve(_metaObject->methodCount() / 2); - for (int index = 0; index < _metaObject->methodCount(); ++index) { - const FakeMetaMethod &method = _metaObject->method(index); + scopes->reserve(m_metaObject->methodCount() / 2); + for (int index = 0; index < m_metaObject->methodCount(); ++index) { + const FakeMetaMethod &method = m_metaObject->method(index); if (method.methodType() != FakeMetaMethod::Signal || method.access() == FakeMetaMethod::Private) continue; @@ -499,12 +499,12 @@ const ObjectValue *CppComponentValue::signalScope(const QString &signalName) con } scopes->insert(generatedSlotName(method.methodName()), scope); } - if (!_signalScopes.testAndSetOrdered(0, scopes)) { + if (!m_signalScopes.testAndSetOrdered(0, scopes)) { delete scopes; #if QT_VERSION >= 0x050000 - scopes = _signalScopes.load(); + scopes = m_signalScopes.load(); #else - scopes = _signalScopes; + scopes = m_signalScopes; #endif } } @@ -515,7 +515,7 @@ const ObjectValue *CppComponentValue::signalScope(const QString &signalName) con bool CppComponentValue::isWritable(const QString &propertyName) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) return iter->property(propIdx).isWritable(); @@ -526,7 +526,7 @@ bool CppComponentValue::isWritable(const QString &propertyName) const bool CppComponentValue::isPointer(const QString &propertyName) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) return iter->property(propIdx).isPointer(); @@ -536,7 +536,7 @@ bool CppComponentValue::isPointer(const QString &propertyName) const bool CppComponentValue::hasLocalProperty(const QString &typeName) const { - int idx = _metaObject->propertyIndex(typeName); + int idx = m_metaObject->propertyIndex(typeName); if (idx == -1) return false; return true; @@ -545,7 +545,7 @@ bool CppComponentValue::hasLocalProperty(const QString &typeName) const bool CppComponentValue::hasProperty(const QString &propertyName) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; int propIdx = iter->propertyIndex(propertyName); if (propIdx != -1) return true; @@ -556,7 +556,7 @@ bool CppComponentValue::hasProperty(const QString &propertyName) const bool CppComponentValue::isDerivedFrom(FakeMetaObject::ConstPtr base) const { foreach (const CppComponentValue *it, prototypes()) { - FakeMetaObject::ConstPtr iter = it->_metaObject; + FakeMetaObject::ConstPtr iter = it->m_metaObject; if (iter == base) return true; } @@ -564,8 +564,8 @@ bool CppComponentValue::isDerivedFrom(FakeMetaObject::ConstPtr base) const } QmlEnumValue::QmlEnumValue(const CppComponentValue *owner, int enumIndex) - : _owner(owner) - , _enumIndex(enumIndex) + : m_owner(owner) + , m_enumIndex(enumIndex) { owner->valueOwner()->registerValue(this); } @@ -581,17 +581,17 @@ const QmlEnumValue *QmlEnumValue::asQmlEnumValue() const QString QmlEnumValue::name() const { - return _owner->metaObject()->enumerator(_enumIndex).name(); + return m_owner->metaObject()->enumerator(m_enumIndex).name(); } QStringList QmlEnumValue::keys() const { - return _owner->metaObject()->enumerator(_enumIndex).keys(); + return m_owner->metaObject()->enumerator(m_enumIndex).keys(); } const CppComponentValue *QmlEnumValue::owner() const { - return _owner; + return m_owner; } //////////////////////////////////////////////////////////////////////////////// @@ -878,9 +878,9 @@ void StringValue::accept(ValueVisitor *visitor) const } Reference::Reference(ValueOwner *valueOwner) - : _valueOwner(valueOwner) + : m_valueOwner(valueOwner) { - _valueOwner->registerValue(this); + m_valueOwner->registerValue(this); } Reference::~Reference() @@ -889,7 +889,7 @@ Reference::~Reference() ValueOwner *Reference::valueOwner() const { - return _valueOwner; + return m_valueOwner; } const Reference *Reference::asReference() const @@ -904,7 +904,7 @@ void Reference::accept(ValueVisitor *visitor) const const Value *Reference::value(ReferenceContext *) const { - return _valueOwner->undefinedValue(); + return m_valueOwner->undefinedValue(); } void ColorValue::accept(ValueVisitor *visitor) const @@ -961,7 +961,7 @@ bool MemberProcessor::processGeneratedSlot(const QString &, const Value *) } ObjectValue::ObjectValue(ValueOwner *valueOwner) - : _valueOwner(valueOwner), + : m_valueOwner(valueOwner), _prototype(0) { valueOwner->registerValue(this); @@ -973,17 +973,17 @@ ObjectValue::~ObjectValue() ValueOwner *ObjectValue::valueOwner() const { - return _valueOwner; + return m_valueOwner; } QString ObjectValue::className() const { - return _className; + return m_className; } void ObjectValue::setClassName(const QString &className) { - _className = className; + m_className = className; } const Value *ObjectValue::prototype() const @@ -1008,12 +1008,12 @@ void ObjectValue::setPrototype(const Value *prototype) void ObjectValue::setMember(const QString &name, const Value *value) { - _members[name] = value; + m_members[name] = value; } void ObjectValue::removeMember(const QString &name) { - _members.remove(name); + m_members.remove(name); } const ObjectValue *ObjectValue::asObjectValue() const @@ -1047,7 +1047,7 @@ bool ObjectValue::checkPrototype(const ObjectValue *, QSet void ObjectValue::processMembers(MemberProcessor *processor) const { - QHashIterator it(_members); + QHashIterator it(m_members); while (it.hasNext()) { it.next(); @@ -1061,7 +1061,7 @@ const Value *ObjectValue::lookupMember(const QString &name, const Context *conte const ObjectValue **foundInObject, bool examinePrototypes) const { - if (const Value *m = _members.value(name)) { + if (const Value *m = m_members.value(name)) { if (foundInObject) *foundInObject = this; return m; @@ -1219,9 +1219,9 @@ void FunctionValue::accept(ValueVisitor *visitor) const Function::Function(ValueOwner *valueOwner) : FunctionValue(valueOwner) - , _returnValue(0) - , _optionalNamedArgumentCount(0) - , _isVariadic(false) + , m_returnValue(0) + , m_optionalNamedArgumentCount(0) + , m_isVariadic(false) { } @@ -1232,61 +1232,61 @@ Function::~Function() void Function::addArgument(const Value *argument, const QString &name) { if (!name.isEmpty()) { - while (_argumentNames.size() < _arguments.size()) - _argumentNames.push_back(QString()); - _argumentNames.push_back(name); + while (m_argumentNames.size() < m_arguments.size()) + m_argumentNames.push_back(QString()); + m_argumentNames.push_back(name); } - _arguments.push_back(argument); + m_arguments.push_back(argument); } const Value *Function::returnValue() const { - return _returnValue; + return m_returnValue; } void Function::setReturnValue(const Value *returnValue) { - _returnValue = returnValue; + m_returnValue = returnValue; } void Function::setVariadic(bool variadic) { - _isVariadic = variadic; + m_isVariadic = variadic; } void Function::setOptionalNamedArgumentCount(int count) { - _optionalNamedArgumentCount = count; + m_optionalNamedArgumentCount = count; } int Function::namedArgumentCount() const { - return _arguments.size(); + return m_arguments.size(); } int Function::optionalNamedArgumentCount() const { - return _optionalNamedArgumentCount; + return m_optionalNamedArgumentCount; } const Value *Function::argument(int index) const { - return _arguments.at(index); + return m_arguments.at(index); } QString Function::argumentName(int index) const { - if (index < _argumentNames.size()) { - const QString name = _argumentNames.at(index); + if (index < m_argumentNames.size()) { + const QString name = m_argumentNames.at(index); if (!name.isEmpty()) - return _argumentNames.at(index); + return m_argumentNames.at(index); } return FunctionValue::argumentName(index); } bool Function::isVariadic() const { - return _isVariadic; + return m_isVariadic; } const Function *Function::asFunction() const @@ -1364,8 +1364,8 @@ void CppQmlTypesLoader::parseQmlTypeDescriptions(const QByteArray &contents, } CppQmlTypes::CppQmlTypes(ValueOwner *valueOwner) - : _cppContextProperties(0) - , _valueOwner(valueOwner) + : m_cppContextProperties(0) + , m_valueOwner(valueOwner) { } @@ -1382,7 +1382,7 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) QString package = exp.package; if (package.isEmpty()) package = overridePackage; - _fakeMetaObjectsByPackage[package].insert(fmo); + m_fakeMetaObjectsByPackage[package].insert(fmo); // make versionless cpp types directly // needed for access to property types that are not exported, like QDeclarativeAnchors @@ -1391,8 +1391,8 @@ void CppQmlTypes::load(const T &fakeMetaObjects, const QString &overridePackage) QTC_ASSERT(exp.type == fmo->className(), continue); CppComponentValue *cppValue = new CppComponentValue( fmo, fmo->className(), cppPackage, ComponentVersion(), ComponentVersion(), - ComponentVersion::MaxVersion, _valueOwner); - _objectsByQualifiedName[qualifiedName(cppPackage, fmo->className(), ComponentVersion())] = cppValue; + ComponentVersion::MaxVersion, m_valueOwner); + m_objectsByQualifiedName[qualifiedName(cppPackage, fmo->className(), ComponentVersion())] = cppValue; newCppTypes += cppValue; } } @@ -1417,7 +1417,7 @@ QList CppQmlTypes::createObjectsForImport(const QStri QList newObjects; // make new exported objects - foreach (const FakeMetaObject::ConstPtr &fmo, _fakeMetaObjectsByPackage.value(package)) { + foreach (const FakeMetaObject::ConstPtr &fmo, m_fakeMetaObjectsByPackage.value(package)) { // find the highest-version export for each alias QHash bestExports; foreach (const FakeMetaObject::Export &exp, fmo->exports()) { @@ -1436,7 +1436,7 @@ QList CppQmlTypes::createObjectsForImport(const QStri // if it already exists, skip const QString key = qualifiedName(package, fmo->className(), version); - if (_objectsByQualifiedName.contains(key)) + if (m_objectsByQualifiedName.contains(key)) continue; foreach (const FakeMetaObject::Export &bestExport, bestExports) { @@ -1449,10 +1449,10 @@ QList CppQmlTypes::createObjectsForImport(const QStri CppComponentValue *newComponent = new CppComponentValue( fmo, name, package, bestExport.version, version, - bestExport.metaObjectRevision, _valueOwner); + bestExport.metaObjectRevision, m_valueOwner); // use package.cppname importversion as key - _objectsByQualifiedName.insert(key, newComponent); + m_objectsByQualifiedName.insert(key, newComponent); if (exported) { if (!exportedObjects.contains(name) // we might have the same type in different versions || (newComponent->componentVersion() > exportedObjects.value(name)->componentVersion())) @@ -1472,7 +1472,7 @@ QList CppQmlTypes::createObjectsForImport(const QStri // if the prototype already exists, done const QString key = qualifiedName(object->moduleName(), protoCppName, version); - if (const CppComponentValue *proto = _objectsByQualifiedName.value(key)) { + if (const CppComponentValue *proto = m_objectsByQualifiedName.value(key)) { object->setPrototype(proto); break; } @@ -1486,8 +1486,8 @@ QList CppQmlTypes::createObjectsForImport(const QStri // make a new object CppComponentValue *proto = new CppComponentValue( protoFmo, protoCppName, object->moduleName(), ComponentVersion(), - object->importVersion(), ComponentVersion::MaxVersion, _valueOwner); - _objectsByQualifiedName.insert(key, proto); + object->importVersion(), ComponentVersion::MaxVersion, m_valueOwner); + m_objectsByQualifiedName.insert(key, proto); object->setPrototype(proto); // maybe set prototype of prototype @@ -1500,7 +1500,7 @@ QList CppQmlTypes::createObjectsForImport(const QStri bool CppQmlTypes::hasModule(const QString &module) const { - return _fakeMetaObjectsByPackage.contains(module); + return m_fakeMetaObjectsByPackage.contains(module); } QString CppQmlTypes::qualifiedName(const QString &module, const QString &type, ComponentVersion version) @@ -1513,7 +1513,7 @@ QString CppQmlTypes::qualifiedName(const QString &module, const QString &type, C const CppComponentValue *CppQmlTypes::objectByQualifiedName(const QString &name) const { - return _objectsByQualifiedName.value(name); + return m_objectsByQualifiedName.value(name); } const CppComponentValue *CppQmlTypes::objectByQualifiedName(const QString &package, const QString &type, @@ -1529,17 +1529,17 @@ const CppComponentValue *CppQmlTypes::objectByCppName(const QString &cppName) co void CppQmlTypes::setCppContextProperties(const ObjectValue *contextProperties) { - _cppContextProperties = contextProperties; + m_cppContextProperties = contextProperties; } const ObjectValue *CppQmlTypes::cppContextProperties() const { - return _cppContextProperties; + return m_cppContextProperties; } ConvertToNumber::ConvertToNumber(ValueOwner *valueOwner) - : _valueOwner(valueOwner), _result(0) + : m_valueOwner(valueOwner), m_result(0) { } @@ -1555,41 +1555,41 @@ const Value *ConvertToNumber::operator()(const Value *value) const Value *ConvertToNumber::switchResult(const Value *value) { - const Value *previousResult = _result; - _result = value; + const Value *previousResult = m_result; + m_result = value; return previousResult; } void ConvertToNumber::visit(const NullValue *) { - _result = _valueOwner->numberValue(); + m_result = m_valueOwner->numberValue(); } void ConvertToNumber::visit(const UndefinedValue *) { - _result = _valueOwner->numberValue(); + m_result = m_valueOwner->numberValue(); } void ConvertToNumber::visit(const NumberValue *value) { - _result = value; + m_result = value; } void ConvertToNumber::visit(const BooleanValue *) { - _result = _valueOwner->numberValue(); + m_result = m_valueOwner->numberValue(); } void ConvertToNumber::visit(const StringValue *) { - _result = _valueOwner->numberValue(); + m_result = m_valueOwner->numberValue(); } void ConvertToNumber::visit(const ObjectValue *object) { if (const FunctionValue *valueOfMember = value_cast( object->lookupMember(QLatin1String("valueOf"), ContextPtr()))) { - _result = value_cast(valueOfMember->returnValue()); + m_result = value_cast(valueOfMember->returnValue()); } } @@ -1597,12 +1597,12 @@ void ConvertToNumber::visit(const FunctionValue *object) { if (const FunctionValue *valueOfMember = value_cast( object->lookupMember(QLatin1String("valueOf"), ContextPtr()))) { - _result = value_cast(valueOfMember->returnValue()); + m_result = value_cast(valueOfMember->returnValue()); } } ConvertToString::ConvertToString(ValueOwner *valueOwner) - : _valueOwner(valueOwner), _result(0) + : m_valueOwner(valueOwner), m_result(0) { } @@ -1618,41 +1618,41 @@ const Value *ConvertToString::operator()(const Value *value) const Value *ConvertToString::switchResult(const Value *value) { - const Value *previousResult = _result; - _result = value; + const Value *previousResult = m_result; + m_result = value; return previousResult; } void ConvertToString::visit(const NullValue *) { - _result = _valueOwner->stringValue(); + m_result = m_valueOwner->stringValue(); } void ConvertToString::visit(const UndefinedValue *) { - _result = _valueOwner->stringValue(); + m_result = m_valueOwner->stringValue(); } void ConvertToString::visit(const NumberValue *) { - _result = _valueOwner->stringValue(); + m_result = m_valueOwner->stringValue(); } void ConvertToString::visit(const BooleanValue *) { - _result = _valueOwner->stringValue(); + m_result = m_valueOwner->stringValue(); } void ConvertToString::visit(const StringValue *value) { - _result = value; + m_result = value; } void ConvertToString::visit(const ObjectValue *object) { if (const FunctionValue *toStringMember = value_cast( object->lookupMember(QLatin1String("toString"), ContextPtr()))) { - _result = value_cast(toStringMember->returnValue()); + m_result = value_cast(toStringMember->returnValue()); } } @@ -1660,12 +1660,12 @@ void ConvertToString::visit(const FunctionValue *object) { if (const FunctionValue *toStringMember = value_cast( object->lookupMember(QLatin1String("toString"), ContextPtr()))) { - _result = value_cast(toStringMember->returnValue()); + m_result = value_cast(toStringMember->returnValue()); } } ConvertToObject::ConvertToObject(ValueOwner *valueOwner) - : _valueOwner(valueOwner), _result(0) + : m_valueOwner(valueOwner), m_result(0) { } @@ -1681,44 +1681,44 @@ const Value *ConvertToObject::operator()(const Value *value) const Value *ConvertToObject::switchResult(const Value *value) { - const Value *previousResult = _result; - _result = value; + const Value *previousResult = m_result; + m_result = value; return previousResult; } void ConvertToObject::visit(const NullValue *value) { - _result = value; + m_result = value; } void ConvertToObject::visit(const UndefinedValue *) { - _result = _valueOwner->nullValue(); + m_result = m_valueOwner->nullValue(); } void ConvertToObject::visit(const NumberValue *) { - _result = _valueOwner->numberCtor()->returnValue(); + m_result = m_valueOwner->numberCtor()->returnValue(); } void ConvertToObject::visit(const BooleanValue *) { - _result = _valueOwner->booleanCtor()->returnValue(); + m_result = m_valueOwner->booleanCtor()->returnValue(); } void ConvertToObject::visit(const StringValue *) { - _result = _valueOwner->stringCtor()->returnValue(); + m_result = m_valueOwner->stringCtor()->returnValue(); } void ConvertToObject::visit(const ObjectValue *object) { - _result = object; + m_result = object; } void ConvertToObject::visit(const FunctionValue *object) { - _result = object; + m_result = object; } QString TypeId::operator()(const Value *value) @@ -1786,20 +1786,20 @@ ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName, UiObjectInitializer *initializer, const Document *doc, ValueOwner *valueOwner) - : ObjectValue(valueOwner), _typeName(typeName), _initializer(initializer), _doc(doc), _defaultPropertyRef(0) + : ObjectValue(valueOwner), m_typeName(typeName), m_initializer(initializer), m_doc(doc), m_defaultPropertyRef(0) { - if (_initializer) { - for (UiObjectMemberList *it = _initializer->members; it; it = it->next) { + if (m_initializer) { + for (UiObjectMemberList *it = m_initializer->members; it; it = it->next) { UiObjectMember *member = it->member; if (UiPublicMember *def = cast(member)) { if (def->type == UiPublicMember::Property && !def->name.isEmpty() && !def->memberType.isEmpty()) { - ASTPropertyReference *ref = new ASTPropertyReference(def, _doc, valueOwner); - _properties.append(ref); + ASTPropertyReference *ref = new ASTPropertyReference(def, m_doc, valueOwner); + m_properties.append(ref); if (def->defaultToken.isValid()) - _defaultPropertyRef = ref; + m_defaultPropertyRef = ref; } else if (def->type == UiPublicMember::Signal && !def->name.isEmpty()) { - ASTSignal *ref = new ASTSignal(def, _doc, valueOwner); - _signals.append(ref); + ASTSignal *ref = new ASTSignal(def, m_doc, valueOwner); + m_signals.append(ref); } } } @@ -1817,20 +1817,20 @@ const ASTObjectValue *ASTObjectValue::asAstObjectValue() const bool ASTObjectValue::getSourceLocation(QString *fileName, int *line, int *column) const { - *fileName = _doc->fileName(); - *line = _typeName->identifierToken.startLine; - *column = _typeName->identifierToken.startColumn; + *fileName = m_doc->fileName(); + *line = m_typeName->identifierToken.startLine; + *column = m_typeName->identifierToken.startColumn; return true; } void ASTObjectValue::processMembers(MemberProcessor *processor) const { - foreach (ASTPropertyReference *ref, _properties) { + foreach (ASTPropertyReference *ref, m_properties) { processor->processProperty(ref->ast()->name.toString(), ref); // ### Should get a different value? processor->processGeneratedSlot(ref->onChangedSlotName(), ref); } - foreach (ASTSignal *ref, _signals) { + foreach (ASTSignal *ref, m_signals) { processor->processSignal(ref->ast()->name.toString(), ref); // ### Should get a different value? processor->processGeneratedSlot(ref->slotName(), ref); @@ -1841,8 +1841,8 @@ void ASTObjectValue::processMembers(MemberProcessor *processor) const QString ASTObjectValue::defaultPropertyName() const { - if (_defaultPropertyRef) { - UiPublicMember *prop = _defaultPropertyRef->ast(); + if (m_defaultPropertyRef) { + UiPublicMember *prop = m_defaultPropertyRef->ast(); if (prop) return prop->name.toString(); } @@ -1851,23 +1851,23 @@ QString ASTObjectValue::defaultPropertyName() const UiObjectInitializer *ASTObjectValue::initializer() const { - return _initializer; + return m_initializer; } UiQualifiedId *ASTObjectValue::typeName() const { - return _typeName; + return m_typeName; } const Document *ASTObjectValue::document() const { - return _doc; + return m_doc; } ASTVariableReference::ASTVariableReference(VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner) - , _ast(ast) - , _doc(doc) + , m_ast(ast) + , m_doc(doc) { } @@ -1882,45 +1882,45 @@ const ASTVariableReference *ASTVariableReference::asAstVariableReference() const const VariableDeclaration *ASTVariableReference::ast() const { - return _ast; + return m_ast; } const Value *ASTVariableReference::value(ReferenceContext *referenceContext) const { // may be assigned to later - if (!_ast->expression) + if (!m_ast->expression) return valueOwner()->unknownValue(); - Document::Ptr doc = _doc->ptr(); + Document::Ptr doc = m_doc->ptr(); ScopeChain scopeChain(doc, referenceContext->context()); ScopeBuilder builder(&scopeChain); - builder.push(ScopeAstPath(doc)(_ast->expression->firstSourceLocation().begin())); + builder.push(ScopeAstPath(doc)(m_ast->expression->firstSourceLocation().begin())); Evaluate evaluator(&scopeChain, referenceContext); - return evaluator(_ast->expression); + return evaluator(m_ast->expression); } bool ASTVariableReference::getSourceLocation(QString *fileName, int *line, int *column) const { - *fileName = _doc->fileName(); - *line = _ast->identifierToken.startLine; - *column = _ast->identifierToken.startColumn; + *fileName = m_doc->fileName(); + *line = m_ast->identifierToken.startLine; + *column = m_ast->identifierToken.startColumn; return true; } namespace { class UsesArgumentsArray : protected Visitor { - bool _usesArgumentsArray; + bool m_usesArgumentsArray; public: bool operator()(FunctionBody *ast) { if (!ast || !ast->elements) return false; - _usesArgumentsArray = false; + m_usesArgumentsArray = false; Node::accept(ast->elements, this); - return _usesArgumentsArray; + return m_usesArgumentsArray; } protected: @@ -1928,7 +1928,7 @@ protected: { if (IdentifierExpression *idExp = cast(ast->base)) { if (idExp->name == QLatin1String("arguments")) - _usesArgumentsArray = true; + m_usesArgumentsArray = true; } return true; } @@ -1940,15 +1940,15 @@ protected: ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const Document *doc, ValueOwner *valueOwner) : FunctionValue(valueOwner) - , _ast(ast) - , _doc(doc) + , m_ast(ast) + , m_doc(doc) { setPrototype(valueOwner->functionPrototype()); for (FormalParameterList *it = ast->formals; it; it = it->next) - _argumentNames.append(it->name.toString()); + m_argumentNames.append(it->name.toString()); - _isVariadic = UsesArgumentsArray()(ast->body); + m_isVariadic = UsesArgumentsArray()(ast->body); } ASTFunctionValue::~ASTFunctionValue() @@ -1957,18 +1957,18 @@ ASTFunctionValue::~ASTFunctionValue() FunctionExpression *ASTFunctionValue::ast() const { - return _ast; + return m_ast; } int ASTFunctionValue::namedArgumentCount() const { - return _argumentNames.size(); + return m_argumentNames.size(); } QString ASTFunctionValue::argumentName(int index) const { - if (index < _argumentNames.size()) { - const QString &name = _argumentNames.at(index); + if (index < m_argumentNames.size()) { + const QString &name = m_argumentNames.at(index); if (!name.isEmpty()) return name; } @@ -1978,7 +1978,7 @@ QString ASTFunctionValue::argumentName(int index) const bool ASTFunctionValue::isVariadic() const { - return _isVariadic; + return m_isVariadic; } const ASTFunctionValue *ASTFunctionValue::asAstFunctionValue() const @@ -1988,17 +1988,17 @@ const ASTFunctionValue *ASTFunctionValue::asAstFunctionValue() const bool ASTFunctionValue::getSourceLocation(QString *fileName, int *line, int *column) const { - *fileName = _doc->fileName(); - *line = _ast->identifierToken.startLine; - *column = _ast->identifierToken.startColumn; + *fileName = m_doc->fileName(); + *line = m_ast->identifierToken.startLine; + *column = m_ast->identifierToken.startColumn; return true; } QmlPrototypeReference::QmlPrototypeReference(UiQualifiedId *qmlTypeName, const Document *doc, ValueOwner *valueOwner) : Reference(valueOwner), - _qmlTypeName(qmlTypeName), - _doc(doc) + m_qmlTypeName(qmlTypeName), + m_doc(doc) { } @@ -2013,20 +2013,20 @@ const QmlPrototypeReference *QmlPrototypeReference::asQmlPrototypeReference() co UiQualifiedId *QmlPrototypeReference::qmlTypeName() const { - return _qmlTypeName; + return m_qmlTypeName; } const Value *QmlPrototypeReference::value(ReferenceContext *referenceContext) const { - return referenceContext->context()->lookupType(_doc, _qmlTypeName); + return referenceContext->context()->lookupType(m_doc, m_qmlTypeName); } ASTPropertyReference::ASTPropertyReference(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner) - : Reference(valueOwner), _ast(ast), _doc(doc) + : Reference(valueOwner), m_ast(ast), m_doc(doc) { const QString &propertyName = ast->name.toString(); - _onChangedSlotName = generatedSlotName(propertyName); - _onChangedSlotName += QLatin1String("Changed"); + m_onChangedSlotName = generatedSlotName(propertyName); + m_onChangedSlotName += QLatin1String("Changed"); } ASTPropertyReference::~ASTPropertyReference() @@ -2040,42 +2040,42 @@ const ASTPropertyReference *ASTPropertyReference::asAstPropertyReference() const bool ASTPropertyReference::getSourceLocation(QString *fileName, int *line, int *column) const { - *fileName = _doc->fileName(); - *line = _ast->identifierToken.startLine; - *column = _ast->identifierToken.startColumn; + *fileName = m_doc->fileName(); + *line = m_ast->identifierToken.startLine; + *column = m_ast->identifierToken.startColumn; return true; } const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) const { - if (_ast->statement - && (_ast->memberType.isEmpty() - || _ast->memberType == QLatin1String("variant") - || _ast->memberType == QLatin1String("var") - || _ast->memberType == QLatin1String("alias"))) { + if (m_ast->statement + && (m_ast->memberType.isEmpty() + || m_ast->memberType == QLatin1String("variant") + || m_ast->memberType == QLatin1String("var") + || m_ast->memberType == QLatin1String("alias"))) { // Adjust the context for the current location - expensive! // ### Improve efficiency by caching the 'use chain' constructed in ScopeBuilder. - Document::Ptr doc = _doc->ptr(); + Document::Ptr doc = m_doc->ptr(); ScopeChain scopeChain(doc, referenceContext->context()); ScopeBuilder builder(&scopeChain); - int offset = _ast->statement->firstSourceLocation().begin(); + int offset = m_ast->statement->firstSourceLocation().begin(); builder.push(ScopeAstPath(doc)(offset)); Evaluate evaluator(&scopeChain, referenceContext); - return evaluator(_ast->statement); + return evaluator(m_ast->statement); } - const QString memberType = _ast->memberType.toString(); + const QString memberType = m_ast->memberType.toString(); const Value *builtin = valueOwner()->defaultValueForBuiltinType(memberType); if (!builtin->asUndefinedValue()) return builtin; - if (_ast->typeModifier.isEmpty()) { - const Value *type = referenceContext->context()->lookupType(_doc, QStringList(memberType)); + if (m_ast->typeModifier.isEmpty()) { + const Value *type = referenceContext->context()->lookupType(m_doc, QStringList(memberType)); if (type) return type; } @@ -2084,17 +2084,17 @@ const Value *ASTPropertyReference::value(ReferenceContext *referenceContext) con } ASTSignal::ASTSignal(UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner) - : FunctionValue(valueOwner), _ast(ast), _doc(doc) + : FunctionValue(valueOwner), m_ast(ast), m_doc(doc) { const QString &signalName = ast->name.toString(); - _slotName = generatedSlotName(signalName); + m_slotName = generatedSlotName(signalName); ObjectValue *v = valueOwner->newObject(/*prototype=*/0); for (UiParameterList *it = ast->parameters; it; it = it->next) { if (!it->name.isEmpty()) v->setMember(it->name.toString(), valueOwner->defaultValueForBuiltinType(it->type.toString())); } - _bodyScope = v; + m_bodyScope = v; } ASTSignal::~ASTSignal() @@ -2109,14 +2109,14 @@ const ASTSignal *ASTSignal::asAstSignal() const int ASTSignal::namedArgumentCount() const { int count = 0; - for (UiParameterList *it = _ast->parameters; it; it = it->next) + for (UiParameterList *it = m_ast->parameters; it; it = it->next) ++count; return count; } const Value *ASTSignal::argument(int index) const { - UiParameterList *param = _ast->parameters; + UiParameterList *param = m_ast->parameters; for (int i = 0; param && i < index; ++i) param = param->next; if (!param || param->type.isEmpty()) @@ -2126,7 +2126,7 @@ const Value *ASTSignal::argument(int index) const QString ASTSignal::argumentName(int index) const { - UiParameterList *param = _ast->parameters; + UiParameterList *param = m_ast->parameters; for (int i = 0; param && i < index; ++i) param = param->next; if (!param || param->name.isEmpty()) @@ -2136,16 +2136,16 @@ QString ASTSignal::argumentName(int index) const bool ASTSignal::getSourceLocation(QString *fileName, int *line, int *column) const { - *fileName = _doc->fileName(); - *line = _ast->identifierToken.startLine; - *column = _ast->identifierToken.startColumn; + *fileName = m_doc->fileName(); + *line = m_ast->identifierToken.startLine; + *column = m_ast->identifierToken.startColumn; return true; } ImportInfo::ImportInfo() - : _type(ImportType::Invalid) - , _ast(0) + : m_type(ImportType::Invalid) + , m_ast(0) { } @@ -2159,13 +2159,13 @@ ImportInfo ImportInfo::moduleImport(QString uri, ComponentVersion version, } ImportInfo info; - info._type = ImportType::Library; - info._name = uri; - info._path = uri; - info._path.replace(QLatin1Char('.'), QDir::separator()); - info._version = version; - info._as = as; - info._ast = ast; + info.m_type = ImportType::Library; + info.m_name = uri; + info.m_path = uri; + info.m_path.replace(QLatin1Char('.'), QDir::separator()); + info.m_version = version; + info.m_as = as; + info.m_ast = ast; return info; } @@ -2173,81 +2173,81 @@ ImportInfo ImportInfo::pathImport(const QString &docPath, const QString &path, ComponentVersion version, const QString &as, UiImport *ast) { ImportInfo info; - info._name = path; + info.m_name = path; QFileInfo importFileInfo(path); if (!importFileInfo.isAbsolute()) importFileInfo = QFileInfo(docPath + QDir::separator() + path); - info._path = importFileInfo.absoluteFilePath(); + info.m_path = importFileInfo.absoluteFilePath(); if (importFileInfo.isFile()) { - info._type = ImportType::File; + info.m_type = ImportType::File; } else if (importFileInfo.isDir()) { - info._type = ImportType::Directory; + info.m_type = ImportType::Directory; } else if (path.startsWith(QLatin1String("qrc:"))) { - info._path = path; + info.m_path = path; if (ModelManagerInterface::instance()->filesAtQrcPath(info.path()).isEmpty()) - info._type = ImportType::QrcDirectory; + info.m_type = ImportType::QrcDirectory; else - info._type = ImportType::QrcFile; + info.m_type = ImportType::QrcFile; } else { - info._type = ImportType::UnknownFile; + info.m_type = ImportType::UnknownFile; } - info._version = version; - info._as = as; - info._ast = ast; + info.m_version = version; + info.m_as = as; + info.m_ast = ast; return info; } ImportInfo ImportInfo::invalidImport(UiImport *ast) { ImportInfo info; - info._type = ImportType::Invalid; - info._ast = ast; + info.m_type = ImportType::Invalid; + info.m_ast = ast; return info; } ImportInfo ImportInfo::implicitDirectoryImport(const QString &directory) { ImportInfo info; - info._type = ImportType::ImplicitDirectory; - info._path = directory; + info.m_type = ImportType::ImplicitDirectory; + info.m_path = directory; return info; } bool ImportInfo::isValid() const { - return _type != ImportType::Invalid; + return m_type != ImportType::Invalid; } ImportType::Enum ImportInfo::type() const { - return _type; + return m_type; } QString ImportInfo::name() const { - return _name; + return m_name; } QString ImportInfo::path() const { - return _path; + return m_path; } QString ImportInfo::as() const { - return _as; + return m_as; } ComponentVersion ImportInfo::version() const { - return _version; + return m_version; } UiImport *ImportInfo::ast() const { - return _ast; + return m_ast; } Import::Import() @@ -2261,14 +2261,14 @@ Import::Import(const Import &other) TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner) : ObjectValue(valueOwner) - , _imports(imports) + , m_imports(imports) { } const Value *TypeScope::lookupMember(const QString &name, const Context *context, const ObjectValue **foundInObject, bool) const { - QListIterator it(_imports->all()); + QListIterator it(m_imports->all()); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); @@ -2299,7 +2299,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context void TypeScope::processMembers(MemberProcessor *processor) const { - QListIterator it(_imports->all()); + QListIterator it(m_imports->all()); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); @@ -2324,14 +2324,14 @@ const TypeScope *TypeScope::asTypeScope() const JSImportScope::JSImportScope(const Imports *imports, ValueOwner *valueOwner) : ObjectValue(valueOwner) - , _imports(imports) + , m_imports(imports) { } const Value *JSImportScope::lookupMember(const QString &name, const Context *, const ObjectValue **foundInObject, bool) const { - QListIterator it(_imports->all()); + QListIterator it(m_imports->all()); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); @@ -2356,7 +2356,7 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *, void JSImportScope::processMembers(MemberProcessor *processor) const { - QListIterator it(_imports->all()); + QListIterator it(m_imports->all()); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); @@ -2374,35 +2374,35 @@ const JSImportScope *JSImportScope::asJSImportScope() const } Imports::Imports(ValueOwner *valueOwner) - : _typeScope(new TypeScope(this, valueOwner)) - , _jsImportScope(new JSImportScope(this, valueOwner)) - , _importFailed(false) + : m_typeScope(new TypeScope(this, valueOwner)) + , m_jsImportScope(new JSImportScope(this, valueOwner)) + , m_importFailed(false) {} void Imports::append(const Import &import) { // when doing lookup, imports with 'as' clause are looked at first if (!import.info.as().isEmpty()) { - _imports.append(import); + m_imports.append(import); } else { // find first as-import and prepend - for (int i = 0; i < _imports.size(); ++i) { - if (!_imports.at(i).info.as().isEmpty()) { - _imports.insert(i, import); + for (int i = 0; i < m_imports.size(); ++i) { + if (!m_imports.at(i).info.as().isEmpty()) { + m_imports.insert(i, import); return; } } // not found, append - _imports.append(import); + m_imports.append(import); } if (!import.valid) - _importFailed = true; + m_importFailed = true; } void Imports::setImportFailed() { - _importFailed = true; + m_importFailed = true; } ImportInfo Imports::info(const QString &name, const Context *context) const @@ -2412,7 +2412,7 @@ ImportInfo Imports::info(const QString &name, const Context *context) const if (dotIdx != -1) firstId = firstId.left(dotIdx); - QListIterator it(_imports); + QListIterator it(m_imports); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); @@ -2438,7 +2438,7 @@ ImportInfo Imports::info(const QString &name, const Context *context) const QString Imports::nameForImportedObject(const ObjectValue *value, const Context *context) const { - QListIterator it(_imports); + QListIterator it(m_imports); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); @@ -2465,22 +2465,22 @@ QString Imports::nameForImportedObject(const ObjectValue *value, const Context * bool Imports::importFailed() const { - return _importFailed; + return m_importFailed; } QList Imports::all() const { - return _imports; + return m_imports; } const TypeScope *Imports::typeScope() const { - return _typeScope; + return m_typeScope; } const JSImportScope *Imports::jsImportScope() const { - return _jsImportScope; + return m_jsImportScope; } #ifdef QT_DEBUG @@ -2524,7 +2524,7 @@ public: void Imports::dump() const { qDebug() << "Imports contents, in search order:"; - QListIterator it(_imports); + QListIterator it(m_imports); it.toBack(); while (it.hasPrevious()) { const Import &i = it.previous(); diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 63755677af1..6bb48b8a6f5 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -30,59 +30,57 @@ #ifndef QMLJS_INTERPRETER_H #define QMLJS_INTERPRETER_H -#include #include #include +#include #include #include #include -#include -#include #include -#include +#include #include +#include #include +#include namespace QmlJS { - -class NameId; -class Document; - //////////////////////////////////////////////////////////////////////////////// // Forward declarations //////////////////////////////////////////////////////////////////////////////// -class ValueOwner; -class Value; -class NullValue; -class UndefinedValue; -class UnknownValue; -class NumberValue; -class IntValue; -class RealValue; -class BooleanValue; -class StringValue; -class UrlValue; -class ObjectValue; -class FunctionValue; -class Reference; -class ColorValue; -class AnchorLineValue; -class Imports; -class TypeScope; -class JSImportScope; -class Context; -typedef QSharedPointer ContextPtr; -class ReferenceContext; -class CppComponentValue; +class ASTFunctionValue; class ASTObjectValue; -class QmlEnumValue; -class QmlPrototypeReference; -class ASTVariableReference; class ASTPropertyReference; class ASTSignal; -class ASTFunctionValue; +class ASTVariableReference; +class AnchorLineValue; +class BooleanValue; +class ColorValue; +class Context; +class CppComponentValue; +class Document; class Function; +class FunctionValue; +class Imports; +class IntValue; +class JSImportScope; +class NameId; +class NullValue; +class NumberValue; +class ObjectValue; +class QmlEnumValue; +class QmlPrototypeReference; +class RealValue; +class Reference; +class ReferenceContext; +class StringValue; +class TypeScope; +class UndefinedValue; +class UnknownValue; +class UrlValue; +class Value; +class ValueOwner; +typedef QSharedPointer ContextPtr; namespace Internal { class MetaFunction; @@ -422,7 +420,7 @@ public: private: virtual const Value *value(ReferenceContext *referenceContext) const; - ValueOwner *_valueOwner; + ValueOwner *m_valueOwner; friend class ReferenceContext; }; @@ -482,9 +480,9 @@ private: bool checkPrototype(const ObjectValue *prototype, QSet *processed) const; private: - ValueOwner *_valueOwner; - QHash _members; - QString _className; + ValueOwner *m_valueOwner; + QHash m_members; + QString m_className; protected: const Value *_prototype; @@ -531,8 +529,8 @@ public: const CppComponentValue *owner() const; private: - const CppComponentValue *_owner; - int _enumIndex; + const CppComponentValue *m_owner; + int m_enumIndex; }; @@ -578,17 +576,17 @@ protected: bool isDerivedFrom(LanguageUtils::FakeMetaObject::ConstPtr base) const; private: - LanguageUtils::FakeMetaObject::ConstPtr _metaObject; - const QString _moduleName; + LanguageUtils::FakeMetaObject::ConstPtr m_metaObject; + const QString m_moduleName; // _componentVersion is the version of the export // _importVersion is the version it's imported as, used to find correct prototypes // needed in cases when B 1.0 has A 1.1 as prototype when imported as 1.1 - const LanguageUtils::ComponentVersion _componentVersion; - const LanguageUtils::ComponentVersion _importVersion; - mutable QAtomicPointer< QList > _metaSignatures; - mutable QAtomicPointer< QHash > _signalScopes; - QHash _enums; - int _metaObjectRevision; + const LanguageUtils::ComponentVersion m_componentVersion; + const LanguageUtils::ComponentVersion m_importVersion; + mutable QAtomicPointer< QList > m_metaSignatures; + mutable QAtomicPointer< QHash > m_signalScopes; + QHash m_enums; + int m_metaObjectRevision; }; class QMLJS_EXPORT FunctionValue: public ObjectValue @@ -643,11 +641,11 @@ public: const Function *asFunction() const QTC_OVERRIDE; private: - ValueList _arguments; - QStringList _argumentNames; - const Value *_returnValue; - int _optionalNamedArgumentCount; - bool _isVariadic; + ValueList m_arguments; + QStringList m_argumentNames; + const Value *m_returnValue; + int m_optionalNamedArgumentCount; + bool m_isVariadic; }; @@ -704,10 +702,10 @@ public: private: // "Package.CppName ImportVersion" -> CppComponentValue - QHash _objectsByQualifiedName; - QHash > _fakeMetaObjectsByPackage; - const ObjectValue *_cppContextProperties; - ValueOwner *_valueOwner; + QHash m_objectsByQualifiedName; + QHash > m_fakeMetaObjectsByPackage; + const ObjectValue *m_cppContextProperties; + ValueOwner *m_valueOwner; }; class ConvertToNumber: protected ValueVisitor // ECMAScript ToInt() @@ -729,8 +727,8 @@ protected: void visit(const FunctionValue *) QTC_OVERRIDE; private: - ValueOwner *_valueOwner; - const Value *_result; + ValueOwner *m_valueOwner; + const Value *m_result; }; class ConvertToString: protected ValueVisitor // ECMAScript ToString @@ -752,8 +750,8 @@ protected: void visit(const FunctionValue *) QTC_OVERRIDE; private: - ValueOwner *_valueOwner; - const Value *_result; + ValueOwner *m_valueOwner; + const Value *m_result; }; class ConvertToObject: protected ValueVisitor // ECMAScript ToObject @@ -775,8 +773,8 @@ protected: void visit(const FunctionValue *) QTC_OVERRIDE; private: - ValueOwner *_valueOwner; - const Value *_result; + ValueOwner *m_valueOwner; + const Value *m_result; }; class QMLJS_EXPORT TypeId: protected ValueVisitor @@ -812,14 +810,14 @@ public: private: const Value *value(ReferenceContext *referenceContext) const QTC_OVERRIDE; - AST::UiQualifiedId *_qmlTypeName; - const Document *_doc; + AST::UiQualifiedId *m_qmlTypeName; + const Document *m_doc; }; class QMLJS_EXPORT ASTVariableReference: public Reference { - AST::VariableDeclaration *_ast; - const Document *_doc; + AST::VariableDeclaration *m_ast; + const Document *m_doc; public: ASTVariableReference(AST::VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner); @@ -833,10 +831,10 @@ private: class QMLJS_EXPORT ASTFunctionValue: public FunctionValue { - AST::FunctionExpression *_ast; - const Document *_doc; - QList _argumentNames; - bool _isVariadic; + AST::FunctionExpression *m_ast; + const Document *m_doc; + QList m_argumentNames; + bool m_isVariadic; public: ASTFunctionValue(AST::FunctionExpression *ast, const Document *doc, ValueOwner *valueOwner); @@ -854,9 +852,9 @@ public: class QMLJS_EXPORT ASTPropertyReference: public Reference { - AST::UiPublicMember *_ast; - const Document *_doc; - QString _onChangedSlotName; + AST::UiPublicMember *m_ast; + const Document *m_doc; + QString m_onChangedSlotName; public: ASTPropertyReference(AST::UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner); @@ -864,8 +862,8 @@ public: const ASTPropertyReference *asAstPropertyReference() const QTC_OVERRIDE; - AST::UiPublicMember *ast() const { return _ast; } - QString onChangedSlotName() const { return _onChangedSlotName; } + AST::UiPublicMember *ast() const { return m_ast; } + QString onChangedSlotName() const { return m_onChangedSlotName; } bool getSourceLocation(QString *fileName, int *line, int *column) const QTC_OVERRIDE; @@ -875,10 +873,10 @@ private: class QMLJS_EXPORT ASTSignal: public FunctionValue { - AST::UiPublicMember *_ast; - const Document *_doc; - QString _slotName; - const ObjectValue *_bodyScope; + AST::UiPublicMember *m_ast; + const Document *m_doc; + QString m_slotName; + const ObjectValue *m_bodyScope; public: ASTSignal(AST::UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner); @@ -886,9 +884,9 @@ public: const ASTSignal *asAstSignal() const QTC_OVERRIDE; - AST::UiPublicMember *ast() const { return _ast; } - QString slotName() const { return _slotName; } - const ObjectValue *bodyScope() const { return _bodyScope; } + AST::UiPublicMember *ast() const { return m_ast; } + QString slotName() const { return m_slotName; } + const ObjectValue *bodyScope() const { return m_bodyScope; } // FunctionValue interface int namedArgumentCount() const QTC_OVERRIDE; @@ -901,12 +899,12 @@ public: class QMLJS_EXPORT ASTObjectValue: public ObjectValue { - AST::UiQualifiedId *_typeName; - AST::UiObjectInitializer *_initializer; - const Document *_doc; - QList _properties; - QList _signals; - ASTPropertyReference *_defaultPropertyRef; + AST::UiQualifiedId *m_typeName; + AST::UiObjectInitializer *m_initializer; + const Document *m_doc; + QList m_properties; + QList m_signals; + ASTPropertyReference *m_defaultPropertyRef; public: ASTObjectValue(AST::UiQualifiedId *typeName, @@ -958,12 +956,12 @@ public: AST::UiImport *ast() const; private: - ImportType::Enum _type; - LanguageUtils::ComponentVersion _version; - QString _name; - QString _path; - QString _as; - AST::UiImport *_ast; + ImportType::Enum m_type; + LanguageUtils::ComponentVersion m_version; + QString m_name; + QString m_path; + QString m_as; + AST::UiImport *m_ast; }; class QMLJS_EXPORT Import { @@ -995,7 +993,7 @@ public: void processMembers(MemberProcessor *processor) const QTC_OVERRIDE; const TypeScope *asTypeScope() const QTC_OVERRIDE; private: - const Imports *_imports; + const Imports *m_imports; }; class QMLJS_EXPORT JSImportScope: public ObjectValue @@ -1009,7 +1007,7 @@ public: void processMembers(MemberProcessor *processor) const QTC_OVERRIDE; const JSImportScope *asJSImportScope() const QTC_OVERRIDE; private: - const Imports *_imports; + const Imports *m_imports; }; class QMLJS_EXPORT Imports @@ -1036,10 +1034,10 @@ public: private: // holds imports in the order they appeared, // lookup order is back to front - QList _imports; - TypeScope *_typeScope; - JSImportScope *_jsImportScope; - bool _importFailed; + QList m_imports; + TypeScope *m_typeScope; + JSImportScope *m_jsImportScope; + bool m_importFailed; }; } // namespace QmlJS