QmlJS: Fix binding and scoping function expressions.

Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-11-24 14:42:10 +01:00
parent 5dd92328fb
commit 05831a8ea5
3 changed files with 24 additions and 10 deletions

View File

@@ -346,19 +346,18 @@ bool Bind::visit(VariableDeclaration *ast)
ASTVariableReference *ref = new ASTVariableReference(ast, &_engine);
_currentObjectValue->setProperty(ast->name->asString(), ref);
return false;
return true;
}
bool Bind::visit(FunctionExpression *ast)
{
if (!ast->name)
return false;
// ### FIXME: the first declaration counts
//if (_currentObjectValue->property(ast->name->asString(), 0))
// return false;
ASTFunctionValue *function = new ASTFunctionValue(ast, _doc, &_engine);
_currentObjectValue->setProperty(ast->name->asString(), function);
if (ast->name && cast<FunctionDeclaration *>(ast))
_currentObjectValue->setProperty(ast->name->asString(), function);
// build function scope
ObjectValue *functionScope = _engine.newObject(/*prototype=*/0);