From 06fcf59f2e4a6e513be95cb4f1ab97de92d45cc5 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Fri, 25 Sep 2009 12:08:38 +0200
Subject: [PATCH] Added method arguments to the lookup context of an ObjC
 method.

---
 src/libs/cplusplus/LookupContext.cpp | 10 ++++++++++
 src/libs/cplusplus/LookupContext.h   |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 48053b8b69c..6bf59fb44a2 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -466,6 +466,14 @@ void LookupContext::expandFunction(Function *function,
     }
 }
 
+void LookupContext::expandObjCMethod(ObjCMethod *method,
+                                     const QList<Scope *> &visibleScopes,
+                                     QList<Scope *> *expandedScopes) const
+{
+    if (! expandedScopes->contains(method->arguments()))
+        expandedScopes->append(method->arguments());
+}
+
 void LookupContext::expand(Scope *scope,
                            const QList<Scope *> &visibleScopes,
                            QList<Scope *> *expandedScopes) const
@@ -483,5 +491,7 @@ void LookupContext::expand(Scope *scope,
         expandBlock(block, visibleScopes, expandedScopes);
     } else if (Function *fun = scope->owner()->asFunction()) {
         expandFunction(fun, visibleScopes, expandedScopes);
+    } else if (ObjCMethod *meth = scope->owner()->asObjCMethod()) {
+        expandObjCMethod(meth, visibleScopes, expandedScopes);
     }
 }
diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h
index ed02f0d29df..d648fa71a78 100644
--- a/src/libs/cplusplus/LookupContext.h
+++ b/src/libs/cplusplus/LookupContext.h
@@ -114,6 +114,10 @@ public:
                         const QList<Scope *> &visibleScopes,
                         QList<Scope *> *expandedScopes) const;
 
+    void expandObjCMethod(ObjCMethod *method,
+                          const QList<Scope *> &visibleScopes,
+                          QList<Scope *> *expandedScopes) const;
+
     void expandEnumOrAnonymousSymbol(ScopedSymbol *scopedSymbol,
                                      QList<Scope *> *expandedScopes) const;
 
-- 
GitLab