This commit is contained in:
Бондарев Иван 2019-01-31 20:36:28 +01:00
parent ccb2cb2401
commit 9b3ec6c996
3 changed files with 42 additions and 2 deletions

View file

@ -997,7 +997,7 @@ namespace CodeCompletion
ps.is_reintroduce = true;
}
private ProcScope select_function_definition(ProcScope ps, formal_parameters prms, TypeScope return_type, TypeScope declType, bool function=false)
private ProcScope select_function_definition(ProcScope ps, formal_parameters prms, TypeScope return_type, TypeScope declType, bool function=false, bool static_constructor=false)
{
SymScope tmp = returned_scope;
List<ElementScope> lst = new List<ElementScope>();
@ -1070,6 +1070,15 @@ namespace CodeCompletion
{
while (ps != null)
{
if (ps.is_constructor && ps.is_static != static_constructor)
{
ps = ps.nextProc;
continue;
}
else if (ps.is_constructor && ps.is_static && static_constructor)
{
return ps;
}
if (ps.parameters == null || ps.parameters.Count == 0)
{
if (function && ps.return_type != null && return_type == null)
@ -3855,7 +3864,7 @@ namespace CodeCompletion
ps.head_loc = loc;
}
else
ps = select_function_definition(ps, _constructor.parameters, topScope as TypeScope, topScope as TypeScope);
ps = select_function_definition(ps, _constructor.parameters, topScope as TypeScope, topScope as TypeScope, false, _constructor.class_keyword);
//while (ps != null && ps.already_defined) ps = ps.nextProc;
if (ps == null)
{

View file

@ -2449,6 +2449,10 @@ namespace PascalABCCompiler.Parsers
int i=0;
bool is_cnstr = false;
StringBuilder sb = new StringBuilder();
if (meth.StartsWith("static "))
meth = meth.Remove(0, "static ".Length);
else if (meth.StartsWith("class "))
meth = meth.Remove(0, "class ".Length);
if (scope.IsStatic)
sb.Append("static ");
while (i < meth.Length && char.IsLetterOrDigit(meth[i]))

View file

@ -0,0 +1,27 @@
type
t1 = class
static constructor;
constructor;
constructor(i: integer);
end;
static constructor t1.Create{@static constructor t1();@};
begin
end;
constructor t1.Create{@constructor t1();@};
begin
end;
constructor t1.Create{@constructor t1(i: integer);@}(i: integer);
begin
end;
begin
end.