return false;
}
-Interpreter::ObjectValue *Bind::findFunctionScope(AST::FunctionDeclaration *node) const
+Interpreter::ObjectValue *Bind::findFunctionScope(AST::FunctionExpression *node) const
{
return _functionScopes.value(node);
}
_idEnvironment->setProperty(i->name->asString(), _currentObjectValue);
}
- return false;
+ return true;
}
bool Bind::visit(UiArrayBinding *)
return false;
}
-bool Bind::visit(FunctionDeclaration *ast)
+bool Bind::visit(FunctionExpression *ast)
{
if (!ast->name)
return false;
return false;
}
+
+bool Bind::visit(FunctionDeclaration *ast)
+{
+ return visit(static_cast<FunctionExpression *>(ast));
+}
bool usesQmlPrototype(Interpreter::ObjectValue *prototype,
const Interpreter::Context *context) const;
- Interpreter::ObjectValue *findFunctionScope(AST::FunctionDeclaration *node) const;
+ Interpreter::ObjectValue *findFunctionScope(AST::FunctionExpression *node) const;
bool isGroupedPropertyBinding(AST::Node *node) const;
static QString toString(AST::UiQualifiedId *qualifiedId, QChar delimiter = QChar('.'));
// QML/JS
virtual bool visit(AST::FunctionDeclaration *ast);
+ virtual bool visit(AST::FunctionExpression *ast);
virtual bool visit(AST::VariableDeclaration *ast);
Interpreter::ObjectValue *switchObjectValue(Interpreter::ObjectValue *newObjectValue);
QHash<AST::Node *, Interpreter::ObjectValue *> _qmlObjects;
QSet<AST::Node *> _groupedPropertyBindings;
- QHash<AST::FunctionDeclaration *, Interpreter::ObjectValue *> _functionScopes;
+ QHash<AST::FunctionExpression *, Interpreter::ObjectValue *> _functionScopes;
QStringList _includedScripts;
QList<Interpreter::ImportInfo> _imports;
return check(_ast->expression);
}
-ASTFunctionValue::ASTFunctionValue(FunctionDeclaration *ast, const QmlJS::Document *doc, Engine *engine)
+ASTFunctionValue::ASTFunctionValue(FunctionExpression *ast, const QmlJS::Document *doc, Engine *engine)
: FunctionValue(engine), _ast(ast), _doc(doc)
{
setPrototype(engine->functionPrototype());
{
}
-FunctionDeclaration *ASTFunctionValue::ast() const
+FunctionExpression *ASTFunctionValue::ast() const
{
return _ast;
}
class QMLJS_EXPORT ASTFunctionValue: public FunctionValue
{
- AST::FunctionDeclaration *_ast;
+ AST::FunctionExpression *_ast;
const Document *_doc;
QList<NameId *> _argumentNames;
public:
- ASTFunctionValue(AST::FunctionDeclaration *ast, const Document *doc, Engine *engine);
+ ASTFunctionValue(AST::FunctionExpression *ast, const Document *doc, Engine *engine);
virtual ~ASTFunctionValue();
- AST::FunctionDeclaration *ast() const;
+ AST::FunctionExpression *ast() const;
virtual const Value *returnValue() const;
virtual int argumentCount() const;