From 0b38467c9c222494570d00aebc8a9fac18d5f61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Wed, 16 Dec 2015 21:42:49 +0100 Subject: [PATCH] bug fix issue #17 other bug fixes in intellisense --- CodeCompletion/DomSyntaxTreeVisitor.cs | 48 ++++++++++++++++++++++---- CodeCompletion/SymTable.cs | 2 +- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index dd391786b..78710664b 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -813,7 +813,20 @@ namespace CodeCompletion if (_procedure_header.name.class_name != null) { - topScope = cur_scope.FindName(_procedure_header.name.class_name.name); + topScope = null; + if (_procedure_header.name.ln != null && _procedure_header.name.ln.Count > 0) + { + SymScope tmp_scope = cur_scope; + for (int i = 0; i < _procedure_header.name.ln.Count; i++) + { + tmp_scope = tmp_scope.FindName(_procedure_header.name.ln[i].name); + if (tmp_scope == null) + break; + } + topScope = tmp_scope; + } + else + topScope = cur_scope.FindName(_procedure_header.name.class_name.name); if (topScope != null) { ps = topScope.FindNameOnlyInThisType(meth_name) as ProcScope; @@ -1097,7 +1110,20 @@ namespace CodeCompletion _function_header.name.visit(this); if (_function_header.name.class_name != null) { - topScope = cur_scope.FindName(_function_header.name.class_name.name); + topScope = null; + if (_function_header.name.ln != null && _function_header.name.ln.Count > 0) + { + SymScope tmp_scope = cur_scope; + for (int i=0; i< _function_header.name.ln.Count; i++) + { + tmp_scope = tmp_scope.FindName(_function_header.name.ln[i].name); + if (tmp_scope == null) + break; + } + topScope = tmp_scope; + } + else + topScope = cur_scope.FindName(_function_header.name.class_name.name); if (topScope != null) { ps = topScope.FindNameOnlyInThisType(meth_name) as ProcScope; @@ -1285,7 +1311,8 @@ namespace CodeCompletion ps.loc = cur_loc; //ps.head_loc = loc; ps.declaringUnit = entry_scope; - if (_function_header.template_args != null && !ps.IsGeneric()) + SymScope tmp = cur_scope; + if (_function_header.template_args != null && !ps.IsGeneric()) { foreach (ident s in _function_header.template_args.idents) { @@ -1294,7 +1321,16 @@ namespace CodeCompletion tps.loc = get_location(s); ps.AddName(s.name, tps); } - } + if (ps.return_type == null) + { + cur_scope = ps; + if (_function_header.return_type != null) + _function_header.return_type.visit(this); + return_type = returned_scope as TypeScope; + cur_scope = tmp; + } + } + SetAttributes(ps,_function_header.proc_attributes); ps.is_static = _function_header.class_keyword; if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_function_header)) @@ -1309,8 +1345,8 @@ namespace CodeCompletion ps.acc_mod = cur_access_mod; ps.si.acc_mod = cur_access_mod; } - SymScope tmp = cur_scope; - cur_scope = ps.topScope; + + cur_scope = ps; if (_function_header.parameters != null) foreach (typed_parameters pars in _function_header.parameters.params_list) { diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index c4888ee5a..9c4811d18 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -402,7 +402,7 @@ namespace CodeCompletion if (t.IsEqual(int_ts2) || (t is ArrayScope && int_ts2.IsArray) || (int_ts2 is ArrayScope && t.IsArray)) { lst.AddRange(extension_methods[t]); - break; + //break; } }