diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-07-04 09:24:24 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-07-05 11:52:38 +0200 |
commit | eec591ff1c9394a7ffdc103f4d4337ccd708de11 (patch) | |
tree | 6bd880daedee3c2c24bae73df5c34b0e822fda6d /src/libs/qmljs/qmljsinterpreter.cpp | |
parent | d72ee7c7da8d803fb21a04cc0a8392837851f68d (diff) | |
download | qt-creator-eec591ff1c9394a7ffdc103f4d4337ccd708de11.tar.gz |
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>
Diffstat (limited to 'src/libs/qmljs/qmljsinterpreter.cpp')
-rw-r--r-- | src/libs/qmljs/qmljsinterpreter.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 8e0c63f7f3..a0ab5d1ab4 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -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 |