diff --git a/CodeCompletion/DomConverter.cs b/CodeCompletion/DomConverter.cs index 8df8700a3..601ecf7eb 100644 --- a/CodeCompletion/DomConverter.cs +++ b/CodeCompletion/DomConverter.cs @@ -867,9 +867,9 @@ namespace CodeCompletion ExpressionVisitor ev = new ExpressionVisitor(expr, ss, visitor); ss = ev.GetScopeOfExpression(); } - while (ss != null && ss is ProcScope && (ss as ProcScope).proc_realization != null && (ss as ProcScope).proc_realization.loc != null) + while (ss != null && ss is ProcScope && (ss as ProcScope).procRealization != null && (ss as ProcScope).procRealization.loc != null) { - ProcRealization pr = (ss as ProcScope).proc_realization; + ProcRealization pr = (ss as ProcScope).procRealization; pos.line = pr.loc.begin_line_num; pos.column = pr.loc.begin_column_num; pos.file_name = pr.loc.doc.file_name; diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index 612c523d5..22ca6df4d 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -1556,7 +1556,8 @@ namespace CodeCompletion if (_function_header.parameters != null) add_parameters(ps, _function_header.parameters); cur_scope = tmp; - ps.return_type = return_type; + if (ps.procRealization == null) + ps.return_type = return_type; //cur_scope = ps; if (cur_scope is TypeScope && !ps.is_static) ps.AddName("self", new ElementScope(new SymInfo("self", SymbolKind.Parameter, "self"), cur_scope, ps)); @@ -1618,7 +1619,7 @@ namespace CodeCompletion if (_procedure_definition.proc_header is function_header && (_procedure_definition.proc_header as function_header).return_type == null) { var fh = (_procedure_definition.proc_header as function_header); - if (fh != null && fh.return_type == null) + if (fh != null && fh.return_type == null && !(returned_scope is ProcScope && (returned_scope as ProcScope).procRealization != null)) { var bl = _procedure_definition.proc_body as block; if (bl != null && bl.program_code != null) @@ -1664,7 +1665,7 @@ namespace CodeCompletion if (cur_scope != null && cur_scope is ProcScope) { - ProcRealization pr = (cur_scope as ProcScope).proc_realization; + ProcRealization pr = (cur_scope as ProcScope).procRealization; if (pr == null) cur_scope.body_loc = get_location(_procedure_definition.proc_body); else @@ -3428,7 +3429,7 @@ namespace CodeCompletion { ProcRealization pr = new ProcRealization(ps, cur_scope); pr.already_defined = true; - ps.proc_realization = pr; + ps.procRealization = pr; pr.loc = cur_loc; pr.head_loc = loc; is_realization = true; @@ -3438,7 +3439,7 @@ namespace CodeCompletion { ProcRealization pr = new ProcRealization(ps, impl_scope); pr.already_defined = true; - ps.proc_realization = pr; + ps.procRealization = pr; pr.loc = cur_loc; pr.head_loc = loc; is_realization = true; diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index 3f4cac9c7..6937e8962 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -1424,7 +1424,7 @@ namespace CodeCompletion { this.def_proc = def_proc; this.top_mod_scope = top_mod_scope; - def_proc.proc_realization = this; + def_proc.procRealization = this; if (def_proc != null) this.topScope = def_proc.topScope; this.si = new SymInfo(def_proc.si.name, def_proc.si.kind, def_proc.si.description); @@ -1777,7 +1777,7 @@ namespace CodeCompletion public bool is_constructor; public bool is_forward = false; public bool already_defined = false;//sush. li realizacija - public ProcRealization proc_realization;//ssylka na realizaciju + public ProcRealization procRealization;//ssylka na realizaciju public List template_parameters; public TypeScope declaringType; public bool is_extension = false; @@ -1924,7 +1924,7 @@ namespace CodeCompletion { get { - return proc_realization; + return procRealization; } } @@ -2034,8 +2034,8 @@ namespace CodeCompletion if (sc != null) return sc; if (topScope != null) sc = topScope.FindName(name); if (sc != null) return sc; - if (proc_realization != null && proc_realization.top_mod_scope != null) - return proc_realization.top_mod_scope.FindName(name); + if (procRealization != null && procRealization.top_mod_scope != null) + return procRealization.top_mod_scope.FindName(name); return null; } @@ -2044,8 +2044,8 @@ namespace CodeCompletion List names = internal_find_overloads(name, true); if (topScope != null) names.AddRange(topScope.FindOverloadNames(name)); - if (proc_realization != null && proc_realization.top_mod_scope != null) - names.AddRange(proc_realization.top_mod_scope.FindOverloadNames(name)); + if (procRealization != null && procRealization.top_mod_scope != null) + names.AddRange(procRealization.top_mod_scope.FindOverloadNames(name)); return names; } @@ -2105,8 +2105,8 @@ namespace CodeCompletion } if (topScope != null) lst.AddRange(topScope.GetNamesInAllTopScopes(all_names, ev, this.is_static)); - if (proc_realization != null) - lst.AddRange(proc_realization.GetNamesInAllTopScopes(all_names, ev, this.is_static)); + if (procRealization != null) + lst.AddRange(procRealization.GetNamesInAllTopScopes(all_names, ev, this.is_static)); //if (proc_realization != null && proc_realization.top_mod_scope != null) lst.AddRange(proc_realization.top_mod_scope.GetNamesInAllTopScopes(all_names,ev,is_static)); return lst.ToArray(); } diff --git a/TestSuite/intellisense_tests/shortfunc1.pas b/TestSuite/intellisense_tests/shortfunc1.pas new file mode 100644 index 000000000..e8caba806 --- /dev/null +++ b/TestSuite/intellisense_tests/shortfunc1.pas @@ -0,0 +1,10 @@ +type + t1=class + function f1:real; + end; + +function t1.f1 := integer(0); + +begin + var r{@var r: real;@} := (new t1).f1; +end. \ No newline at end of file