forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user