From 5fd81983d762457c443e4ab77cd3d356f8f9da14 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 21 Oct 2008 11:02:47 +0000 Subject: [PATCH] More A++ git-svn-id: svn://ultimatepp.org/upp/trunk@557 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CppBase/CppBase.h | 45 ++++++++++++++--------- uppsrc/CppBase/Parser.cpp | 56 +++++++++++++++++----------- uppsrc/ide/Assist.cpp | 52 ++++++++++++++++---------- uppsrc/ide/Browser/Base.cpp | 2 +- uppsrc/ide/Browser/Browser.iml | 59 +++++++++++++++--------------- uppsrc/ide/Browser/ItemDisplay.cpp | 3 ++ uppsrc/ide/Cpp.cpp | 40 +++++++++++--------- uppsrc/ide/ide.h | 7 ++-- 8 files changed, 153 insertions(+), 111 deletions(-) diff --git a/uppsrc/CppBase/CppBase.h b/uppsrc/CppBase/CppBase.h index e72ad92a4..e9a211721 100644 --- a/uppsrc/CppBase/CppBase.h +++ b/uppsrc/CppBase/CppBase.h @@ -176,11 +176,12 @@ enum Kind { CLASSVARIABLE, ENUM, MACRO, + FRIENDCLASS, }; inline bool IsCppType(int i) { - return i >= STRUCT && i <= TYPEDEF; + return i >= STRUCT && i <= TYPEDEF || i == FRIENDCLASS; } inline bool IsCppCode(int i) { @@ -233,6 +234,8 @@ struct CppItem { int16 at; bool virt; bool decla; + bool lvalue; + bool isptr; byte filetype; bool impl; @@ -250,7 +253,7 @@ struct CppItem { void Serialize(Stream& s); - CppItem() { at = decla = virt = false; qualify_type = qualify_param = true; serial = -1; } + CppItem() { at = decla = virt = false; qualify_type = qualify_param = true; serial = -1; isptr = false; } }; int FindItem(const Array& x, const String& qitem); @@ -281,22 +284,22 @@ class Parser { }; struct Decla { - bool s_static:1; - bool s_extern:1; - bool s_register:1; - bool s_auto:1; - bool s_mutable:1; - bool s_explicit:1; - bool s_virtual:1; + bool s_static; + bool s_extern; + bool s_register; + bool s_auto; + bool s_mutable; + bool s_explicit; + bool s_virtual; String name; - bool function:1; - bool type_def:1; - bool isfriend:1; - bool istemplate:1; - bool istructor:1; - bool isdestructor:1; - bool isptr:1; - bool nofn:1; + bool function; + bool type_def; + bool isfriend; + bool istemplate; + bool istructor; + bool isdestructor; + bool isptr; + bool nofn; String tnames; String type; @@ -414,7 +417,13 @@ public: CppItem current; int currentScopeDepth; int maxScopeDepth; - VectorMap local; + + struct Local : Moveable { + String type; + bool isptr; + }; + + VectorMap local; FnEndCallback whenFnEnd; LexSymbolStat symbolsOutsideFunctions; diff --git a/uppsrc/CppBase/Parser.cpp b/uppsrc/CppBase/Parser.cpp index 9c0fe396f..1db158279 100644 --- a/uppsrc/CppBase/Parser.cpp +++ b/uppsrc/CppBase/Parser.cpp @@ -578,6 +578,7 @@ void Parser::Declarator(Decl& d, const char *p) } EatInitializers(); while(Key('[')) { + d.isptr = true; int level = 1; while(level && lex != t_eof) { if(Key('[')) level++; @@ -724,8 +725,11 @@ Array Parser::Declaration(bool l0, bool more) void Parser::Locals(const String& type) { Array d = Declaration(true, true); - for(int i = 0; i < d.GetCount(); i++) - local.Add(d[i].name, type); + for(int i = 0; i < d.GetCount(); i++) { + Local& l = local.Add(d[i].name); + l.type = type; + l.isptr = d[i].isptr; + } } String Parser::Tparam(int& q) @@ -1172,8 +1176,11 @@ CppItem& Parser::Fn(const Decl& d, const String& templ, bool body, String ptype; for(int i = 0; i < d.param.GetCount(); i++) { const Decla& p = d.param[i]; - if(dobody) - local.Add(p.name, p.type); + if(dobody) { + Local& l = local.Add(p.name); + l.type = p.type; + l.isptr = p.isptr; + } ScAdd(param, p.natural); if(i) ptype << ';'; @@ -1385,27 +1392,32 @@ void Parser::Do() bool body = lex == '{'; for(int i = 0; i < r.GetCount(); i++) { Decl& d = r[i]; - if(!d.isfriend || body) { - if(d.function) { + if(d.function) { + if(!d.isfriend) { CppItem &im = Fn(d, Null, body, String(), String()); functionItem = &im; } - else { - String h = d.natural; - int q = h.Find('='); - if(q >= 0) - h = TrimRight(h.Mid(0, q)); - String scope = context.scope; - if(d.type_def) - ScopeCat(scope, d.name); - CppItem& im = Item(scope, d.type_def ? "typedef" : d.name, d.name); - im.natural = Purify(h); - im.type = d.type; - im.access = context.access; - im.kind = d.type_def ? TYPEDEF : - IsNull(scope) ? VARIABLE : - d.s_static ? CLASSVARIABLE : INSTANCEVARIABLE; - } + } + else { + String h = d.natural; + int q = h.Find('='); + if(q >= 0) + h = TrimRight(h.Mid(0, q)); + String scope = context.scope; + if(d.type_def) + ScopeCat(scope, d.name); + CppItem& im = Item(scope, d.isfriend ? "friend class" + : d.type_def ? "typedef" + : d.name, d.name); + im.natural = Purify(h); + im.type = d.type; + im.access = context.access; + im.kind = d.isfriend ? FRIENDCLASS : + d.type_def ? TYPEDEF : + IsNull(scope) ? VARIABLE : + d.s_static ? CLASSVARIABLE : INSTANCEVARIABLE; + if(im.IsData()) + im.isptr = d.isptr; } } if(body && functionItem && whenFnEnd) { diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 34e5bb8fa..4bec880e5 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -71,6 +71,8 @@ AssistEditor::AssistEditor() annotation_popup.Background(White); annotation_popup.SetFrame(BlackFrame()); annotation_popup.Margins(6); + + thisback = false; } int CppItemInfoOrder(const Value& va, const Value& vb) { @@ -303,12 +305,15 @@ void AssistEditor::Assist() while(iscid(Ch(q - 1))) q--; SkipSpcBack(q); + thisback = false; if(Ch(q - 1) == '(') { --q; String id = IdBack(q); if(id == "THISBACK") { - GatherItems(parser.current_scope, false, in_types, false, true); + thisback = true; + GatherItems(parser.current_scope, false, in_types, false); PopUpAssist(); + return; } } if(Ch(q - 1) == ':') { @@ -316,7 +321,7 @@ void AssistEditor::Assist() q--; Vector tparam; String scope = ParseTemplatedType(Qualify(parser.current_scope, CompleteIdBack(q)), tparam); - GatherItems(scope, false, in_types, true, false); + GatherItems(scope, false, in_types, true); } else { String tp; @@ -325,12 +330,12 @@ void AssistEditor::Assist() Index typeset = ExpressionType(parser, xp); for(int i = 0; i < typeset.GetCount(); i++) if(typeset[i].GetCount()) - GatherItems(typeset[i], xp.GetCount(), in_types, xp.GetCount() == 0, false); + GatherItems(typeset[i], xp.GetCount(), in_types, xp.GetCount() == 0); } else { - GatherItems(parser.current_scope, true, in_types, true, false); + GatherItems(parser.current_scope, true, in_types, true); Index in_types2; - GatherItems("", false, in_types2, true, false); + GatherItems("", false, in_types2, true); } } PopUpAssist(); @@ -412,24 +417,26 @@ void AssistEditor::AssistInsert() String txt = f.name; int l = txt.GetCount(); int pl = txt.GetCount(); - if(f.kind >= FUNCTION && f.kind <= INLINEFRIEND) { - txt << '('; - pl = l = txt.GetCount(); - if(IsNull(f.param)) - l++; - else { - Vector p = Split(f.param, ';', false); - for(int i = 0; i < p.GetCount(); i++) { - if(i) { - txt << (inbody ? (char)184 : ','); - txt << ' '; + if(!thisback) { + if(f.kind >= FUNCTION && f.kind <= INLINEFRIEND) { + txt << '('; + pl = l = txt.GetCount(); + if(IsNull(f.param)) + l++; + else { + Vector p = Split(f.param, ';', false); + for(int i = 0; i < p.GetCount(); i++) { + if(i) { + txt << (inbody ? (char)184 : ','); + txt << ' '; + } + txt << p[i]; + if(i == 0) + pl = txt.GetCount(); } - txt << p[i]; - if(i == 0) - pl = txt.GetCount(); } + txt << ')'; } - txt << ')'; } int cl = GetCursor(); int ch = cl; @@ -439,6 +446,11 @@ void AssistEditor::AssistInsert() ch++; Remove(cl, ch - cl); SetCursor(cl); + if(thisback) { + while(Ch(ch) == ' ') ch++; + if(Ch(ch) != ')') + txt << ')'; + } int n = Paste(ToUnicode(txt, CHARSET_WIN1250)); if(!inbody) SetCursor(cl + n); diff --git a/uppsrc/ide/Browser/Base.cpp b/uppsrc/ide/Browser/Base.cpp index 65d8a4147..9e5dadc1a 100644 --- a/uppsrc/ide/Browser/Base.cpp +++ b/uppsrc/ide/Browser/Base.cpp @@ -3,7 +3,7 @@ #define LTIMING(x) // RTIMING(x) #define LLOG(x) -static const char s_dbver[] = "CPP-BASE 2.34"; +static const char s_dbver[] = "CPP-BASE 2.35"; void GC_Cache() { diff --git a/uppsrc/ide/Browser/Browser.iml b/uppsrc/ide/Browser/Browser.iml index 41c29f153..610ab468e 100644 --- a/uppsrc/ide/Browser/Browser.iml +++ b/uppsrc/ide/Browser/Browser.iml @@ -13,6 +13,7 @@ IMAGE_ID(mprotected) IMAGE_ID(type_enum) IMAGE_ID(mprivate) IMAGE_ID(impl) +IMAGE_ID(friend_class) IMAGE_ID(type_struct) IMAGE_ID(template_struct) IMAGE_ID(unknown) @@ -24,35 +25,35 @@ IMAGE_ID(Ref) IMAGE_ID(Query) IMAGE_BEGIN_DATA -IMAGE_DATA(120,156,237,153,81,154,194,32,12,132,243,176,7,240,200,61,154,55,235,186,117,173,180,37,100,146,169,34,200,248,241,237) -IMAGE_DATA(250,240,79,75,26,66,164,114,145,139,136,204,179,244,167,25,28,58,63,207,229,49,248,190,121,46,127,218,211,40,6,58) -IMAGE_DATA(111,164,210,224,59,231,193,209,143,70,49,208,249,235,245,90,28,131,239,155,7,71,63,106,164,24,68,131,127,103,142,173) -IMAGE_DATA(33,226,195,180,152,44,111,183,184,101,143,218,124,237,248,61,61,226,207,255,232,211,219,226,223,235,27,138,65,166,53,132) -IMAGE_DATA(18,137,104,49,89,30,89,138,197,197,92,153,175,29,191,213,99,239,35,163,24,232,26,197,64,103,181,68,4,90,76,149) -IMAGE_DATA(95,88,96,87,45,178,192,206,110,178,14,62,203,130,115,8,178,11,175,178,163,51,120,141,70,49,208,217,51,118,182,244) -IMAGE_DATA(30,50,255,155,215,22,57,14,239,206,158,99,81,62,120,125,118,254,135,57,140,206,224,13,26,197,64,103,83,110,194,23) -IMAGE_DATA(210,134,159,148,191,6,191,77,126,249,231,156,139,121,18,125,120,138,73,224,250,236,252,15,247,48,249,227,47,50,138,129) -IMAGE_DATA(79,223,80,12,50,39,200,80,34,17,39,209,44,111,158,132,27,30,181,249,218,241,91,61,246,62,50,138,129,46,168,24) -IMAGE_DATA(76,183,32,60,134,71,15,38,253,160,62,41,151,62,140,212,199,98,215,157,225,169,141,79,206,35,97,75,82,61,24,30) -IMAGE_DATA(100,85,143,218,124,237,248,157,241,252,247,30,145,252,75,61,162,249,159,243,241,114,94,253,44,197,64,87,18,196,236,119) -IMAGE_DATA(57,86,204,205,247,218,188,75,111,108,147,152,107,164,89,29,98,119,43,35,196,58,61,236,149,29,100,13,15,136,61,195) -IMAGE_DATA(131,153,3,19,67,144,205,122,56,217,141,71,144,93,61,8,246,61,178,42,163,216,149,231,211,191,227,122,77,101,100,252) -IMAGE_DATA(150,28,156,227,30,45,243,119,246,121,242,17,247,104,115,254,159,192,223,61,226,108,195,106,228,52,233,79,100,155,69,84) -IMAGE_DATA(76,142,223,45,112,183,7,195,111,216,128,7,195,103,89,239,209,124,144,47,178,200,209,188,99,244,35,184,24,48,191,100) -IMAGE_DATA(39,199,47,112,141,149,128,71,194,206,17,15,134,223,177,155,4,68,60,24,94,97,97,15,134,55,88,211,131,225,65,86) -IMAGE_DATA(245,72,115,13,29,218,61,160,31,45,134,232,56,83,141,116,6,76,101,46,5,210,220,157,140,7,81,220,157,128,7,169) -IMAGE_DATA(239,76,88,34,124,47,207,196,158,121,238,104,206,197,243,181,158,10,197,128,189,113,170,173,119,188,88,60,155,143,188,220) -IMAGE_DATA(60,139,103,94,176,138,180,154,132,67,31,161,95,233,45,71,246,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_DATA(120,156,237,153,81,114,195,32,12,68,245,209,3,228,198,245,209,114,51,218,58,77,130,109,132,86,90,39,196,152,205,104) +IMAGE_DATA(218,124,188,181,17,66,48,68,46,114,17,145,148,164,63,37,48,116,62,165,122,12,190,111,158,171,159,227,105,52,3,157) +IMAGE_DATA(55,74,105,240,157,243,96,244,163,209,12,116,254,122,189,86,99,240,125,243,96,244,163,131,52,131,104,242,111,204,246,104) +IMAGE_DATA(136,248,48,71,76,150,183,143,184,117,143,214,124,235,252,61,61,226,243,191,245,233,109,241,175,117,134,102,80,56,26,66) +IMAGE_DATA(133,68,28,49,89,30,89,138,213,197,220,152,111,157,191,135,199,218,71,70,51,208,53,154,129,206,106,133,8,28,49,85) +IMAGE_DATA(126,102,129,93,181,202,2,59,187,201,58,248,34,11,142,33,200,206,188,202,142,147,193,107,52,154,129,206,238,177,179,229) +IMAGE_DATA(239,80,248,223,124,182,200,54,188,59,123,137,69,249,224,243,217,241,111,198,48,78,6,111,208,104,6,58,155,115,19,190) +IMAGE_DATA(144,22,252,164,252,53,248,101,241,203,63,231,92,204,147,232,225,105,38,129,231,179,227,223,188,195,228,207,191,200,104,6) +IMAGE_DATA(62,157,161,25,20,110,144,161,66,34,110,162,89,222,188,9,55,60,90,243,173,243,247,240,88,251,200,104,6,186,160,102) +IMAGE_DATA(48,253,38,225,30,30,221,153,252,131,250,228,92,62,25,185,143,197,62,118,134,167,22,62,37,143,140,173,73,245,96,120) +IMAGE_DATA(144,85,61,90,243,173,243,183,199,252,175,61,34,245,151,123,68,235,191,228,227,229,188,250,154,155,129,174,44,137,197,239) +IMAGE_DATA(178,237,152,139,239,173,121,151,222,120,76,98,158,145,87,117,136,93,173,140,16,235,244,176,87,118,144,53,60,32,118,15) +IMAGE_DATA(15,102,12,76,14,65,182,232,225,100,23,30,65,246,225,65,176,239,145,213,25,197,238,60,159,254,29,215,107,58,35,227) +IMAGE_DATA(55,215,96,138,123,28,153,191,177,207,155,143,184,199,49,199,255,9,252,205,35,206,30,88,7,185,77,250,19,119,204,250) +IMAGE_DATA(166,182,57,134,159,217,123,4,60,24,126,193,6,60,24,190,200,58,60,24,190,202,2,30,201,17,253,232,52,205,0,255) +IMAGE_DATA(109,98,111,126,181,219,7,154,65,156,95,176,1,15,134,47,178,222,223,233,130,124,149,5,60,70,51,168,106,34,6,62) +IMAGE_DATA(57,174,227,52,86,2,30,25,155,34,30,12,191,98,23,5,136,120,48,188,194,194,30,12,111,176,166,7,195,131,172,234) +IMAGE_DATA(145,215,26,26,218,59,160,31,45,135,104,236,169,131,156,12,152,206,92,75,164,185,59,25,19,81,221,157,128,137,212,119) +IMAGE_DATA(38,172,16,206,203,51,185,103,230,29,173,185,120,189,54,211,15,65,117,183,148,0,0,0,0,0,0,0,0,0,0,0) IMAGE_END_DATA(608, 18) IMAGE_BEGIN_DATA -IMAGE_DATA(120,156,237,150,75,14,195,32,12,68,189,111,23,57,50,71,227,102,148,70,253,144,169,77,176,93,8,145,98,105,170,138) -IMAGE_DATA(206,27,19,168,8,180,208,66,68,41,209,92,149,94,50,243,207,114,228,164,178,12,57,137,43,69,14,203,43,114,170,60) -IMAGE_DATA(228,12,235,111,125,126,5,183,225,13,220,135,55,114,231,174,142,135,65,2,73,99,34,31,99,92,85,242,204,152,216,23) -IMAGE_DATA(188,226,152,212,183,69,61,120,231,252,175,245,59,118,253,126,230,81,242,13,125,143,171,73,111,6,254,10,121,177,131,176) -IMAGE_DATA(224,181,223,246,124,173,44,231,215,178,152,97,233,91,83,79,222,59,127,100,241,187,150,173,141,181,178,218,140,179,213,141) -IMAGE_DATA(238,4,135,1,158,94,156,190,222,16,100,161,87,145,171,184,222,174,99,33,247,67,73,222,25,115,133,107,173,152,151,63) -IMAGE_DATA(119,189,111,31,231,109,218,139,65,111,10,79,62,247,112,221,50,2,229,205,42,164,201,64,86,155,129,126,134,199,12,241) -IMAGE_DATA(10,34,176,155,140,82,101,70,11,91,235,95,225,61,123,169,222,67,107,95,224,255,242,255,115,176,195,234,1,183,5,181) -IMAGE_DATA(251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) -IMAGE_END_DATA(288, 5) +IMAGE_DATA(120,156,237,151,219,14,131,48,8,134,185,223,46,124,228,62,154,111,134,157,137,166,34,32,135,213,67,226,159,176,44,29) +IMAGE_DATA(223,79,109,77,233,96,128,1,0,16,97,47,110,204,163,12,143,227,56,98,194,35,195,207,236,18,1,143,12,191,97,3) +IMAGE_DATA(30,168,196,171,87,186,148,195,224,74,101,95,96,252,41,225,131,173,2,62,200,201,225,195,242,14,31,149,39,62,167,213) +IMAGE_DATA(143,62,191,131,219,240,1,110,229,131,220,179,213,241,48,224,58,147,167,91,113,157,209,210,45,87,127,146,43,142,73,117) +IMAGE_DATA(45,209,131,79,206,255,93,191,107,215,111,55,143,150,55,212,189,78,55,189,25,228,85,234,98,23,97,193,181,223,142,242) +IMAGE_DATA(172,44,151,239,101,169,71,164,174,22,61,249,236,252,41,75,191,123,89,109,204,202,122,61,158,166,15,124,129,28,6,210) +IMAGE_DATA(127,78,238,68,171,139,82,228,160,185,14,95,199,245,118,30,43,181,30,13,41,247,142,190,194,181,86,244,171,159,135,185) +IMAGE_DATA(75,30,151,107,218,139,147,58,69,198,159,123,184,110,30,5,234,102,53,225,241,160,172,215,131,230,51,60,245,16,175,32) +IMAGE_DATA(2,187,241,104,163,245,176,176,90,125,133,207,236,165,123,15,163,117,9,255,151,247,47,193,158,166,9,87,237,245,57,0) +IMAGE_END_DATA(288, 6) diff --git a/uppsrc/ide/Browser/ItemDisplay.cpp b/uppsrc/ide/Browser/ItemDisplay.cpp index 84ceb0de9..8937ed5a4 100644 --- a/uppsrc/ide/Browser/ItemDisplay.cpp +++ b/uppsrc/ide/Browser/ItemDisplay.cpp @@ -108,6 +108,9 @@ int CppItemInfoDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, case MACRO: img = BrowserImg::macro(); break; + case FRIENDCLASS: + img = BrowserImg::friend_class(); + break; } int by = ry - bk.GetSize().cy / 2; diff --git a/uppsrc/ide/Cpp.cpp b/uppsrc/ide/Cpp.cpp index 7cb77c8d2..4b18ab8d2 100644 --- a/uppsrc/ide/Cpp.cpp +++ b/uppsrc/ide/Cpp.cpp @@ -136,7 +136,7 @@ void AssistEditor::ExpressionType(const String& ttype, const Vector& xp, bool can_shortcut_operator, Index& visited_bases) { if(ii >= xp.GetCount()) { - LLOG("Final type: " << ttype); + LLOG("--- Final type: " << ttype); typeset.FindAdd(ttype); return; } @@ -147,11 +147,11 @@ void AssistEditor::ExpressionType(const String& ttype, const Vector& xp, const Array& n = GetTypeItems(type); String id = xp[ii]; int q = id.ReverseFind(':'); - if(q > 0 && id[q - 1] == ':') { // problem here!!! - ExpressionType(ResolveTParam(Qualify("", id.Mid(0, q - 1)), tparam), xp, ii + 1, typeset); - return; + if(q > 0 && id[q - 1] == ':') { + type = ResolveTParam(Qualify(ttype, id.Mid(0, q - 1)), tparam); + id = id.Mid(q + 1); } - LLOG("ExpressionType " << type << " ii: " << ii << " id:" << id); + LLOG("ExpressionType " << type << " ii: " << ii << " id:" << id << " variable:" << variable); if(*id == '.' || (!variable && !iscid(*id))) { ExpressionType(ttype, xp, ii + 1, typeset, false); return; @@ -160,12 +160,13 @@ void AssistEditor::ExpressionType(const String& ttype, const Vector& xp, if(!iscid(*id)) { shortcut_oper = can_shortcut_operator; id = "operator" + id; + LLOG("id as: " << id); } for(int i = 0; i < n.GetCount(); i = FindNext(n, i)) { const CppItem& m = n[i]; if(m.name == id) { - LLOG("Member " << m.name << ": " << m.qtype); - ExpressionType(ResolveTParam(m.qtype, tparam), xp, ii + 1, typeset); + LLOG("Member " << m.qtype << "'" << m.name << "'"); + ExpressionType(ResolveTParam(m.qtype, tparam), xp, ii + 1, typeset, m.IsData()); } } if(typeset.GetCount() != c0 || IsNull(type)) @@ -175,7 +176,7 @@ void AssistEditor::ExpressionType(const String& ttype, const Vector& xp, for(int i = 0; i < base.GetCount(); i++) if(visited_bases.Find(base[i]) < 0) { visited_bases.Add(base[i]); - ExpressionType(base[i], xp, ii, typeset, tparam, false, visited_bases); + ExpressionType(base[i], xp, ii, typeset, variable, false, visited_bases); if(typeset.GetCount() != c0) return; } @@ -189,13 +190,13 @@ void AssistEditor::ExpressionType(const String& type, const Vector& xp, Index visited_bases; ExpressionType(type, xp, ii, typeset, variable, true, visited_bases); } - +/* void AssistEditor::ExpressionType(const String& type, const Vector& xp, int ii, Index& typeset) { ExpressionType(type, xp, ii, typeset, false); } - +*/ Index AssistEditor::ExpressionType(const Parser& parser, const Vector& xp) { String type; @@ -204,14 +205,14 @@ Index AssistEditor::ExpressionType(const Parser& parser, const Vector= 0) { - String type = Qualify(parser.current_scope, parser.local[q]); + String type = Qualify(parser.current_scope, parser.local[q].type); LLOG("Found type local: " << type << " in scope: " << parser.current_scope); - ExpressionType(type, xp, 1, typeset, true); + ExpressionType(type, xp, 1, typeset, !parser.local[q].isptr); return typeset; } ExpressionType(parser.current_scope, xp, 0, typeset, false); @@ -235,8 +236,7 @@ int CharFilterT(int c) return c >= '0' && c <= '9' ? "TUVWXYZMNO"[c - '0'] : c; } -void AssistEditor::GatherItems(const String& type, bool only_public, Index& in_types, bool types, - bool thisback) +void AssistEditor::GatherItems(const String& type, bool only_public, Index& in_types, bool types) { LLOG("GatherItems " << type); if(in_types.Find(type) >= 0) { @@ -271,12 +271,16 @@ void AssistEditor::GatherItems(const String& type, bool only_public, Index& n = CodeBase()[q]; String base; int typei = assist_type.FindAdd(ntp); + bool op = only_public; + for(int i = 0; i < n.GetCount(); i = FindNext(n, i)) + if(n[i].kind == FRIENDCLASS) + op = false; for(int i = 0; i < n.GetCount(); i = FindNext(n, i)) { const CppItem& im = n[i]; - if(im.IsType()) + if(im.kind == STRUCT || im.kind == STRUCTTEMPLATE) base = im.qptype; if((im.IsCode() || !thisback && (im.IsData() || im.IsMacro() && type == "")) - && (!only_public || im.access == PUBLIC)) { + && (!op || im.access == PUBLIC)) { int q = assist_item.Find(im.name); while(q >= 0) { if(assist_item[q].typei != typei) @@ -293,7 +297,7 @@ void AssistEditor::GatherItems(const String& type, bool only_public, Index& visited_bases); void ExpressionType(const String& type, const Vector& xp, int ii, Index& typeset, bool variable); - void ExpressionType(const String& type, const Vector& xp, int ii, - Index& typeset); +// void ExpressionType(const String& type, const Vector& xp, int ii, +// Index& typeset); Index ExpressionType(const Parser& parser, const Vector& xp); String RemoveDefPar(const char *s); @@ -427,7 +428,7 @@ struct AssistEditor : CodeEditor { void Virtuals(); void Thisbacks(); void GatherItems(const String& type, bool only_public, Index& in_types, - bool types, bool thisback); + bool types); void SelParam(); int Ch(int q);