intellisense: type inference for delegates

This commit is contained in:
Бондарев Иван 2017-02-19 14:55:34 +01:00
parent 65a2566223
commit 10ac29f6bc
2 changed files with 60 additions and 41 deletions

View file

@ -333,13 +333,24 @@ namespace CodeCompletion
if (returned_scope is ProcScope)
{
if ((returned_scope as ProcScope).parameters.Count == 0)
{
if ((returned_scope as ProcScope).return_type != null)
returned_scope = (returned_scope as ProcScope).return_type;
else
returned_scope = new ProcType(returned_scope as ProcScope);
}
else
{
returned_scopes = cur_scope.FindOverloadNames(_ident.name);
returned_scope = returned_scopes.Find(x => x is ProcScope && (x as ProcScope).parameters.Count == 0);
if (returned_scope == null)
{
returned_scope = returned_scopes[0];
if (returned_scope is ProcScope && (returned_scope as ProcScope).return_type == null )
returned_scope = new ProcType(returned_scope as ProcScope);
}
else if (returned_scopes.Count > 0 && returned_scopes[0] is ProcScope && (returned_scopes[0] as ProcScope).return_type == null)
returned_scope = new ProcType(returned_scopes[0] as ProcScope);
}
}
else if (returned_scope is TypeScope)
@ -348,7 +359,7 @@ namespace CodeCompletion
else
{
returned_scopes = cur_scope.FindOverloadNames(_ident.name);
for (int i=0; i<returned_scopes.Count; i++)
for (int i = 0; i < returned_scopes.Count; i++)
{
if (returned_scopes[i] is ElementScope)
{

View file

@ -0,0 +1,8 @@
procedure Test(a: integer);
begin
end;
begin
var p{@var p: procedure(a: integer);@} := Test+Test;
end.