bug fix #624
This commit is contained in:
parent
aa6ca605c3
commit
4b77e4822c
|
|
@ -867,9 +867,9 @@ namespace CodeCompletion
|
||||||
ExpressionVisitor ev = new ExpressionVisitor(expr, ss, visitor);
|
ExpressionVisitor ev = new ExpressionVisitor(expr, ss, visitor);
|
||||||
ss = ev.GetScopeOfExpression();
|
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.line = pr.loc.begin_line_num;
|
||||||
pos.column = pr.loc.begin_column_num;
|
pos.column = pr.loc.begin_column_num;
|
||||||
pos.file_name = pr.loc.doc.file_name;
|
pos.file_name = pr.loc.doc.file_name;
|
||||||
|
|
|
||||||
|
|
@ -1556,7 +1556,8 @@ namespace CodeCompletion
|
||||||
if (_function_header.parameters != null)
|
if (_function_header.parameters != null)
|
||||||
add_parameters(ps, _function_header.parameters);
|
add_parameters(ps, _function_header.parameters);
|
||||||
cur_scope = tmp;
|
cur_scope = tmp;
|
||||||
ps.return_type = return_type;
|
if (ps.procRealization == null)
|
||||||
|
ps.return_type = return_type;
|
||||||
//cur_scope = ps;
|
//cur_scope = ps;
|
||||||
if (cur_scope is TypeScope && !ps.is_static)
|
if (cur_scope is TypeScope && !ps.is_static)
|
||||||
ps.AddName("self", new ElementScope(new SymInfo("self", SymbolKind.Parameter, "self"), cur_scope, ps));
|
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)
|
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);
|
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;
|
var bl = _procedure_definition.proc_body as block;
|
||||||
if (bl != null && bl.program_code != null)
|
if (bl != null && bl.program_code != null)
|
||||||
|
|
@ -1664,7 +1665,7 @@ namespace CodeCompletion
|
||||||
|
|
||||||
if (cur_scope != null && cur_scope is ProcScope)
|
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)
|
if (pr == null)
|
||||||
cur_scope.body_loc = get_location(_procedure_definition.proc_body);
|
cur_scope.body_loc = get_location(_procedure_definition.proc_body);
|
||||||
else
|
else
|
||||||
|
|
@ -3428,7 +3429,7 @@ namespace CodeCompletion
|
||||||
{
|
{
|
||||||
ProcRealization pr = new ProcRealization(ps, cur_scope);
|
ProcRealization pr = new ProcRealization(ps, cur_scope);
|
||||||
pr.already_defined = true;
|
pr.already_defined = true;
|
||||||
ps.proc_realization = pr;
|
ps.procRealization = pr;
|
||||||
pr.loc = cur_loc;
|
pr.loc = cur_loc;
|
||||||
pr.head_loc = loc;
|
pr.head_loc = loc;
|
||||||
is_realization = true;
|
is_realization = true;
|
||||||
|
|
@ -3438,7 +3439,7 @@ namespace CodeCompletion
|
||||||
{
|
{
|
||||||
ProcRealization pr = new ProcRealization(ps, impl_scope);
|
ProcRealization pr = new ProcRealization(ps, impl_scope);
|
||||||
pr.already_defined = true;
|
pr.already_defined = true;
|
||||||
ps.proc_realization = pr;
|
ps.procRealization = pr;
|
||||||
pr.loc = cur_loc;
|
pr.loc = cur_loc;
|
||||||
pr.head_loc = loc;
|
pr.head_loc = loc;
|
||||||
is_realization = true;
|
is_realization = true;
|
||||||
|
|
|
||||||
|
|
@ -1424,7 +1424,7 @@ namespace CodeCompletion
|
||||||
{
|
{
|
||||||
this.def_proc = def_proc;
|
this.def_proc = def_proc;
|
||||||
this.top_mod_scope = top_mod_scope;
|
this.top_mod_scope = top_mod_scope;
|
||||||
def_proc.proc_realization = this;
|
def_proc.procRealization = this;
|
||||||
if (def_proc != null)
|
if (def_proc != null)
|
||||||
this.topScope = def_proc.topScope;
|
this.topScope = def_proc.topScope;
|
||||||
this.si = new SymInfo(def_proc.si.name, def_proc.si.kind, def_proc.si.description);
|
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_constructor;
|
||||||
public bool is_forward = false;
|
public bool is_forward = false;
|
||||||
public bool already_defined = false;//sush. li realizacija
|
public bool already_defined = false;//sush. li realizacija
|
||||||
public ProcRealization proc_realization;//ssylka na realizaciju
|
public ProcRealization procRealization;//ssylka na realizaciju
|
||||||
public List<string> template_parameters;
|
public List<string> template_parameters;
|
||||||
public TypeScope declaringType;
|
public TypeScope declaringType;
|
||||||
public bool is_extension = false;
|
public bool is_extension = false;
|
||||||
|
|
@ -1924,7 +1924,7 @@ namespace CodeCompletion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return proc_realization;
|
return procRealization;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2034,8 +2034,8 @@ namespace CodeCompletion
|
||||||
if (sc != null) return sc;
|
if (sc != null) return sc;
|
||||||
if (topScope != null) sc = topScope.FindName(name);
|
if (topScope != null) sc = topScope.FindName(name);
|
||||||
if (sc != null) return sc;
|
if (sc != null) return sc;
|
||||||
if (proc_realization != null && proc_realization.top_mod_scope != null)
|
if (procRealization != null && procRealization.top_mod_scope != null)
|
||||||
return proc_realization.top_mod_scope.FindName(name);
|
return procRealization.top_mod_scope.FindName(name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2044,8 +2044,8 @@ namespace CodeCompletion
|
||||||
List<SymScope> names = internal_find_overloads(name, true);
|
List<SymScope> names = internal_find_overloads(name, true);
|
||||||
if (topScope != null)
|
if (topScope != null)
|
||||||
names.AddRange(topScope.FindOverloadNames(name));
|
names.AddRange(topScope.FindOverloadNames(name));
|
||||||
if (proc_realization != null && proc_realization.top_mod_scope != null)
|
if (procRealization != null && procRealization.top_mod_scope != null)
|
||||||
names.AddRange(proc_realization.top_mod_scope.FindOverloadNames(name));
|
names.AddRange(procRealization.top_mod_scope.FindOverloadNames(name));
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2105,8 +2105,8 @@ namespace CodeCompletion
|
||||||
}
|
}
|
||||||
if (topScope != null)
|
if (topScope != null)
|
||||||
lst.AddRange(topScope.GetNamesInAllTopScopes(all_names, ev, this.is_static));
|
lst.AddRange(topScope.GetNamesInAllTopScopes(all_names, ev, this.is_static));
|
||||||
if (proc_realization != null)
|
if (procRealization != null)
|
||||||
lst.AddRange(proc_realization.GetNamesInAllTopScopes(all_names, ev, this.is_static));
|
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));
|
//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();
|
return lst.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
TestSuite/intellisense_tests/shortfunc1.pas
Normal file
10
TestSuite/intellisense_tests/shortfunc1.pas
Normal file
|
|
@ -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.
|
||||||
Loading…
Reference in a new issue