QmlJS: Make 'length' property available on all FunctionValues.

Change-Id: I62bb8f41177521db1f3213d6bd804d8e4852560d
Reviewed-on: http://codereview.qt.nokia.com/1044
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-07-04 09:24:24 +02:00
parent d72ee7c7da
commit eec591ff1c
2 changed files with 1 additions and 17 deletions

View File

@@ -1097,6 +1097,7 @@ void Activation::setArguments(const ValueList &arguments)
FunctionValue::FunctionValue(ValueOwner *valueOwner)
: ObjectValue(valueOwner)
{
setMember(QLatin1String("length"), valueOwner->numberValue());
}
FunctionValue::~FunctionValue()
@@ -1205,18 +1206,6 @@ const Value *Function::argument(int index) const
return _arguments.at(index);
}
const Value *Function::lookupMember(const QString &name, const Context *context,
const ObjectValue **foundInScope, bool examinePrototypes) const
{
if (name == "length") {
if (foundInScope)
*foundInScope = this;
return valueOwner()->numberValue();
}
return FunctionValue::lookupMember(name, context, foundInScope, examinePrototypes);
}
const Value *Function::invoke(const Activation *activation) const
{
return activation->thisObject(); // ### FIXME it should return undefined