From d8e647ac13ae1c5e9a48b203deb856f7d1520f0e Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 25 Sep 2014 19:52:45 +0000 Subject: [PATCH] Fixed context jump to base class method git-svn-id: svn://ultimatepp.org/upp/trunk@7730 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Assist.cpp | 46 ++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index c297d5aee..14ee08bc7 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -1011,11 +1011,11 @@ bool GetIdScope(String& os, const String& scope, const String& id, Index os = n; return true; } - for(int i = 0; i < m.GetCount(); i = FindNext(m, i)) { + for(int i = 0; i < m.GetCount(); i++) { const CppItem& im = m[i]; if(im.IsType()) { Vector b = Split(im.qptype, ';'); - ResolveTParam(b, tparam); + ResolveTParam(b, tparam); for(int i = 0; i < b.GetCount(); i++) { if(GetIdScope(os, b[i], id, done)) return true; @@ -1072,18 +1072,8 @@ void Ide::FindId(const String& id) String RemoveTemplateParams(const String& s) { - String r; - int lvl = 0; - for(int i = 0; i < s.GetCount(); i++) - if(s[i] == '<') - lvl++; - else - if(s[i] == '>') - lvl--; - else - if(lvl == 0) - r.Cat(s[i]); - return r; + Vector dummy; + return ParseTemplatedType(s, dummy); } void Ide::ContextGoto0(int pos) @@ -1211,8 +1201,18 @@ void Ide::ContextGoto0(int pos) Index done; String r; if(GetIdScope(r, type[i], id, done)) { - scope.Add(r); - istype.Add(false); + Vector todo; + todo.Add(r); + while(scope.GetCount() < 100 && todo.GetCount()) { // Add base classes + String t = todo[0]; + todo.Remove(0); + if(t.EndsWith("::")) + t.Trim(t.GetCount() - 2); + scope.Add(t); + istype.Add(false); + Scopefo f(CodeBase(), t); // Try base classes too! + todo.Append(f.GetBases()); + } } } @@ -1239,8 +1239,18 @@ void Ide::ContextGoto0(int pos) } } else { - scope.Add(parser.current_scope); - istype.Add(false); + Vector todo; + todo.Add(parser.current_scope); + while(scope.GetCount() < 100 && todo.GetCount()) { // Add base classes + String t = todo[0]; + todo.Remove(0); + if(t.EndsWith("::")) + t.Trim(t.GetCount() - 2); + scope.Add(t); + istype.Add(false); + Scopefo f(CodeBase(), t); // Try base classes too! + todo.Append(f.GetBases()); + } q = parser.local.Find(id); if(q >= 0) { // Try locals AddHistory();