QmlJS: Add XMLHttpRequest, DB API and JSON completion.

Change-Id: I30773e8879086c1f85d331fabf9380e217b32dd7
Reviewed-on: http://codereview.qt.nokia.com/2745
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-08-08 14:22:22 +02:00
parent c42e966184
commit 197c60e928
4 changed files with 91 additions and 8 deletions

View File

@@ -1128,8 +1128,13 @@ Function::~Function()
{
}
void Function::addArgument(const Value *argument)
void Function::addArgument(const Value *argument, const QString &name)
{
if (!name.isEmpty()) {
while (_argumentNames.size() < _arguments.size())
_argumentNames.push_back(QString());
_argumentNames.push_back(name);
}
_arguments.push_back(argument);
}
@@ -1153,9 +1158,19 @@ const Value *Function::argument(int index) const
return _arguments.at(index);
}
const Value *Function::invoke(const Activation *activation) const
QString Function::argumentName(int index) const
{
return activation->thisObject(); // ### FIXME it should return undefined
if (index < _argumentNames.size()) {
const QString name = _argumentNames.at(index);
if (!name.isEmpty())
return _argumentNames.at(index);
}
return FunctionValue::argumentName(index);
}
const Value *Function::invoke(const Activation *) const
{
return _returnValue;
}
////////////////////////////////////////////////////////////////////////////////