From d67b7d17dcec2683c10cf3df1b97bfee3d9ab568 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Tue, 24 May 2011 11:50:10 +0200 Subject: [PATCH] QmlJS: Refactor ObjectValue members. * property -> lookupMember * setProperty -> setMember * removeProperty -> removeMember Change-Id: I638479ee2b90b684283e714630bdcab237f6b3f2 Done-with: Fawzi Mohamed Reviewed-on: http://codereview.qt.nokia.com/77 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com> --- src/libs/qmljs/qmljsbind.cpp | 16 +- src/libs/qmljs/qmljsevaluate.cpp | 4 +- src/libs/qmljs/qmljsinterpreter.cpp | 171 +++++++++--------- src/libs/qmljs/qmljsinterpreter.h | 9 +- src/libs/qmljs/qmljslink.cpp | 10 +- src/libs/qmljs/qmljsscopebuilder.cpp | 2 +- .../designercore/metainfo/nodemetainfo.cpp | 4 +- .../designercore/model/texttomodelmerger.cpp | 2 +- .../qmljseditor/qmljscompletionassist.cpp | 2 +- .../qmljseditor/qmljsfindreferences.cpp | 4 +- 10 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 626d8b3a9ef..e8005092ab7 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -216,7 +216,7 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia parentObjectValue = switchObjectValue(objectValue); if (parentObjectValue) - objectValue->setProperty(QLatin1String("parent"), parentObjectValue); + objectValue->setMember(QLatin1String("parent"), parentObjectValue); else { _rootObjectValue = objectValue; _rootObjectValue->setClassName(_doc->componentName()); @@ -329,7 +329,7 @@ bool Bind::visit(UiScriptBinding *ast) if (ExpressionStatement *e = cast<ExpressionStatement*>(ast->statement)) if (IdentifierExpression *i = cast<IdentifierExpression*>(e->expression)) if (i->name) - _idEnvironment->setProperty(i->name->asString(), _currentObjectValue); + _idEnvironment->setMember(i->name->asString(), _currentObjectValue); } return true; @@ -348,7 +348,7 @@ bool Bind::visit(VariableDeclaration *ast) return false; ASTVariableReference *ref = new ASTVariableReference(ast, &_engine); - _currentObjectValue->setProperty(ast->name->asString(), ref); + _currentObjectValue->setMember(ast->name->asString(), ref); return true; } @@ -360,7 +360,7 @@ bool Bind::visit(FunctionExpression *ast) ASTFunctionValue *function = new ASTFunctionValue(ast, _doc, &_engine); if (ast->name && cast<FunctionDeclaration *>(ast)) - _currentObjectValue->setProperty(ast->name->asString(), function); + _currentObjectValue->setMember(ast->name->asString(), function); // build function scope ObjectValue *functionScope = _engine.newObject(/*prototype=*/0); @@ -373,7 +373,7 @@ bool Bind::visit(FunctionExpression *ast) // 1. Function formal arguments for (FormalParameterList *it = ast->formals; it; it = it->next) { if (it->name) - functionScope->setProperty(it->name->asString(), _engine.undefinedValue()); + functionScope->setMember(it->name->asString(), _engine.undefinedValue()); } // 2. Functions defined inside the function body @@ -381,9 +381,9 @@ bool Bind::visit(FunctionExpression *ast) // 3. Arguments object ObjectValue *arguments = _engine.newObject(/*prototype=*/0); - arguments->setProperty(QLatin1String("callee"), function); - arguments->setProperty(QLatin1String("length"), _engine.numberValue()); - functionScope->setProperty(QLatin1String("arguments"), arguments); + arguments->setMember(QLatin1String("callee"), function); + arguments->setMember(QLatin1String("length"), _engine.numberValue()); + functionScope->setMember(QLatin1String("arguments"), arguments); // 4. Variables defined inside the function body // ### TODO, currently covered by the accept(body) diff --git a/src/libs/qmljs/qmljsevaluate.cpp b/src/libs/qmljs/qmljsevaluate.cpp index 0c7aa10951d..7f84fe44ea4 100644 --- a/src/libs/qmljs/qmljsevaluate.cpp +++ b/src/libs/qmljs/qmljsevaluate.cpp @@ -178,7 +178,7 @@ bool Evaluate::visit(AST::UiQualifiedId *ast) if (! name) break; - const Value *value = base->property(name->asString(), _context); + const Value *value = base->lookupMember(name->asString(), _context); if (! it->next) _result = value; else @@ -312,7 +312,7 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast) if (const Interpreter::Value *base = _engine->convertToObject(reference(ast->base))) { if (const Interpreter::ObjectValue *obj = base->asObjectValue()) { - _result = obj->property(ast->name->asString(), _context); + _result = obj->lookupMember(ast->name->asString(), _context); } } diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 48d462560ec..cecc81a8476 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -1013,7 +1013,7 @@ const Value *ObjectCtor::invoke(const Activation *activation) const thisObject->setClassName("Object"); thisObject->setPrototype(engine()->objectPrototype()); - thisObject->setProperty("length", engine()->numberValue()); + thisObject->setMember("length", engine()->numberValue()); return thisObject; } @@ -1025,7 +1025,7 @@ const Value *FunctionCtor::invoke(const Activation *activation) const thisObject->setClassName("Function"); thisObject->setPrototype(engine()->functionPrototype()); - thisObject->setProperty("length", engine()->numberValue()); + thisObject->setMember("length", engine()->numberValue()); return thisObject; } @@ -1037,7 +1037,7 @@ const Value *ArrayCtor::invoke(const Activation *activation) const thisObject->setClassName("Array"); thisObject->setPrototype(engine()->arrayPrototype()); - thisObject->setProperty("length", engine()->numberValue()); + thisObject->setMember("length", engine()->numberValue()); return thisObject; } @@ -1049,7 +1049,7 @@ const Value *StringCtor::invoke(const Activation *activation) const ObjectValue *thisObject = activation->thisObject(); thisObject->setClassName("String"); thisObject->setPrototype(engine()->stringPrototype()); - thisObject->setProperty("length", engine()->numberValue()); + thisObject->setMember("length", engine()->numberValue()); return thisObject; } @@ -1094,11 +1094,11 @@ const Value *RegExpCtor::invoke(const Activation *activation) const thisObject->setClassName("RegExp"); thisObject->setPrototype(engine()->regexpPrototype()); - thisObject->setProperty("source", engine()->stringValue()); - thisObject->setProperty("global", engine()->booleanValue()); - thisObject->setProperty("ignoreCase", engine()->booleanValue()); - thisObject->setProperty("multiline", engine()->booleanValue()); - thisObject->setProperty("lastIndex", engine()->numberValue()); + thisObject->setMember("source", engine()->stringValue()); + thisObject->setMember("global", engine()->booleanValue()); + thisObject->setMember("ignoreCase", engine()->booleanValue()); + thisObject->setMember("multiline", engine()->booleanValue()); + thisObject->setMember("lastIndex", engine()->numberValue()); return thisObject; } @@ -1454,7 +1454,7 @@ const ObjectValue *Context::lookupType(const QmlJS::Document *doc, UiQualifiedId if (! iter->name) return 0; - const Value *value = objectValue->property(iter->name->asString(), this); + const Value *value = objectValue->lookupMember(iter->name->asString(), this); if (!value) return 0; @@ -1472,7 +1472,7 @@ const ObjectValue *Context::lookupType(const QmlJS::Document *doc, const QString if (!objectValue) return 0; - const Value *value = objectValue->property(name, this); + const Value *value = objectValue->lookupMember(name, this); if (!value) return 0; @@ -1655,12 +1655,12 @@ void ObjectValue::setPrototype(const Value *prototype) _prototype = prototype; } -void ObjectValue::setProperty(const QString &name, const Value *value) +void ObjectValue::setMember(const QString &name, const Value *value) { _members[name] = value; } -void ObjectValue::removeProperty(const QString &name) +void ObjectValue::removeMember(const QString &name) { _members.remove(name); } @@ -1675,11 +1675,6 @@ void ObjectValue::accept(ValueVisitor *visitor) const visitor->visit(this); } -const Value *ObjectValue::property(const QString &name, const Context *context) const -{ - return lookupMember(name, context); -} - bool ObjectValue::checkPrototype(const ObjectValue *, QSet<const ObjectValue *> *) const { #if 0 @@ -1982,12 +1977,16 @@ const Value *Function::argument(int index) const return _arguments.at(index); } -const Value *Function::property(const QString &name, const Context *context) const +const Value *Function::lookupMember(const QString &name, const Context *context, + const ObjectValue **foundInScope, bool examinePrototypes) const { - if (name == "length") + if (name == "length") { + if (foundInScope) + *foundInScope = this; return engine()->numberValue(); + } - return FunctionValue::property(name, context); + return FunctionValue::lookupMember(name, context, foundInScope, examinePrototypes); } const Value *Function::invoke(const Activation *activation) const @@ -2717,7 +2716,7 @@ void Engine::addFunction(ObjectValue *object, const QString &name, const Value * function->setReturnValue(result); for (int i = 0; i < argumentCount; ++i) function->addArgument(undefinedValue()); // ### introduce unknownValue - object->setProperty(name, function); + object->setMember(name, function); } void Engine::addFunction(ObjectValue *object, const QString &name, int argumentCount) @@ -2725,7 +2724,7 @@ void Engine::addFunction(ObjectValue *object, const QString &name, int argumentC Function *function = newFunction(); for (int i = 0; i < argumentCount; ++i) function->addArgument(undefinedValue()); // ### introduce unknownValue - object->setProperty(name, function); + object->setMember(name, function); } void Engine::initializePrototypes() @@ -2746,42 +2745,42 @@ void Engine::initializePrototypes() // set up the default Object prototype _objectCtor = new ObjectCtor(this); _objectCtor->setPrototype(_functionPrototype); - _objectCtor->setProperty("prototype", _objectPrototype); + _objectCtor->setMember("prototype", _objectPrototype); _objectCtor->setReturnValue(newObject()); _functionCtor = new FunctionCtor(this); _functionCtor->setPrototype(_functionPrototype); - _functionCtor->setProperty("prototype", _functionPrototype); + _functionCtor->setMember("prototype", _functionPrototype); _functionCtor->setReturnValue(newFunction()); _arrayCtor = new ArrayCtor(this); _arrayCtor->setPrototype(_functionPrototype); - _arrayCtor->setProperty("prototype", _arrayPrototype); + _arrayCtor->setMember("prototype", _arrayPrototype); _arrayCtor->setReturnValue(newArray()); _stringCtor = new StringCtor(this); _stringCtor->setPrototype(_functionPrototype); - _stringCtor->setProperty("prototype", _stringPrototype); + _stringCtor->setMember("prototype", _stringPrototype); _stringCtor->setReturnValue(stringValue()); _booleanCtor = new BooleanCtor(this); _booleanCtor->setPrototype(_functionPrototype); - _booleanCtor->setProperty("prototype", _booleanPrototype); + _booleanCtor->setMember("prototype", _booleanPrototype); _booleanCtor->setReturnValue(booleanValue()); _numberCtor = new NumberCtor(this); _numberCtor->setPrototype(_functionPrototype); - _numberCtor->setProperty("prototype", _numberPrototype); + _numberCtor->setMember("prototype", _numberPrototype); _numberCtor->setReturnValue(numberValue()); _dateCtor = new DateCtor(this); _dateCtor->setPrototype(_functionPrototype); - _dateCtor->setProperty("prototype", _datePrototype); + _dateCtor->setMember("prototype", _datePrototype); _dateCtor->setReturnValue(_datePrototype); _regexpCtor = new RegExpCtor(this); _regexpCtor->setPrototype(_functionPrototype); - _regexpCtor->setProperty("prototype", _regexpPrototype); + _regexpCtor->setMember("prototype", _regexpPrototype); _regexpCtor->setReturnValue(_regexpPrototype); addFunction(_objectCtor, "getPrototypeOf", 1); @@ -2806,7 +2805,7 @@ void Engine::initializePrototypes() addFunction(_objectPrototype, "propertyIsEnumerable", booleanValue(), 1); // set up the default Function prototype - _functionPrototype->setProperty("constructor", _functionCtor); + _functionPrototype->setMember("constructor", _functionCtor); addFunction(_functionPrototype, "toString", stringValue(), 0); addFunction(_functionPrototype, "apply", 2); addFunction(_functionPrototype, "call", 1); @@ -2815,7 +2814,7 @@ void Engine::initializePrototypes() // set up the default Array prototype addFunction(_arrayCtor, "isArray", booleanValue(), 1); - _arrayPrototype->setProperty("constructor", _arrayCtor); + _arrayPrototype->setMember("constructor", _arrayCtor); addFunction(_arrayPrototype, "toString", stringValue(), 0); addFunction(_arrayPrototype, "toLocalString", stringValue(), 0); addFunction(_arrayPrototype, "concat", 0); @@ -2841,7 +2840,7 @@ void Engine::initializePrototypes() // set up the default String prototype addFunction(_stringCtor, "fromCharCode", stringValue(), 0); - _stringPrototype->setProperty("constructor", _stringCtor); + _stringPrototype->setMember("constructor", _stringCtor); addFunction(_stringPrototype, "toString", stringValue(), 0); addFunction(_stringPrototype, "valueOf", stringValue(), 0); addFunction(_stringPrototype, "charAt", stringValue(), 1); @@ -2865,20 +2864,20 @@ void Engine::initializePrototypes() // set up the default Boolean prototype addFunction(_booleanCtor, "fromCharCode", 0); - _booleanPrototype->setProperty("constructor", _booleanCtor); + _booleanPrototype->setMember("constructor", _booleanCtor); addFunction(_booleanPrototype, "toString", stringValue(), 0); addFunction(_booleanPrototype, "valueOf", booleanValue(), 0); // set up the default Number prototype - _numberCtor->setProperty("MAX_VALUE", numberValue()); - _numberCtor->setProperty("MIN_VALUE", numberValue()); - _numberCtor->setProperty("NaN", numberValue()); - _numberCtor->setProperty("NEGATIVE_INFINITY", numberValue()); - _numberCtor->setProperty("POSITIVE_INFINITY", numberValue()); + _numberCtor->setMember("MAX_VALUE", numberValue()); + _numberCtor->setMember("MIN_VALUE", numberValue()); + _numberCtor->setMember("NaN", numberValue()); + _numberCtor->setMember("NEGATIVE_INFINITY", numberValue()); + _numberCtor->setMember("POSITIVE_INFINITY", numberValue()); addFunction(_numberCtor, "fromCharCode", 0); - _numberPrototype->setProperty("constructor", _numberCtor); + _numberPrototype->setMember("constructor", _numberCtor); addFunction(_numberPrototype, "toString", stringValue(), 0); addFunction(_numberPrototype, "toLocaleString", stringValue(), 0); addFunction(_numberPrototype, "valueOf", numberValue(), 0); @@ -2888,14 +2887,14 @@ void Engine::initializePrototypes() // set up the Math object _mathObject = newObject(); - _mathObject->setProperty("E", numberValue()); - _mathObject->setProperty("LN10", numberValue()); - _mathObject->setProperty("LN2", numberValue()); - _mathObject->setProperty("LOG2E", numberValue()); - _mathObject->setProperty("LOG10E", numberValue()); - _mathObject->setProperty("PI", numberValue()); - _mathObject->setProperty("SQRT1_2", numberValue()); - _mathObject->setProperty("SQRT2", numberValue()); + _mathObject->setMember("E", numberValue()); + _mathObject->setMember("LN10", numberValue()); + _mathObject->setMember("LN2", numberValue()); + _mathObject->setMember("LOG2E", numberValue()); + _mathObject->setMember("LOG10E", numberValue()); + _mathObject->setMember("PI", numberValue()); + _mathObject->setMember("SQRT1_2", numberValue()); + _mathObject->setMember("SQRT2", numberValue()); addFunction(_mathObject, "abs", numberValue(), 1); addFunction(_mathObject, "acos", numberValue(), 1); @@ -2920,7 +2919,7 @@ void Engine::initializePrototypes() addFunction(_dateCtor, "parse", numberValue(), 1); addFunction(_dateCtor, "now", numberValue(), 0); - _datePrototype->setProperty("constructor", _dateCtor); + _datePrototype->setMember("constructor", _dateCtor); addFunction(_datePrototype, "toString", stringValue(), 0); addFunction(_datePrototype, "toDateString", stringValue(), 0); addFunction(_datePrototype, "toTimeString", stringValue(), 0); @@ -2964,21 +2963,21 @@ void Engine::initializePrototypes() addFunction(_datePrototype, "toJSON", stringValue(), 1); // set up the default Boolean prototype - _regexpPrototype->setProperty("constructor", _regexpCtor); + _regexpPrototype->setMember("constructor", _regexpCtor); addFunction(_regexpPrototype, "exec", newArray(), 1); addFunction(_regexpPrototype, "test", booleanValue(), 1); addFunction(_regexpPrototype, "toString", stringValue(), 0); // fill the Global object - _globalObject->setProperty("Math", _mathObject); - _globalObject->setProperty("Object", objectCtor()); - _globalObject->setProperty("Function", functionCtor()); - _globalObject->setProperty("Array", arrayCtor()); - _globalObject->setProperty("String", stringCtor()); - _globalObject->setProperty("Boolean", booleanCtor()); - _globalObject->setProperty("Number", numberCtor()); - _globalObject->setProperty("Date", dateCtor()); - _globalObject->setProperty("RegExp", regexpCtor()); + _globalObject->setMember("Math", _mathObject); + _globalObject->setMember("Object", objectCtor()); + _globalObject->setMember("Function", functionCtor()); + _globalObject->setMember("Array", arrayCtor()); + _globalObject->setMember("String", stringCtor()); + _globalObject->setMember("Boolean", booleanCtor()); + _globalObject->setMember("Number", numberCtor()); + _globalObject->setMember("Date", dateCtor()); + _globalObject->setMember("RegExp", regexpCtor()); // global Qt object, in alphabetic order @@ -3013,48 +3012,48 @@ void Engine::initializePrototypes() addFunction(consoleObject, QLatin1String("log"), 1); addFunction(consoleObject, QLatin1String("debug"), 1); - _globalObject->setProperty(QLatin1String("console"), consoleObject); + _globalObject->setMember(QLatin1String("console"), consoleObject); - _globalObject->setProperty(QLatin1String("Qt"), _qtObject); + _globalObject->setMember(QLatin1String("Qt"), _qtObject); // QML objects _qmlFontObject = newObject(/*prototype =*/ 0); _qmlFontObject->setClassName(QLatin1String("Font")); - _qmlFontObject->setProperty("family", stringValue()); - _qmlFontObject->setProperty("weight", undefinedValue()); // ### make me an object - _qmlFontObject->setProperty("capitalization", undefinedValue()); // ### make me an object - _qmlFontObject->setProperty("bold", booleanValue()); - _qmlFontObject->setProperty("italic", booleanValue()); - _qmlFontObject->setProperty("underline", booleanValue()); - _qmlFontObject->setProperty("overline", booleanValue()); - _qmlFontObject->setProperty("strikeout", booleanValue()); - _qmlFontObject->setProperty("pointSize", intValue()); - _qmlFontObject->setProperty("pixelSize", intValue()); - _qmlFontObject->setProperty("letterSpacing", realValue()); - _qmlFontObject->setProperty("wordSpacing", realValue()); + _qmlFontObject->setMember("family", stringValue()); + _qmlFontObject->setMember("weight", undefinedValue()); // ### make me an object + _qmlFontObject->setMember("capitalization", undefinedValue()); // ### make me an object + _qmlFontObject->setMember("bold", booleanValue()); + _qmlFontObject->setMember("italic", booleanValue()); + _qmlFontObject->setMember("underline", booleanValue()); + _qmlFontObject->setMember("overline", booleanValue()); + _qmlFontObject->setMember("strikeout", booleanValue()); + _qmlFontObject->setMember("pointSize", intValue()); + _qmlFontObject->setMember("pixelSize", intValue()); + _qmlFontObject->setMember("letterSpacing", realValue()); + _qmlFontObject->setMember("wordSpacing", realValue()); _qmlPointObject = newObject(/*prototype =*/ 0); _qmlPointObject->setClassName(QLatin1String("Point")); - _qmlPointObject->setProperty("x", numberValue()); - _qmlPointObject->setProperty("y", numberValue()); + _qmlPointObject->setMember("x", numberValue()); + _qmlPointObject->setMember("y", numberValue()); _qmlSizeObject = newObject(/*prototype =*/ 0); _qmlSizeObject->setClassName(QLatin1String("Size")); - _qmlSizeObject->setProperty("width", numberValue()); - _qmlSizeObject->setProperty("height", numberValue()); + _qmlSizeObject->setMember("width", numberValue()); + _qmlSizeObject->setMember("height", numberValue()); _qmlRectObject = newObject(/*prototype =*/ 0); _qmlRectObject->setClassName("Rect"); - _qmlRectObject->setProperty("x", numberValue()); - _qmlRectObject->setProperty("y", numberValue()); - _qmlRectObject->setProperty("width", numberValue()); - _qmlRectObject->setProperty("height", numberValue()); + _qmlRectObject->setMember("x", numberValue()); + _qmlRectObject->setMember("y", numberValue()); + _qmlRectObject->setMember("width", numberValue()); + _qmlRectObject->setMember("height", numberValue()); _qmlVector3DObject = newObject(/*prototype =*/ 0); _qmlVector3DObject->setClassName(QLatin1String("Vector3D")); - _qmlVector3DObject->setProperty("x", realValue()); - _qmlVector3DObject->setProperty("y", realValue()); - _qmlVector3DObject->setProperty("z", realValue()); + _qmlVector3DObject->setMember("x", realValue()); + _qmlVector3DObject->setMember("y", realValue()); + _qmlVector3DObject->setMember("z", realValue()); } const ObjectValue *Engine::qmlKeysObject() @@ -3491,7 +3490,7 @@ ImportInfo TypeEnvironment::importInfo(const QString &name, const Context *conte if (import->className() == firstId) return info; } else { - if (import->property(firstId, context)) + if (import->lookupMember(firstId, context)) return info; } } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index dabf949dc0a..8af4981c60b 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -408,9 +408,8 @@ public: virtual void processMembers(MemberProcessor *processor) const; - virtual const Value *property(const QString &name, const Context *context) const; - virtual void setProperty(const QString &name, const Value *value); - virtual void removeProperty(const QString &name); + virtual void setMember(const QString &name, const Value *value); + virtual void removeMember(const QString &name); virtual const Value *lookupMember(const QString &name, const Context *context, const ObjectValue **foundInObject = 0, @@ -590,7 +589,9 @@ public: void setReturnValue(const Value *returnValue); // ObjectValue interface - virtual const Value *property(const QString &name, const Context *context) const; + virtual const Value *lookupMember(const QString &name, const Context *context, + const ObjectValue **foundInObject = 0, + bool examinePrototypes = true) const; // FunctionValue interface virtual const Value *returnValue() const; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 76bb199c4d8..e18d10444d9 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -242,7 +242,7 @@ TypeEnvironment::Import Link::importFileOrDirectory(Document::Ptr doc, const Imp foreach (Document::Ptr importedDoc, documentsInDirectory) { if (importedDoc->bind()->rootObjectValue()) { const QString targetName = importedDoc->componentName(); - import.object->setProperty(targetName, importedDoc->bind()->rootObjectValue()); + import.object->setMember(targetName, importedDoc->bind()->rootObjectValue()); } } } else if (importInfo.type() == ImportInfo::FileImport) { @@ -290,7 +290,7 @@ TypeEnvironment::Import Link::importNonFile(Document::Ptr doc, const ImportInfo importFound = true; foreach (QmlObjectValue *object, engine()->cppQmlTypes().typesForImport(packageName, version)) { - import.object->setProperty(object->className(), object); + import.object->setMember(object->className(), object); } } @@ -363,7 +363,7 @@ bool Link::importLibrary(Document::Ptr doc, engine()->cppQmlTypes().load(engine(), libraryInfo.metaObjects()); foreach (QmlObjectValue *object, loadedObjects) { if (object->packageName().isEmpty()) { - import->object->setProperty(object->className(), object); + import->object->setMember(object->className(), object); } } } @@ -430,7 +430,7 @@ void Link::loadQmldirComponents(Interpreter::ObjectValue *import, ComponentVersi if (Document::Ptr importedDoc = d->snapshot.document( libraryPath + QDir::separator() + component.fileName)) { if (ObjectValue *v = importedDoc->bind()->rootObjectValue()) - import->setProperty(component.typeName, v); + import->setMember(component.typeName, v); } } } @@ -466,7 +466,7 @@ void Link::loadImplicitDefaultImports(TypeEnvironment *typeEnv) import.object = new ObjectValue(engine()); foreach (QmlObjectValue *object, engine()->cppQmlTypes().typesForImport(defaultPackage, ComponentVersion())) { - import.object->setProperty(object->className(), object); + import.object->setMember(object->className(), object); } d->importCache.insert(ImportCacheKey(info), import); } diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index ca6a81757d8..62f43c1e5c2 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -268,7 +268,7 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id) for (UiQualifiedId *it = id; it; it = it->next) { if (!it->name) return 0; - result = object->property(it->name->asString(), _context); + result = object->lookupMember(it->name->asString(), _context); if (!result) break; if (it->next) { diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 023da06b2ba..f3b64acce76 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -192,7 +192,7 @@ QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, LookupCon QString name = property.first; if (!ov->isWritable(name) && ov->isPointer(name)) { //dot property - const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov->property(name, context->context())); + const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov->lookupMember(name, context->context())); if (qmlValue) { QList<PropertyInfo> dotProperties = getQmlTypes(qmlValue, context); foreach (const PropertyInfo &propertyInfo, dotProperties) { @@ -204,7 +204,7 @@ QList<PropertyInfo> getQmlTypes(const Interpreter::QmlObjectValue *ov, LookupCon } } if (isValueType(ov->propertyType(name))) { - const Interpreter::ObjectValue *dotObjectValue = dynamic_cast<const Interpreter::ObjectValue *>(ov->property(name, context->context())); + const Interpreter::ObjectValue *dotObjectValue = dynamic_cast<const Interpreter::ObjectValue *>(ov->lookupMember(name, context->context())); if (dotObjectValue) { QList<PropertyInfo> dotProperties = getObjectTypes(dotObjectValue, context); foreach (const PropertyInfo &propertyInfo, dotProperties) { diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 41995bf2f87..6a9cf7bc2d3 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -485,7 +485,7 @@ public: Interpreter::PrototypeIterator iter(containingObject, m_context); while (iter.hasNext()) { const Interpreter::ObjectValue *proto = iter.next(); - if (proto->property(name, m_context) == m_context->engine()->arrayPrototype()) + if (proto->lookupMember(name, m_context) == m_context->engine()->arrayPrototype()) return true; if (const Interpreter::QmlObjectValue *qmlIter = dynamic_cast<const Interpreter::QmlObjectValue *>(proto)) { if (qmlIter->isListProperty(name)) diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index 3bda6afd846..e02c6353968 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -199,7 +199,7 @@ const Interpreter::Value *getPropertyValue(const Interpreter::ObjectValue *objec const Interpreter::Value *value = object; foreach (const QString &name, propertyNames) { if (const Interpreter::ObjectValue *objectValue = value->asObjectValue()) { - value = objectValue->property(name, context); + value = objectValue->lookupMember(name, context); if (!value) return 0; } else { diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 89d9a6480ab..57c120ad1b4 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -238,10 +238,10 @@ private: if (!chain || !chain->document) return false; - if (chain->document->bind()->idEnvironment()->property(_name, _context)) + if (chain->document->bind()->idEnvironment()->lookupMember(_name, _context)) return chain->document->bind()->idEnvironment() == _scope; const ObjectValue *root = chain->document->bind()->rootObjectValue(); - if (root->property(_name, _context)) { + if (root->lookupMember(_name, _context)) { return check(root); } -- GitLab