diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index 4bc2f193e71b2f1a2f805441570abc7bda66a3b1..802957f7d4d9ee6d20846b5e85bf9a5efbb601e4 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -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);
diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp
index 77b6dcc5cbfa0ec20c66687baec626ab63492d31..bd27cebab9234058548cba23444eb4f89a74bd9f 100644
--- a/src/libs/qmljs/qmljsscopebuilder.cpp
+++ b/src/libs/qmljs/qmljsscopebuilder.cpp
@@ -61,8 +61,8 @@ void ScopeBuilder::push(AST::Node *node)
     if (qmlObject)
         setQmlScopeObject(qmlObject);
 
-    // JS scopes
-    if (FunctionDeclaration *fun = cast<FunctionDeclaration *>(node)) {
+    // JS scopes (catch both, FunctionExpression and FunctionDeclaration)
+    if (FunctionExpression *fun = dynamic_cast<FunctionExpression *>(node)) {
         ObjectValue *functionScope = _doc->bind()->findFunctionScope(fun);
         if (functionScope)
             _context->scopeChain().jsScopes += functionScope;
@@ -83,8 +83,10 @@ void ScopeBuilder::pop()
     _nodes.removeLast();
 
     // JS scopes
-    if (cast<FunctionDeclaration *>(toRemove))
-        _context->scopeChain().jsScopes.removeLast();
+    if (FunctionExpression *fun = dynamic_cast<FunctionExpression *>(toRemove)) {
+        if (_doc->bind()->findFunctionScope(fun))
+            _context->scopeChain().jsScopes.removeLast();
+    }
 
     // QML scope object
     if (! _nodes.isEmpty()
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp
index 9771ea5280c06a51b1fbd341f86d76c6ed352e26..debbbac5ef117bbb4c15e8d1567d2b2522931468 100644
--- a/src/plugins/qmljseditor/qmljsfindreferences.cpp
+++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp
@@ -201,6 +201,11 @@ protected:
     }
 
     virtual bool visit(AST::FunctionDeclaration *node)
+    {
+        return visit(static_cast<FunctionExpression *>(node));
+    }
+
+    virtual bool visit(AST::FunctionExpression *node)
     {
         if (node->name && node->name->asString() == _name) {
             if (checkLookup())
@@ -328,6 +333,11 @@ protected:
     }
 
     virtual bool visit(AST::FunctionDeclaration *node)
+    {
+        return visit(static_cast<FunctionExpression *>(node));
+    }
+
+    virtual bool visit(AST::FunctionExpression *node)
     {
         Node::accept(node->formals, this);
         _result.append(node);
@@ -422,9 +432,12 @@ protected:
         return true;
     }
 
-    // ### Misses function declaration, var declaration
-
     virtual bool visit(FunctionDeclaration *node)
+    {
+        return visit(static_cast<FunctionExpression *>(node));
+    }
+
+    virtual bool visit(FunctionExpression *node)
     {
         if (containsOffset(node->identifierToken)) {
             _result.second = node->name->asString();