cpp: fixed issue with jump to partially qualified method #1196

git-svn-id: svn://ultimatepp.org/upp/trunk@8728 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-07-23 08:00:36 +00:00
parent 8b68357ddb
commit 62da118726
2 changed files with 20 additions and 6 deletions

View file

@ -29,13 +29,13 @@ bool Qualify0(ScopeInfo& nf, const String& type, const String& usings, String& q
return true;
}
if(DoQualify(hnf, qs, usings, qn)) {
if(nf.base.Find(type) >= 0) {
qt = type;
String tp = type.Mid(q + 1);
if(nf.base.Find(qn) >= 0) {
qt = qn + "::" + tp;
return true;
}
int scopei = nf.base.Find(qn);
if(scopei >= 0) {
String tp = type.Mid(q + 1);
ScopeInfo nnf(nf.base, scopei);
const Vector<String>& bs = nnf.GetBases();
for(int i = 0; i < bs.GetCount(); i++) {

View file

@ -166,7 +166,7 @@ void Ide::ContextGoto0(int pos)
while(iscid(editor.Ch(q - 1)))
q--;
String tp;
Vector<String> xp = editor.ReadBack(q); // try to load expression lien "x[i]." or "ptr->"
Vector<String> xp = editor.ReadBack(q); // try to load expression like "x[i]." or "ptr->"
Index<String> type;
Parser parser;
int ci = pos;
@ -181,7 +181,7 @@ void Ide::ContextGoto0(int pos)
ci++;
}
editor.Context(parser, ci);
DDUMP(xp);
if(xp.GetCount()) {
type = editor.EvaluateExpressionType(parser, xp);
if(type.GetCount() == 0)
@ -235,9 +235,23 @@ void Ide::ContextGoto0(int pos)
Vector<String> ns = parser.GetNamespaces();
DDUMP(qual);
DDUMP(id);
if(qual.GetCount()) { // Ctrl::MOUSELEFT, Vector<String>::Iterator
Vector<String> todo;
todo.Add(RemoveTemplateParams(Qualify(CodeBase(), parser.current_scope, qual + "::" + id, parser.context.namespace_using)));
String qa = Qualify(CodeBase(), parser.current_scope, qual + "::" + id, parser.context.namespace_using);
qa = RemoveTemplateParams(qa);
if(CodeBase().Find(qa) < 0) { // Upp::FileTabs::RenameFile
int q = qa.ReverseFind("::");
if(q > 0) {
String h = qa.Mid(0, q);
if(CodeBase().Find(h) >= 0) {
scope.Add(h);
istype.Add(false);
}
}
}
todo.Add(qa);
while(scope.GetCount() < 100 && todo.GetCount()) {
String t = todo[0];
if(t.EndsWith("::"))