From e7a330f92a056074c294d5198c6768cd610e64b5 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Tue, 2 Feb 2010 15:54:38 +0100 Subject: [PATCH] Fixed the member lookup. We should never look at the scope chain of the base object when performing a dependant lookup. --- src/libs/qmljs/qmljsinterpreter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 9767de7c08c..75e9258eb07 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -857,7 +857,7 @@ const Value *ObjectValue::lookupMember(const QString &name) const } if (_prototype) { - if (const Value *m = _prototype->lookup(name)) + if (const Value *m = _prototype->lookupMember(name)) return m; } @@ -1090,14 +1090,14 @@ void ConvertToNumber::visit(const StringValue *) void ConvertToNumber::visit(const ObjectValue *object) { - if (const FunctionValue *valueOfMember = value_cast<const FunctionValue *>(object->lookup("valueOf"))) { + if (const FunctionValue *valueOfMember = value_cast<const FunctionValue *>(object->lookupMember("valueOf"))) { _result = value_cast<const NumberValue *>(valueOfMember->call(object)); // ### invoke convert-to-number? } } void ConvertToNumber::visit(const FunctionValue *object) { - if (const FunctionValue *valueOfMember = value_cast<const FunctionValue *>(object->lookup("valueOf"))) { + if (const FunctionValue *valueOfMember = value_cast<const FunctionValue *>(object->lookupMember("valueOf"))) { _result = value_cast<const NumberValue *>(valueOfMember->call(object)); // ### invoke convert-to-number? } } @@ -1151,14 +1151,14 @@ void ConvertToString::visit(const StringValue *value) void ConvertToString::visit(const ObjectValue *object) { - if (const FunctionValue *toStringMember = value_cast<const FunctionValue *>(object->lookup("toString"))) { + if (const FunctionValue *toStringMember = value_cast<const FunctionValue *>(object->lookupMember("toString"))) { _result = value_cast<const StringValue *>(toStringMember->call(object)); // ### invoke convert-to-string? } } void ConvertToString::visit(const FunctionValue *object) { - if (const FunctionValue *toStringMember = value_cast<const FunctionValue *>(object->lookup("toString"))) { + if (const FunctionValue *toStringMember = value_cast<const FunctionValue *>(object->lookupMember("toString"))) { _result = value_cast<const StringValue *>(toStringMember->call(object)); // ### invoke convert-to-string? } } -- GitLab