This commit is contained in:
Бондарев Иван 2018-08-06 19:01:31 +02:00
parent c7cf0c9d58
commit 7020bb67b9
3 changed files with 34 additions and 3 deletions

View file

@ -2734,6 +2734,11 @@ namespace CodeCompletion
}
else if (returned_scope is TypeScope)
is_type = true;
else if (returned_scope is ProcScope && (returned_scope as ProcScope).is_constructor)
{
returned_scope = (returned_scope as ProcScope).declaringType;
return;
}
}
else
{
@ -3108,11 +3113,18 @@ namespace CodeCompletion
if (ps.name == "Copy" && ps.return_type.Name == "Array" && _method_call.parameters.expressions.Count > 0)
{
_method_call.parameters.expressions[0].visit(this);
}
else
{
returned_scope = ps.return_type;
if (ps.return_type.lazy_instance)
returned_scope = ps.return_type.original_type.GetInstance(ps.return_type.instances);
}
}
else if (ps.is_constructor)
returned_scope = ps.declaringType;
else
returned_scope = null;
}

View file

@ -3628,6 +3628,7 @@ namespace CodeCompletion
protected List<string> generic_params;
public bool is_final;
public bool aliased = false;
internal bool lazy_instance = false;
public TypeScope() { }
public TypeScope(SymbolKind kind, SymScope topScope, SymScope baseScope)
@ -3901,6 +3902,7 @@ namespace CodeCompletion
{
TypeScope ts = new TypeScope(this.kind, this.topScope, this.baseScope);
ts.original_type = this;
ts.lazy_instance = true;
ts.loc = this.loc;
for (int i = 0; i < gen_args.Count; i++)
{
@ -3971,7 +3973,7 @@ namespace CodeCompletion
{
ElementScope es = ss as ElementScope;
ElementScope new_es = new ElementScope(new SymInfo(es.si.name, es.si.kind, es.si.name), es.sc, ts);
ts.members[i] = new_es;
ts.members[ts.members.IndexOf(ss)] = new_es;
new_es.loc = es.loc;
new_es.documentation = es.documentation;
new_es.si.acc_mod = es.si.acc_mod;
@ -4002,7 +4004,7 @@ namespace CodeCompletion
new_proc.is_abstract = ps.is_abstract;
new_proc.is_override = ps.is_override;
new_proc.is_reintroduce = ps.is_reintroduce;
ts.members[i] = new_proc;
ts.members[ts.members.IndexOf(ss)] = new_proc;
if (ps.parameters != null)
for (int j = 0; j < ps.parameters.Count; j++)
{

View file

@ -0,0 +1,17 @@
type
t1<T>=class
b:byte;
c: T;
public class function GetNew := default(t1<T>);
end;
begin
var a1 := t1&<byte>.GetNew();
a1.b{@var t1<>.b: byte;@} := 3;
a1.c{@var t1<>.c: byte;@} := 3;
var a2 := t1&<byte>.Create;
a2.b{@var t1<>.b: byte;@} := 4;
end.