bug fix #349
This commit is contained in:
parent
10ac29f6bc
commit
a941b3ebba
|
|
@ -2577,11 +2577,15 @@ namespace CodeCompletion
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private ProcScope select_method(SymScope[] procs, TypeScope tleft, TypeScope tright, TypeScope obj, params expression[] args)
|
||||
|
||||
private SymScope[] selected_methods = null;
|
||||
|
||||
private ProcScope select_method(SymScope[] meths, TypeScope tleft, TypeScope tright, TypeScope obj, params expression[] args)
|
||||
{
|
||||
List<SymScope> arg_types = new List<SymScope>();
|
||||
List<TypeScope> arg_types2 = new List<TypeScope>();
|
||||
SymScope[] saved_selected_methods = selected_methods;
|
||||
selected_methods = meths;
|
||||
if (tleft != null || tright != null)
|
||||
{
|
||||
if (tleft != null)
|
||||
|
|
@ -2605,18 +2609,19 @@ namespace CodeCompletion
|
|||
arg_types2.Add(returned_scope as TypeScope);
|
||||
}
|
||||
}
|
||||
selected_methods = saved_selected_methods;
|
||||
List<ProcScope> good_procs = new List<ProcScope>();
|
||||
for (int i=0; i<procs.Length; i++)
|
||||
for (int i=0; i<meths.Length; i++)
|
||||
{
|
||||
if (procs[i] is ProcScope)
|
||||
if (meths[i] is ProcScope)
|
||||
{
|
||||
if (is_good_overload(procs[i] as ProcScope, arg_types))
|
||||
good_procs.Add(procs[i] as ProcScope);
|
||||
if (is_good_overload(meths[i] as ProcScope, arg_types))
|
||||
good_procs.Add(meths[i] as ProcScope);
|
||||
}
|
||||
else if (procs[i] is ProcType)
|
||||
else if (meths[i] is ProcType)
|
||||
{
|
||||
if (is_good_overload((procs[i] as ProcType).target, arg_types))
|
||||
good_procs.Add((procs[i] as ProcType).target);
|
||||
if (is_good_overload((meths[i] as ProcType).target, arg_types))
|
||||
good_procs.Add((meths[i] as ProcType).target);
|
||||
}
|
||||
}
|
||||
if (good_procs.Count > 1)
|
||||
|
|
@ -4401,7 +4406,19 @@ namespace CodeCompletion
|
|||
if (_function_lambda_definition.ident_list != null)
|
||||
foreach (ident id in _function_lambda_definition.ident_list.idents)
|
||||
{
|
||||
ElementScope es = new ElementScope(new SymInfo(id.name, SymbolKind.Parameter, ""), new UnknownScope(new SymInfo("T", SymbolKind.Type, "T")), ps);
|
||||
TypeScope param_type = new UnknownScope(new SymInfo("T", SymbolKind.Type, "T"));
|
||||
/*if (selected_methods != null)
|
||||
{
|
||||
foreach (ProcScope meth in selected_methods)
|
||||
{
|
||||
if (meth.parameters != null && meth.parameters.Count > 0 && (meth.parameters[1].sc as TypeScope).IsDelegate
|
||||
&& (meth.parameters[1].sc as TypeScope).IsGeneric)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
ElementScope es = new ElementScope(new SymInfo(id.name, SymbolKind.Parameter, ""), param_type, ps);
|
||||
ps.AddName(id.name, es);
|
||||
ps.AddParameter(es);
|
||||
es.loc = get_location(id);
|
||||
|
|
|
|||
|
|
@ -671,11 +671,6 @@ namespace CodeCompletion
|
|||
{
|
||||
//SortedDictionary<string,SymInfo> dict = new SortedDictionary<string,SymInfo>();
|
||||
List<SymInfo> lst = new List<SymInfo>();
|
||||
/*foreach (string s in ht.Keys)
|
||||
{
|
||||
SymScope sc = ht[s] as SymScope;
|
||||
if (sc != this) lst.Add(sc.si);
|
||||
}*/
|
||||
foreach (SymScope ss in members)
|
||||
{
|
||||
if (ss != this && !ss.si.name.StartsWith("$"))
|
||||
|
|
@ -706,11 +701,6 @@ namespace CodeCompletion
|
|||
public virtual SymInfo[] GetNamesInAllTopScopes(bool all_names, ExpressionVisitor ev, bool is_static)
|
||||
{
|
||||
List<SymInfo> lst = new List<SymInfo>();
|
||||
/*foreach (string s in ht.Keys)
|
||||
{
|
||||
SymScope sc = ht[s] as SymScope;
|
||||
lst.Add(sc.si);
|
||||
}*/
|
||||
foreach (SymScope ss in members)
|
||||
{
|
||||
if (ss != this && !ss.si.name.StartsWith("$"))
|
||||
|
|
@ -927,10 +917,6 @@ namespace CodeCompletion
|
|||
sc = used_units[i].FindNameOnlyInType(name);
|
||||
if (sc != null) return sc;
|
||||
}
|
||||
//Type t = PascalABCCompiler.NetHelper.NetHelper.FindType(name,unl);
|
||||
//if (t != null && !t.IsNested) return new CompiledScope(new SymInfo(t.Name, SymbolKind.Type,t.FullName),t);
|
||||
//if (PascalABCCompiler.NetHelper.NetHelper.IsNetNamespace(name))
|
||||
// return new NamespaceScope(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -963,10 +949,6 @@ namespace CodeCompletion
|
|||
sc = used_units[i].FindNameOnlyInType(name);
|
||||
if (sc != null) return sc;
|
||||
}
|
||||
//Type t = PascalABCCompiler.NetHelper.NetHelper.FindType(name,unl);
|
||||
//if (t != null && !t.IsNested) return new CompiledScope(new SymInfo(t.Name, SymbolKind.Type,t.FullName),t);
|
||||
//if (PascalABCCompiler.NetHelper.NetHelper.IsNetNamespace(name))
|
||||
// return new NamespaceScope(name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1138,11 +1120,6 @@ namespace CodeCompletion
|
|||
if (sc != null) return sc;
|
||||
}
|
||||
if (topScope != null) return topScope.FindName(name);
|
||||
|
||||
//Type t = PascalABCCompiler.NetHelper.NetHelper.FindType(name,unl);
|
||||
//if (t != null && !t.IsNested) return new CompiledScope(new SymInfo(t.Name, SymbolKind.Type,t.FullName),t);
|
||||
//if (PascalABCCompiler.NetHelper.NetHelper.IsNetNamespace(name))
|
||||
// return new NamespaceScope(name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1615,6 +1592,14 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override bool IsDelegate
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override PascalABCCompiler.Parsers.SymbolKind ElemKind
|
||||
{
|
||||
get { return PascalABCCompiler.Parsers.SymbolKind.Delegate; }
|
||||
|
|
@ -2145,14 +2130,6 @@ namespace CodeCompletion
|
|||
|
||||
public override bool IsEqual(SymScope ts)
|
||||
{
|
||||
/*ProcScope ps = ts as ProcScope;
|
||||
if (ps == null) return false;
|
||||
if (ps is ProcRealization) ps = (ps as ProcRealization).def_proc;
|
||||
if (this == ps) return true;
|
||||
if (equal_parameters_and_result(ps))
|
||||
return true;
|
||||
if (ps.nextProc != null) return IsEqual(ps.nextProc);
|
||||
return false;*/
|
||||
ProcScope ps = ts as ProcScope;
|
||||
if (ps == null) return false;
|
||||
if (ps is ProcRealization) ps = (ps as ProcRealization).def_proc;
|
||||
|
|
@ -2445,12 +2422,6 @@ namespace CodeCompletion
|
|||
return null;
|
||||
}
|
||||
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
// {
|
||||
// //SortedDictionary<string,SymInfo> dict = new SortedDictionary<string,SymInfo>();
|
||||
// return new SymInfo[0];
|
||||
// }
|
||||
|
||||
public override SymInfo[] GetNamesAsInObject()
|
||||
{
|
||||
//SortedDictionary<string,SymInfo> dict = new SortedDictionary<string,SymInfo>();
|
||||
|
|
@ -2695,11 +2666,6 @@ namespace CodeCompletion
|
|||
return actType.GetConstructors(search_in_base);
|
||||
}
|
||||
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
// {
|
||||
// return actType.GetNamesAsInObject(ev);
|
||||
// }
|
||||
|
||||
public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
|
||||
{
|
||||
return actType.GetNamesAsInObject(ev);
|
||||
|
|
@ -2862,11 +2828,6 @@ namespace CodeCompletion
|
|||
return actType.GetConstructors(search_in_base);
|
||||
}
|
||||
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
// {
|
||||
// return actType.GetNamesAsInObject(ev);
|
||||
// }
|
||||
|
||||
public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
|
||||
{
|
||||
return actType.GetNamesAsInObject(ev);
|
||||
|
|
@ -3068,12 +3029,6 @@ namespace CodeCompletion
|
|||
}
|
||||
return syms;
|
||||
}
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
// {
|
||||
// if (is_dynamic_arr)
|
||||
// return base.GetNames(ev);
|
||||
// return new SymInfo[0];
|
||||
// }
|
||||
|
||||
public override SymScope FindName(string name)
|
||||
{
|
||||
|
|
@ -3269,11 +3224,6 @@ namespace CodeCompletion
|
|||
return new SymInfo[0];
|
||||
}
|
||||
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
// {
|
||||
// //SortedDictionary<string,SymInfo> dict = new SortedDictionary<string,SymInfo>();
|
||||
// return new SymInfo[0];
|
||||
// }
|
||||
|
||||
public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
|
||||
{
|
||||
|
|
@ -3393,12 +3343,6 @@ namespace CodeCompletion
|
|||
return new SymInfo[0];
|
||||
}
|
||||
|
||||
// public override SymInfo[] GetNames(ExpressionVisitor ev)
|
||||
// {
|
||||
// //SortedDictionary<string,SymInfo> dict = new SortedDictionary<string,SymInfo>();
|
||||
// return new SymInfo[0];
|
||||
// }
|
||||
|
||||
public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
|
||||
{
|
||||
//SortedDictionary<string,SymInfo> dict = new SortedDictionary<string,SymInfo>();
|
||||
|
|
@ -3455,7 +3399,6 @@ namespace CodeCompletion
|
|||
if ((ts as PointerScope).ref_type == null)
|
||||
return true;
|
||||
return ref_type == (ts as PointerScope).ref_type;
|
||||
return base.IsEqual(ts);
|
||||
}
|
||||
|
||||
public override string GetDescription()
|
||||
|
|
@ -3625,6 +3568,14 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public virtual bool IsDelegate
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsArray
|
||||
{
|
||||
get
|
||||
|
|
@ -4695,6 +4646,7 @@ namespace CodeCompletion
|
|||
this.si.name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this);
|
||||
this.si.kind = get_kind();
|
||||
this.si.description = GetDescription();
|
||||
|
||||
if (ctn.IsGenericType && !ctn.IsGenericTypeDefinition)
|
||||
{
|
||||
this.original_type = TypeTable.get_compiled_type(ctn.GetGenericTypeDefinition());
|
||||
|
|
@ -4757,6 +4709,22 @@ namespace CodeCompletion
|
|||
return TypeTable.get_compiled_type(t);
|
||||
}
|
||||
|
||||
public override bool IsGeneric
|
||||
{
|
||||
get
|
||||
{
|
||||
return original_type != null;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsDelegate
|
||||
{
|
||||
get
|
||||
{
|
||||
return ctn == PascalABCCompiler.NetHelper.NetHelper.MulticastDelegateType || ctn.BaseType == PascalABCCompiler.NetHelper.NetHelper.MulticastDelegateType;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Rank
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -484,7 +484,12 @@ namespace PascalABCCompiler.PCU
|
|||
else if (tn is generic_instance_type_node)
|
||||
tn.Scope.AddSymbol(names[i].name, si);
|
||||
else if (tn is common_type_node)
|
||||
{
|
||||
(tn as common_type_node).scope.AddSymbol(names[i].name, si);
|
||||
if (tn.IsDelegate)
|
||||
SystemLibrary.SystemLibrary.system_delegate_type.Scope.AddSymbol(names[i].name, si);
|
||||
}
|
||||
|
||||
else
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
|
@ -2903,6 +2908,10 @@ namespace PascalABCCompiler.PCU
|
|||
for (int i=0; i<num_nest_funcs; i++)
|
||||
cnfn.functions_nodes_list.AddElement(GetNestedFunction());
|
||||
//br.ReadInt32();//code;
|
||||
if (cnfn.name == "*")
|
||||
{
|
||||
|
||||
}
|
||||
cnfn.loc = ReadDebugInfo();
|
||||
cnfn.function_code = (restore_code /*|| cnfn.is_generic_function*/) ? GetCode(br.ReadInt32()) : new wrapped_function_body(this, br.ReadInt32());
|
||||
cnfn.ConnectedToType = ConnectedToType;
|
||||
|
|
|
|||
Loading…
Reference in a new issue