parent
20a1436129
commit
4cec1e7c43
|
|
@ -336,7 +336,7 @@ namespace CodeCompletion
|
|||
ProcScope proc = symsc as ProcScope;
|
||||
if (proc != null && !proc.already_defined && !proc.is_abstract && symsc.loc != null)
|
||||
{
|
||||
meths.Add((ProcScope)proc.WithRefreshedDescription());
|
||||
meths.Add(proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ namespace CodeCompletion
|
|||
ProcScope proc = symsc as ProcScope;
|
||||
if (proc != null && !proc.already_defined && !proc.is_abstract && symsc.loc != null)
|
||||
{
|
||||
meths.Add((ProcScope)proc.WithRefreshedDescription());
|
||||
meths.Add(proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1016,12 +1016,9 @@ namespace CodeCompletion
|
|||
}
|
||||
if (ss != null && ss.si != null)
|
||||
{
|
||||
ss = ss.WithRefreshedDescription();
|
||||
|
||||
try
|
||||
{
|
||||
if (!ss.si.has_doc)
|
||||
{
|
||||
if (ss.si.has_doc != true)
|
||||
if (ss is CompiledScope)
|
||||
ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledScope).ctn));
|
||||
else if (ss is CompiledMethodScope)
|
||||
|
|
@ -1056,7 +1053,6 @@ namespace CodeCompletion
|
|||
else if (ss is ElementScope && string.IsNullOrEmpty(ss.si.description) && (ss as ElementScope).sc is TypeScope)
|
||||
ss.si.description = (ss as ElementScope).sc.Description;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
|
|
@ -1140,8 +1136,6 @@ namespace CodeCompletion
|
|||
si = scopes[0];
|
||||
if (si != null && si is ProcScope)
|
||||
{
|
||||
scopes.ForEach(sc => sc = (ProcScope)sc.WithRefreshedDescription());
|
||||
|
||||
List<string> procs = new List<string>();
|
||||
List<ProcScope> proc_defs = new List<ProcScope>();
|
||||
ProcScope ps = si as ProcScope;
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ namespace CodeCompletion
|
|||
List<SymInfo> lst = new List<SymInfo>();
|
||||
List<ProcScope> meth_list = GetExtensionMethods(ts);
|
||||
for (int i = 0; i < meth_list.Count; i++)
|
||||
lst.Add(meth_list[i].WithRefreshedDescription().si);
|
||||
lst.Add(meth_list[i].si);
|
||||
return lst.ToArray();
|
||||
}
|
||||
|
||||
|
|
@ -531,39 +531,6 @@ namespace CodeCompletion
|
|||
return si.name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Построение зависимого от языка описания scope и сохранение его в description, addit_name при необходимости
|
||||
/// </summary>
|
||||
public virtual void BuildDescription() { }
|
||||
|
||||
/// <summary>
|
||||
/// Вызывает BuildDescription для текущего scope, если Description не равно null.
|
||||
/// Документация внутри Description остается прежней.
|
||||
/// </summary>
|
||||
public SymScope WithRefreshedDescription()
|
||||
{
|
||||
if (Description != null)
|
||||
{
|
||||
int ind = Description.IndexOf("\n");
|
||||
|
||||
string docs = null;
|
||||
|
||||
if (ind != -1)
|
||||
{
|
||||
docs = Description.Substring(ind + 1);
|
||||
}
|
||||
|
||||
BuildDescription();
|
||||
|
||||
if (ind != -1)
|
||||
{
|
||||
si.description += "\n" + docs;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public virtual string GetDescription()
|
||||
{
|
||||
if (si != null)
|
||||
|
|
@ -750,7 +717,7 @@ namespace CodeCompletion
|
|||
|
||||
SymScope foundScope = FindScopeByLocation(line, column, ref minScope, findMinScope);
|
||||
|
||||
return findMinScope ? minScope?.WithRefreshedDescription() : foundScope?.WithRefreshedDescription();
|
||||
return findMinScope ? minScope : foundScope;
|
||||
}
|
||||
|
||||
//naiti scope po location
|
||||
|
|
@ -833,7 +800,7 @@ namespace CodeCompletion
|
|||
{
|
||||
if (ss != this && !(ss is NamespaceScope) && ss.si.kind != SymbolKind.Namespace && !IsHiddenName(ss.si.name))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -872,13 +839,13 @@ namespace CodeCompletion
|
|||
{
|
||||
if (IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
}
|
||||
else lst.Add(ss.WithRefreshedDescription().si);
|
||||
else lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -903,17 +870,17 @@ namespace CodeCompletion
|
|||
{
|
||||
if (IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
else if (ts != null && ts.predef_loc != null && IsAfterDefinition(ts.predef_loc.begin_line_num, ts.predef_loc.begin_column_num))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
}
|
||||
else lst.Add(ss.WithRefreshedDescription().si);
|
||||
else lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -941,7 +908,7 @@ namespace CodeCompletion
|
|||
List<SymInfo> lst = new List<SymInfo>();
|
||||
foreach (SymScope ss in members)
|
||||
{
|
||||
if (ss != this && !(ss is NamespaceScope) && ss.si.kind != SymbolKind.Namespace) lst.Add(ss.WithRefreshedDescription().si);
|
||||
if (ss != this && !(ss is NamespaceScope) && ss.si.kind != SymbolKind.Namespace) lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -1191,8 +1158,8 @@ namespace CodeCompletion
|
|||
this.symbol_table = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
|
||||
is_namespace = isNamespace;
|
||||
file_name = fileName;
|
||||
si.description = this.ToString();
|
||||
|
||||
BuildDescription();
|
||||
}
|
||||
|
||||
~InterfaceUnitScope()
|
||||
|
|
@ -1380,11 +1347,6 @@ namespace CodeCompletion
|
|||
return lst.ToArray();
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetSimpleDescription(this);
|
||||
|
|
@ -1668,11 +1630,6 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
}
|
||||
|
||||
public void MakeDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
|
|
@ -1995,13 +1952,6 @@ namespace CodeCompletion
|
|||
return def_proc.IsEqual(ts);
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
def_proc.BuildDescription();
|
||||
|
||||
si.description = def_proc.Description;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return def_proc.ToString();
|
||||
|
|
@ -2601,13 +2551,6 @@ namespace CodeCompletion
|
|||
if (documentation != null) this.si.description += "\n" + this.documentation;
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
if (documentation != null && documentation.Length > 0 && documentation[0] == '-') return;
|
||||
si.description = ToString();
|
||||
si.addit_name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this);
|
||||
}
|
||||
|
||||
public void AddTemplateParameter(string name)
|
||||
{
|
||||
if (template_parameters == null) template_parameters = new List<string>();
|
||||
|
|
@ -2670,13 +2613,13 @@ namespace CodeCompletion
|
|||
{
|
||||
if (IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
}
|
||||
else lst.Add(ss.WithRefreshedDescription().si);
|
||||
else lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -2697,13 +2640,13 @@ namespace CodeCompletion
|
|||
{
|
||||
if (IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
}
|
||||
else lst.Add(ss.WithRefreshedDescription().si);
|
||||
else lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -3216,7 +3159,7 @@ namespace CodeCompletion
|
|||
this.declScope = declScope;
|
||||
this.topScope = declScope;
|
||||
this.name = name;
|
||||
BuildDescription();
|
||||
si.description = name + " in " + declScope.si.name;
|
||||
}
|
||||
|
||||
public override TypeScope GetInstance(List<TypeScope> gen_args, bool exact = false)
|
||||
|
|
@ -3234,10 +3177,6 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = name + " in " + declScope.si.name;
|
||||
}
|
||||
}
|
||||
|
||||
//sinonim type myreal = real;
|
||||
|
|
@ -3252,7 +3191,7 @@ namespace CodeCompletion
|
|||
this.si = si;
|
||||
this.generic_params = generic_params;
|
||||
if (actType.si != null && actType.si.description != null)
|
||||
BuildDescription();
|
||||
this.si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
//this.si.describe = "type "+this.si.name + " = "+actType.si.name;
|
||||
}
|
||||
|
||||
|
|
@ -3438,7 +3377,7 @@ namespace CodeCompletion
|
|||
if (len != null)
|
||||
{
|
||||
this.si = new SymInfo("string", SymbolKind.Type, "string");
|
||||
BuildDescription();
|
||||
this.si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
}
|
||||
else this.si = actType.si;
|
||||
}
|
||||
|
|
@ -4529,7 +4468,7 @@ namespace CodeCompletion
|
|||
if (members != null)
|
||||
foreach (SymScope ss in members)
|
||||
if (ss is ProcScope && ss.is_virtual)
|
||||
procs.Add(ss.WithRefreshedDescription() as ProcScope);
|
||||
procs.Add(ss as ProcScope);
|
||||
if (baseScope != null)
|
||||
procs.AddRange(baseScope.GetOverridableMethods());
|
||||
return procs;
|
||||
|
|
@ -4541,7 +4480,7 @@ namespace CodeCompletion
|
|||
if (members != null)
|
||||
foreach (SymScope ss in members)
|
||||
if (ss is ProcScope && (ss.is_abstract || this.si.kind == SymbolKind.Interface))
|
||||
procs.Add(ss.WithRefreshedDescription() as ProcScope);
|
||||
procs.Add(ss as ProcScope);
|
||||
if (si.kind == SymbolKind.Interface && implemented_interfaces != null)
|
||||
foreach (TypeScope t in implemented_interfaces)
|
||||
procs.AddRange(t.GetAbstractMethods());
|
||||
|
|
@ -4912,11 +4851,6 @@ namespace CodeCompletion
|
|||
return constrs;
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
}
|
||||
|
||||
//opisanie, vysvechivaetsja v zheltkom okoshke
|
||||
public override string GetDescription()
|
||||
{
|
||||
|
|
@ -4936,7 +4870,7 @@ namespace CodeCompletion
|
|||
{
|
||||
if (!IsHiddenName(ss.si.name))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -4961,24 +4895,21 @@ namespace CodeCompletion
|
|||
if (ss.si.acc_mod == access_modifer.private_modifer)
|
||||
{
|
||||
if (ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
|
||||
AddSymInfo();
|
||||
if (!is_static) lst.Add(ss.si);
|
||||
else if (ss.is_static) lst.Add(ss.si);
|
||||
}
|
||||
else if (ss.si.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
AddSymInfo();
|
||||
if (!is_static) lst.Add(ss.si);
|
||||
else if (ss.is_static) lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
AddSymInfo();
|
||||
if (!is_static) lst.Add(ss.si);
|
||||
else if (ss.is_static) lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
||||
void AddSymInfo()
|
||||
{
|
||||
if (!is_static) lst.Add(ss.WithRefreshedDescription().si);
|
||||
else if (ss.is_static) lst.Add(ss.WithRefreshedDescription().si);
|
||||
}
|
||||
}
|
||||
if (baseScope != null)
|
||||
lst.AddRange(baseScope.GetNamesAsInBaseClass(ev, is_static));
|
||||
|
|
@ -4999,13 +4930,13 @@ namespace CodeCompletion
|
|||
if (!IsHiddenName(ss.si.name) && !ss.is_static)
|
||||
if (!(ss is ProcScope) && !(ss is TemplateParameterScope))
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
else if (!(ss as ProcScope).IsConstructor())
|
||||
{
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -5060,24 +4991,21 @@ namespace CodeCompletion
|
|||
if (ss.si.acc_mod == access_modifer.private_modifer)
|
||||
{
|
||||
if (ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
|
||||
AddSymInfo();
|
||||
if (!is_static) lst.Add(ss.si);
|
||||
else if (ss.is_static) lst.Add(ss.si);
|
||||
}
|
||||
else if (ss.si.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
AddSymInfo();
|
||||
if (!is_static) lst.Add(ss.si);
|
||||
else if (ss.is_static) lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
AddSymInfo();
|
||||
if (!is_static) lst.Add(ss.si);
|
||||
else if (ss.is_static) lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
||||
void AddSymInfo()
|
||||
{
|
||||
if (!is_static) lst.Add(ss.WithRefreshedDescription().si);
|
||||
else if (ss.is_static) lst.Add(ss.WithRefreshedDescription().si);
|
||||
}
|
||||
}
|
||||
if (baseScope != null)
|
||||
lst.AddRange(baseScope.GetNamesAsInBaseClass(ev, is_static));
|
||||
|
|
@ -5101,31 +5029,31 @@ namespace CodeCompletion
|
|||
if (ss.si.acc_mod == access_modifer.private_modifer)
|
||||
{
|
||||
if (ss.is_static && ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
else if (ss.si.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ss.is_static && ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
else if (ss.is_static)
|
||||
{
|
||||
if (!((ss is ProcScope) && (ss as ProcScope).IsConstructor()))
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
|
||||
else if ((ss is ProcScope) && (ss as ProcScope).IsConstructor())
|
||||
if (!((ss as ProcScope).parameters == null || (ss as ProcScope).parameters.Count == 0) || !called_in_base)
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ss is ProcScope && !(ss as ProcScope).already_defined)
|
||||
{
|
||||
if (keyword == PascalABCCompiler.Parsers.KeywordKind.Function || keyword == PascalABCCompiler.Parsers.KeywordKind.Destructor)
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
else if ((ss as ProcScope).IsConstructor())
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
}
|
||||
if (!ss.si.has_doc)
|
||||
|
|
@ -5157,15 +5085,15 @@ namespace CodeCompletion
|
|||
if (ss.si.acc_mod == access_modifer.private_modifer)
|
||||
{
|
||||
if (ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
else if (ss.si.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
}
|
||||
else
|
||||
lst.Add(ss.WithRefreshedDescription().si);
|
||||
lst.Add(ss.si);
|
||||
if (!ss.si.has_doc)
|
||||
UnitDocCache.AddDescribeToComplete(ss);
|
||||
}
|
||||
|
|
@ -5440,7 +5368,7 @@ namespace CodeCompletion
|
|||
{
|
||||
this.name = name;
|
||||
this.si = new SymInfo(name, SymbolKind.Namespace, name);
|
||||
BuildDescription();
|
||||
this.si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
}
|
||||
|
||||
public override ScopeKind Kind
|
||||
|
|
@ -5451,11 +5379,6 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
}
|
||||
|
||||
private SymInfo convertToDefaultNETNames(Type t, SymInfo si)
|
||||
{
|
||||
if (!t.IsPrimitive)
|
||||
|
|
@ -5482,20 +5405,20 @@ namespace CodeCompletion
|
|||
continue;
|
||||
if (t.BaseType == typeof(MulticastDelegate))
|
||||
//syms.Add(new CompiledScope(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Delegate, "delegate "+TypeUtility.GetTypeName(t) + "\n" + AssemblyDocCache.GetDocumentation(t)),t));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Delegate, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Delegate, null), t).si);
|
||||
else
|
||||
if (t.IsClass)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Type, "class "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(convertToDefaultNETNames(t, TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Class, null), t).WithRefreshedDescription().si));
|
||||
syms.Add(convertToDefaultNETNames(t, TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Class, null), t).si));
|
||||
else if (t.IsInterface)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Interface, "interface "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Interface, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Interface, null), t).si);
|
||||
else if (t.IsEnum)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Enum, "enum "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Enum, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Enum, null), t).si);
|
||||
else if (t.IsValueType)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Struct, "record "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(convertToDefaultNETNames(t, TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Struct, null), t).WithRefreshedDescription().si));
|
||||
syms.Add(convertToDefaultNETNames(t, TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Struct, null), t).si));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5660,20 +5583,20 @@ namespace CodeCompletion
|
|||
{
|
||||
if (t.BaseType == typeof(MulticastDelegate))
|
||||
//syms.Add(new CompiledScope(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Delegate, "delegate "+TypeUtility.GetTypeName(t) + "\n" + AssemblyDocCache.GetDocumentation(t)),t));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Delegate, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Delegate, null), t).si);
|
||||
else
|
||||
if (t.IsClass)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Class, "class "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Class, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Class, null), t).si);
|
||||
else if (t.IsInterface)
|
||||
// syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Interface, "interface "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Interface, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Interface, null), t).si);
|
||||
else if (t.IsEnum)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Enum, "enum "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Enum, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Enum, null), t).si);
|
||||
else if (t.IsValueType)
|
||||
//syms.Add(new SymInfo(TypeUtility.GetShortTypeName(t), SymbolKind.Struct, "record "+TypeUtility.GetTypeName(t)+ "\n" +AssemblyDocCache.GetDocumentation(t)));
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Struct, null), t).WithRefreshedDescription().si);
|
||||
syms.Add(TypeTable.get_compiled_type(new SymInfo(null, SymbolKind.Struct, null), t).si);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6142,10 +6065,10 @@ namespace CodeCompletion
|
|||
{
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
syms.Add((ProcScope)member.WithRefreshedDescription());
|
||||
syms.Add(member);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add((ProcScope)member.WithRefreshedDescription());
|
||||
syms.Add(member);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -6179,10 +6102,10 @@ namespace CodeCompletion
|
|||
{
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
syms.Add((ProcScope)member.WithRefreshedDescription());
|
||||
syms.Add(member);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add((ProcScope)member.WithRefreshedDescription());
|
||||
syms.Add(member);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -6434,8 +6357,15 @@ namespace CodeCompletion
|
|||
case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName && (mi as MethodInfo).IsStatic)
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledMethodScope(si2, mi as MethodInfo, this).si, ev);
|
||||
CompiledMethodScope member = new CompiledMethodScope(si2, mi as MethodInfo, this);
|
||||
si2 = member.si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
break;
|
||||
case MemberTypes.Field:
|
||||
|
|
@ -6444,16 +6374,29 @@ namespace CodeCompletion
|
|||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
|
||||
if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledFieldScope(si2, mi as FieldInfo, this).si, ev);
|
||||
si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MemberTypes.Constructor:
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledConstructorScope(si2, mi as ConstructorInfo, this).si, ev);
|
||||
CompiledConstructorScope member = new CompiledConstructorScope(si2, mi as ConstructorInfo, this);
|
||||
si2 = member.si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
break;
|
||||
case MemberTypes.Property:
|
||||
|
|
@ -6462,8 +6405,14 @@ namespace CodeCompletion
|
|||
if (pi.GetGetMethod(true) != null && pi.GetGetMethod(true).IsStatic)
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledPropertyScope(si2, mi as PropertyInfo, this).si, ev);
|
||||
si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -6473,8 +6422,15 @@ namespace CodeCompletion
|
|||
if (acc_mi != null && acc_mi.IsStatic)
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledEventScope(si2, mi as EventInfo, this).si, ev);
|
||||
si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
|
||||
syms.Add(si2);
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -6483,8 +6439,9 @@ namespace CodeCompletion
|
|||
if ((mi as Type).IsNestedPublic)
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Type, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, TypeTable.get_compiled_type(si2, mi as Type).si, ev);
|
||||
CompiledScope member = TypeTable.get_compiled_type(si2, mi as Type);
|
||||
si2 = member.si;
|
||||
syms.Add(si2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -6639,15 +6596,19 @@ namespace CodeCompletion
|
|||
}
|
||||
foreach (MemberInfo mi in mis)
|
||||
if (!IsHiddenName(mi.Name))
|
||||
{
|
||||
switch (mi.MemberType)
|
||||
{
|
||||
case MemberTypes.Method:
|
||||
if (!(mi as MethodInfo).IsSpecialName)
|
||||
case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName)
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledMethodScope(si2, mi as MethodInfo, this).si, ev);
|
||||
si2 = new CompiledMethodScope(si2, mi as MethodInfo, this).si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
break;
|
||||
case MemberTypes.Field:
|
||||
|
|
@ -6656,29 +6617,44 @@ namespace CodeCompletion
|
|||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
|
||||
if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledFieldScope(si2, mi as FieldInfo, this).si, ev);
|
||||
si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MemberTypes.Property:
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledPropertyScope(si2, mi as PropertyInfo, this).si, ev);
|
||||
si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
break;
|
||||
case MemberTypes.Event:
|
||||
{
|
||||
SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
|
||||
|
||||
AddSymInfoWithAccessCheck(syms, new CompiledEventScope(si2, mi as EventInfo, this).si, ev);
|
||||
si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
|
||||
if (si2.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si2);
|
||||
}
|
||||
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (implemented_interfaces != null && false)
|
||||
{
|
||||
foreach (TypeScope ts in implemented_interfaces)
|
||||
|
|
@ -6687,17 +6663,6 @@ namespace CodeCompletion
|
|||
return syms.ToArray();
|
||||
}
|
||||
|
||||
private void AddSymInfoWithAccessCheck(List<SymInfo> syms, SymInfo si, ExpressionVisitor ev)
|
||||
{
|
||||
if (si.acc_mod == access_modifer.protected_modifer)
|
||||
{
|
||||
if (ev.CheckForBaseAccess(ev.entry_scope, this))
|
||||
syms.Add(si);
|
||||
}
|
||||
else if (si.acc_mod != access_modifer.private_modifer && si.acc_mod != access_modifer.internal_modifer)
|
||||
syms.Add(si);
|
||||
}
|
||||
|
||||
public override SymInfo[] GetNamesAsInBaseClass(ExpressionVisitor ev, bool is_static)
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "11";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "3642";
|
||||
public const string Revision = "3646";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=3642
|
||||
%REVISION%=3646
|
||||
%MINOR%=11
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -819,13 +819,13 @@ namespace Languages.SPython.Frontend.Data
|
|||
return false;
|
||||
}
|
||||
|
||||
public override string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out KeywordKind keyw, out string expr_without_brackets)
|
||||
public override string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out string expr_without_brackets)
|
||||
{
|
||||
int i = off - 1;
|
||||
|
||||
// это например вызов метода без параметров
|
||||
expr_without_brackets = null;
|
||||
keyw = KeywordKind.None;
|
||||
var keyw = KeywordKind.None;
|
||||
if (i < 0)
|
||||
return "";
|
||||
bool is_char = false;
|
||||
|
|
@ -1029,25 +1029,135 @@ namespace Languages.SPython.Frontend.Data
|
|||
{
|
||||
case ScopeKind.Type: return GetDescriptionForType(scope as ITypeScope);
|
||||
case ScopeKind.CompiledType: return GetDescriptionForCompiledType(scope as ICompiledTypeScope);
|
||||
case ScopeKind.Delegate: return GetDescriptionForDelegate(scope as IProcType);
|
||||
case ScopeKind.Procedure: return GetDescriptionForProcedure(scope as IProcScope);
|
||||
case ScopeKind.ElementScope: return GetDescriptionForElementScope(scope as IElementScope);
|
||||
case ScopeKind.TypeSynonim: return GetSynonimDescription(scope as ITypeSynonimScope);
|
||||
case ScopeKind.Namespace: return GetDescriptionForNamespace(scope as INamespaceScope);
|
||||
case ScopeKind.CompiledMethod: return GetDescriptionForCompiledMethod(scope as ICompiledMethodScope);
|
||||
|
||||
/*case ScopeKind.Array: return GetDescriptionForArray(scope as IArrayScope);
|
||||
case ScopeKind.Enum: return GetDescriptionForEnum(scope as IEnumScope);
|
||||
case ScopeKind.Array: return GetDescriptionForArray(scope as IArrayScope);
|
||||
|
||||
|
||||
|
||||
/*case ScopeKind.Set: return GetDescriptionForSet(scope as ISetScope);
|
||||
case ScopeKind.Set: return GetDescriptionForSet(scope as ISetScope);
|
||||
|
||||
case ScopeKind.CompiledField: return GetDescriptionForCompiledField(scope as ICompiledFieldScope);
|
||||
case ScopeKind.CompiledProperty: return GetDescriptionForCompiledProperty(scope as ICompiledPropertyScope);
|
||||
|
||||
|
||||
case ScopeKind.CompiledConstructor: return GetDescriptionForCompiledConstructor(scope as ICompiledConstructorScope);*/
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected string GetDescriptionForProcedure(IProcScope scope)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
string extensionType = null;
|
||||
if (scope.IsExtension && scope.Parameters.Length > 0)
|
||||
{
|
||||
extensionType = GetSimpleDescription(scope.Parameters[0].Type);
|
||||
}
|
||||
if (scope.IsExtension)
|
||||
{
|
||||
if (extensionType != null && extensionType.IndexOf(' ') != -1)
|
||||
{
|
||||
sb.Append("(" + PascalABCCompiler.StringResources.Get("CODE_COMPLETION_EXTENSION") + " " + extensionType + ") ");
|
||||
extensionType = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("(" + PascalABCCompiler.StringResources.Get("CODE_COMPLETION_EXTENSION") + ") ");
|
||||
}
|
||||
}
|
||||
|
||||
if (scope.IsStatic) sb.Append("static ");
|
||||
if (scope.IsConstructor())
|
||||
sb.Append("constructor ");
|
||||
else
|
||||
sb.Append("def ");
|
||||
/*if (scope.ReturnType == null)
|
||||
sb.Append("procedure ");
|
||||
else
|
||||
sb.Append("function ");*/
|
||||
if (!scope.IsConstructor())
|
||||
{
|
||||
if (extensionType != null)
|
||||
{
|
||||
sb.Append(extensionType + ".");
|
||||
sb.Append(scope.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(GetTopScopeName(scope.TopScope));
|
||||
sb.Append(scope.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(GetTopScopeNameWithoutDot(scope.TopScope));
|
||||
}
|
||||
|
||||
sb.Append(GetGenericString(scope.TemplateParameters));
|
||||
sb.Append('(');
|
||||
IElementScope[] parameters = scope.Parameters;
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
if (scope.IsExtension && i == 0)
|
||||
continue;
|
||||
sb.Append(GetSimpleDescription(parameters[i]));
|
||||
if (i < parameters.Length - 1)
|
||||
{
|
||||
sb.Append("; ");
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
if (scope.ReturnType != null && !scope.IsConstructor() && !(scope.ReturnType is IProcType && (scope.ReturnType as IProcType).Target == scope))
|
||||
sb.Append(" " + ReturnTypeDelimiter + " " + GetSimpleDescription(scope.ReturnType));
|
||||
//if (scope.IsStatic) sb.Append("; static");
|
||||
if (scope.IsVirtual) sb.Append("; ");
|
||||
else if (scope.IsAbstract) sb.Append("; abstract");
|
||||
else if (scope.IsOverride) sb.Append("; override");
|
||||
else if (scope.IsReintroduce) sb.Append("; reintroduce");
|
||||
sb.Append(';');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string GetDescriptionForElementScope(IElementScope scope)
|
||||
{
|
||||
string type_name = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (scope.Type == null) type_name = "";
|
||||
else
|
||||
type_name = GetSimpleDescription(scope.Type);
|
||||
if (type_name.StartsWith("$"))
|
||||
type_name = type_name.Substring(1, type_name.Length - 1);
|
||||
switch (scope.ElemKind)
|
||||
{
|
||||
case SymbolKind.Variable: sb.Append("var " + GetTopScopeName(scope.TopScope) + scope.Name + ((type_name != "") ? ": " + type_name : "")); break;
|
||||
case SymbolKind.Parameter: sb.Append(kind_of_param(scope) + "parameter " + scope.Name + ": " + type_name + (scope.ConstantValue != null ? (":=" + scope.ConstantValue.ToString()) : "")); break;
|
||||
case SymbolKind.Field:
|
||||
if (scope.IsStatic)
|
||||
sb.Append("static ");
|
||||
else
|
||||
sb.Append("var ");
|
||||
sb.Append(GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
// append_modifiers(sb, scope);
|
||||
//if (scope.IsStatic) sb.Append("; static");
|
||||
if (scope.IsReadOnly) sb.Append("; readonly");
|
||||
break;
|
||||
|
||||
}
|
||||
sb.Append(';');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected override string kind_of_param(IElementScope scope)
|
||||
{
|
||||
switch (scope.ParamKind)
|
||||
{
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.const_parametr: return "const ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.var_parametr: return "var ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.params_parametr: return "params ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.out_parametr: return "out ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
@ -1218,7 +1328,6 @@ namespace Languages.SPython.Frontend.Data
|
|||
{
|
||||
case ScopeKind.Type: return GetSimpleDescriptionForType(scope as ITypeScope);
|
||||
case ScopeKind.CompiledType: return GetSimpleDescriptionForCompiledType(scope as ICompiledTypeScope, false);
|
||||
case ScopeKind.Delegate: return GetDescriptionForDelegate(scope as IProcType);
|
||||
case ScopeKind.Procedure: return GetSimpleDescriptionForProcedure(scope as IProcScope);
|
||||
case ScopeKind.ElementScope: return GetSimpleDescriptionForElementScope(scope as IElementScope);
|
||||
case ScopeKind.TypeSynonim: return GetSimpleSynonimDescription(scope as ITypeSynonimScope);
|
||||
|
|
@ -1226,9 +1335,8 @@ namespace Languages.SPython.Frontend.Data
|
|||
case ScopeKind.UnitInterface: return GetDescriptionForModule(scope as IInterfaceUnitScope);
|
||||
case ScopeKind.Namespace: return GetDescriptionForNamespace(scope as INamespaceScope);
|
||||
case ScopeKind.CompiledMethod: return GetDescriptionForCompiledMethod(scope as ICompiledMethodScope);
|
||||
case ScopeKind.Enum: return GetDescriptionForEnum(scope as IEnumScope);
|
||||
|
||||
/*
|
||||
/*case ScopeKind.Enum: return GetDescriptionForEnum(scope as IEnumScope);
|
||||
case ScopeKind.Set: return GetDescriptionForSet(scope as ISetScope);
|
||||
|
||||
case ScopeKind.CompiledField: return GetDescriptionForCompiledField(scope as ICompiledFieldScope);
|
||||
|
|
@ -1260,6 +1368,88 @@ namespace Languages.SPython.Frontend.Data
|
|||
return scope.Name;
|
||||
}
|
||||
|
||||
protected string GetDescriptionForArray(IArrayScope scope)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("array");
|
||||
ITypeScope[] inds = scope.Indexers;
|
||||
if (!scope.IsDynamic)
|
||||
{
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < inds.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(inds[i]));
|
||||
if (i < inds.Length - 1) sb.Append(',');
|
||||
}
|
||||
sb.Append(']');
|
||||
}
|
||||
if (scope.ElementType != null)
|
||||
{
|
||||
string s = GetSimpleDescription(scope.ElementType);
|
||||
if (s.Length > 0 && s[0] == '$') s = s.Substring(1, s.Length - 1);
|
||||
sb.Append(" of " + s);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private string GetSimpleDescriptionForCompiledType(ICompiledTypeScope scope, bool fullName)
|
||||
{
|
||||
if (scope.CompiledType.Name != null && scope.CompiledType.Name.Contains("Func`"))
|
||||
{
|
||||
return getLambdaRepresentation(scope, true);
|
||||
}
|
||||
else if (scope.CompiledType.Name != null && scope.CompiledType.Name.Contains("Action`"))
|
||||
{
|
||||
return getLambdaRepresentation(scope, false);
|
||||
}
|
||||
else if (scope.CompiledType.Name != null && scope.CompiledType.Name.Contains("Predicate`1"))
|
||||
{
|
||||
return getLambdaRepresentation(scope, false);
|
||||
}
|
||||
if (scope.CompiledType.Name == "IEnumerable`1")
|
||||
{
|
||||
ITypeScope[] instances = scope.GenericInstances;
|
||||
if (instances != null && instances.Length > 0)
|
||||
{
|
||||
return "sequence of " + GetSimpleDescriptionWithoutNamespace(instances[0]);
|
||||
}
|
||||
else
|
||||
return "sequence of T";
|
||||
}
|
||||
else if (scope.CompiledType.Name != null && scope.CompiledType.Name.Contains("Tuple`"))
|
||||
{
|
||||
ITypeScope[] instances = scope.GenericInstances;
|
||||
if (instances != null && instances.Length > 0)
|
||||
{
|
||||
return get_tuple_string(instances);
|
||||
}
|
||||
else
|
||||
return "(T1,...)";
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = !fullName ? GetShortTypeName(scope.CompiledType) : GetFullTypeName(scope.CompiledType);
|
||||
ITypeScope[] instances = scope.GenericInstances;
|
||||
if (instances != null && instances.Length > 0)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
int ind = s.IndexOf(GenericTypesStartBracket);
|
||||
if (ind != -1) sb.Append(s.Substring(0, ind));
|
||||
else
|
||||
sb.Append(s);
|
||||
sb.Append(GenericTypesStartBracket);
|
||||
for (int i = 0; i < instances.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescriptionWithoutNamespace(instances[i]));
|
||||
if (i < instances.Length - 1) sb.Append(", ");
|
||||
}
|
||||
sb.Append(GenericTypesEndBracket);
|
||||
s = sb.ToString();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetStandardTypeByKeyword(KeywordKind keyw)
|
||||
{
|
||||
switch (keyw)
|
||||
|
|
|
|||
|
|
@ -65,13 +65,14 @@ namespace PascalABCCompiler.Parsers
|
|||
// перенести сюда реализацию EVA
|
||||
public abstract string FindExpressionForMethod(int off, string Text, int line, int col, char pressed_key, ref int num_param);
|
||||
|
||||
public string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out string expr_without_brackets)
|
||||
public string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out KeywordKind keyw, out string expr_without_brackets)
|
||||
{
|
||||
return FindExpressionFromAnyPosition(off, Text, line, col, out _, out expr_without_brackets);
|
||||
keyw = KeywordKind.None;
|
||||
return FindExpressionFromAnyPosition(off, Text, line, col, out expr_without_brackets);
|
||||
}
|
||||
|
||||
// перенести сюда реализацию EVA
|
||||
public abstract string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out KeywordKind keyw, out string expr_without_brackets);
|
||||
public abstract string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out string expr_without_brackets);
|
||||
|
||||
public virtual string FindOnlyIdentifier(int off, string Text, int line, int col, ref string name)
|
||||
{
|
||||
|
|
@ -215,7 +216,7 @@ namespace PascalABCCompiler.Parsers
|
|||
sb.Append(GetSimpleDescription(parameters[i]));
|
||||
if (i < parameters.Length - 1)
|
||||
{
|
||||
sb.Append(ParameterDelimiter + " ");
|
||||
sb.Append("; ");
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
|
|
@ -286,150 +287,6 @@ namespace PascalABCCompiler.Parsers
|
|||
}
|
||||
}
|
||||
|
||||
protected string GetDescriptionForEnum(IEnumScope scope)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
sb.Append('(');
|
||||
for (int i = 0; i < scope.EnumConsts.Length; i++)
|
||||
{
|
||||
sb.Append(scope.EnumConsts[i]);
|
||||
if (i < scope.EnumConsts.Length - 1)
|
||||
sb.Append(',');
|
||||
if (i >= 2)
|
||||
{
|
||||
sb.Append("...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private void append_modifiers(StringBuilder sb, IElementScope scope)
|
||||
{
|
||||
if (scope.IsVirtual) sb.Append("; ");
|
||||
if (scope.IsAbstract) sb.Append("; abstract");
|
||||
if (scope.IsOverride) sb.Append("; override");
|
||||
//if (scope.IsStatic) sb.Append("; static");
|
||||
if (scope.IsReintroduce) sb.Append("; reintroduce");
|
||||
}
|
||||
|
||||
protected string get_index_description(IElementScope scope)
|
||||
{
|
||||
ITypeScope[] indexers = scope.Indexers;
|
||||
if (indexers == null || indexers.Length == 0) return "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < indexers.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(indexers[i]));
|
||||
if (i < indexers.Length - 1)
|
||||
sb.Append(',');
|
||||
}
|
||||
sb.Append(']');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string GetDescriptionForElementScope(IElementScope scope)
|
||||
{
|
||||
string type_name = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (scope.Type == null) type_name = "";
|
||||
else
|
||||
type_name = GetSimpleDescription(scope.Type);
|
||||
if (type_name.StartsWith("$"))
|
||||
type_name = type_name.Substring(1, type_name.Length - 1);
|
||||
switch (scope.ElemKind)
|
||||
{
|
||||
case SymbolKind.Variable: sb.Append("var " + GetTopScopeName(scope.TopScope) + scope.Name + ((type_name != "") ? ": " + type_name : "")); break;
|
||||
case SymbolKind.Parameter: sb.Append(kind_of_param(scope) + "parameter " + scope.Name + ": " + type_name + (scope.ConstantValue != null ? (":=" + scope.ConstantValue.ToString()) : "")); break;
|
||||
case SymbolKind.Constant:
|
||||
{
|
||||
if (scope.ConstantValue == null)
|
||||
sb.Append("const " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
else sb.Append("const " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name + " = " + scope.ConstantValue.ToString());
|
||||
}
|
||||
break;
|
||||
case SymbolKind.Event:
|
||||
if (scope.IsStatic) sb.Append("static ");
|
||||
sb.Append("event " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
append_modifiers(sb, scope);
|
||||
break;
|
||||
case SymbolKind.Field:
|
||||
if (scope.IsStatic)
|
||||
sb.Append("static ");
|
||||
else
|
||||
sb.Append("var ");
|
||||
sb.Append(GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
append_modifiers(sb, scope);
|
||||
//if (scope.IsStatic) sb.Append("; static");
|
||||
if (scope.IsReadOnly) sb.Append("; readonly");
|
||||
break;
|
||||
case SymbolKind.Property:
|
||||
if (scope.IsStatic)
|
||||
sb.Append("static ");
|
||||
sb.Append("property " + GetTopScopeName(scope.TopScope) + scope.Name + get_index_description(scope) + ": " + type_name);
|
||||
if (scope.IsReadOnly)
|
||||
sb.Append("; readonly");
|
||||
append_modifiers(sb, scope);
|
||||
break;
|
||||
|
||||
}
|
||||
sb.Append(';');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string GetDescriptionForArray(IArrayScope scope)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("array");
|
||||
ITypeScope[] inds = scope.Indexers;
|
||||
if (!scope.IsDynamic)
|
||||
{
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < inds.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(inds[i]));
|
||||
if (i < inds.Length - 1) sb.Append(',');
|
||||
}
|
||||
sb.Append(']');
|
||||
}
|
||||
if (scope.ElementType != null)
|
||||
{
|
||||
string s = GetSimpleDescription(scope.ElementType);
|
||||
if (s.Length > 0 && s[0] == '$') s = s.Substring(1, s.Length - 1);
|
||||
sb.Append(" of " + s);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string GetDescriptionForDelegate(IProcType t)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (t.Target.ReturnType != null || ProcedureName == null)
|
||||
sb.Append(FunctionName);
|
||||
else sb.Append(ProcedureName);
|
||||
IElementScope[] prms = t.Target.Parameters;
|
||||
if (prms.Length > 0)
|
||||
{
|
||||
sb.Append('(');
|
||||
for (int i = 0; i < prms.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(prms[i]));
|
||||
if (i < prms.Length - 1)
|
||||
{
|
||||
sb.Append(ParameterDelimiter + " ");
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
}
|
||||
if (t.Target.ReturnType != null)
|
||||
{
|
||||
sb.Append(ReturnTypeDelimiter + " " + GetSimpleDescription(t.Target.ReturnType));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public abstract string GetKeyword(SymbolKind kind);
|
||||
|
||||
public KeywordKind GetKeywordKind(string name)
|
||||
|
|
@ -881,17 +738,7 @@ namespace PascalABCCompiler.Parsers
|
|||
return sc.Name;
|
||||
}
|
||||
|
||||
protected string kind_of_param(IElementScope scope)
|
||||
{
|
||||
switch (scope.ParamKind)
|
||||
{
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.const_parametr: return "const ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.var_parametr: return "var ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.params_parametr: return "params ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.out_parametr: return "out ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
protected abstract string kind_of_param(IElementScope scope);
|
||||
|
||||
protected string GetSimpleDescriptionForElementScope(IElementScope scope)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -797,6 +797,11 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
public interface IArrayScope : ITypeScope
|
||||
{
|
||||
ITypeScope[] Indexers
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
bool IsDynamic
|
||||
{
|
||||
get;
|
||||
|
|
|
|||
|
|
@ -342,6 +342,33 @@ namespace Languages.Pascal.Frontend.Data
|
|||
return null;
|
||||
}
|
||||
|
||||
protected string GetDescriptionForDelegate(IProcType t)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (t.Target.ReturnType != null)
|
||||
sb.Append("function");
|
||||
else sb.Append("procedure");
|
||||
IElementScope[] prms = t.Target.Parameters;
|
||||
if (prms.Length > 0)
|
||||
{
|
||||
sb.Append('(');
|
||||
for (int i = 0; i < prms.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(prms[i]));
|
||||
if (i < prms.Length - 1)
|
||||
{
|
||||
sb.Append("; ");
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
}
|
||||
if (t.Target.ReturnType != null)
|
||||
{
|
||||
sb.Append(ReturnTypeDelimiter + " " + GetSimpleDescription(t.Target.ReturnType));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected override string GetFullTypeName(Type ctn, bool no_alias = true)
|
||||
{
|
||||
TypeCode tc = Type.GetTypeCode(ctn);
|
||||
|
|
@ -986,6 +1013,30 @@ namespace Languages.Pascal.Frontend.Data
|
|||
return s;
|
||||
}
|
||||
|
||||
protected string GetDescriptionForArray(IArrayScope scope)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("array");
|
||||
ITypeScope[] inds = scope.Indexers;
|
||||
if (!scope.IsDynamic)
|
||||
{
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < inds.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(inds[i]));
|
||||
if (i < inds.Length - 1) sb.Append(',');
|
||||
}
|
||||
sb.Append(']');
|
||||
}
|
||||
if (scope.ElementType != null)
|
||||
{
|
||||
string s = GetSimpleDescription(scope.ElementType);
|
||||
if (s.Length > 0 && s[0] == '$') s = s.Substring(1, s.Length - 1);
|
||||
sb.Append(" of " + s);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string GetDescriptionForDiapason(IDiapasonScope scope)
|
||||
{
|
||||
return scope.Left.ToString() + ".." + scope.Right.ToString();
|
||||
|
|
@ -1026,6 +1077,25 @@ namespace Languages.Pascal.Frontend.Data
|
|||
return s;
|
||||
}
|
||||
|
||||
protected string GetDescriptionForEnum(IEnumScope scope)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
sb.Append('(');
|
||||
for (int i = 0; i < scope.EnumConsts.Length; i++)
|
||||
{
|
||||
sb.Append(scope.EnumConsts[i]);
|
||||
if (i < scope.EnumConsts.Length - 1)
|
||||
sb.Append(',');
|
||||
if (i >= 2)
|
||||
{
|
||||
sb.Append("...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string GetDescriptionForSet(ISetScope scope)
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
|
|
@ -1039,6 +1109,92 @@ namespace Languages.Pascal.Frontend.Data
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected override string kind_of_param(IElementScope scope)
|
||||
{
|
||||
switch (scope.ParamKind)
|
||||
{
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.const_parametr: return "const ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.var_parametr: return "var ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.params_parametr: return "params ";
|
||||
case PascalABCCompiler.SyntaxTree.parametr_kind.out_parametr: return "out ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected string get_index_description(IElementScope scope)
|
||||
{
|
||||
ITypeScope[] indexers = scope.Indexers;
|
||||
if (indexers == null || indexers.Length == 0) return "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < indexers.Length; i++)
|
||||
{
|
||||
sb.Append(GetSimpleDescription(indexers[i]));
|
||||
if (i < indexers.Length - 1)
|
||||
sb.Append(',');
|
||||
}
|
||||
sb.Append(']');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private void append_modifiers(StringBuilder sb, IElementScope scope)
|
||||
{
|
||||
if (scope.IsVirtual) sb.Append("; ");
|
||||
if (scope.IsAbstract) sb.Append("; abstract");
|
||||
if (scope.IsOverride) sb.Append("; override");
|
||||
//if (scope.IsStatic) sb.Append("; static");
|
||||
if (scope.IsReintroduce) sb.Append("; reintroduce");
|
||||
}
|
||||
|
||||
protected string GetDescriptionForElementScope(IElementScope scope)
|
||||
{
|
||||
string type_name = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (scope.Type == null) type_name = "";
|
||||
else
|
||||
type_name = GetSimpleDescription(scope.Type);
|
||||
if (type_name.StartsWith("$"))
|
||||
type_name = type_name.Substring(1, type_name.Length - 1);
|
||||
switch (scope.ElemKind)
|
||||
{
|
||||
case SymbolKind.Variable: sb.Append("var " + GetTopScopeName(scope.TopScope) + scope.Name + ((type_name != "") ? ": " + type_name : "")); break;
|
||||
case SymbolKind.Parameter: sb.Append(kind_of_param(scope) + "parameter " + scope.Name + ": " + type_name + (scope.ConstantValue != null ? (":=" + scope.ConstantValue.ToString()) : "")); break;
|
||||
case SymbolKind.Constant:
|
||||
{
|
||||
if (scope.ConstantValue == null)
|
||||
sb.Append("const " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
else sb.Append("const " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name + " = " + scope.ConstantValue.ToString());
|
||||
}
|
||||
break;
|
||||
case SymbolKind.Event:
|
||||
if (scope.IsStatic) sb.Append("static ");
|
||||
sb.Append("event " + GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
append_modifiers(sb, scope);
|
||||
break;
|
||||
case SymbolKind.Field:
|
||||
if (scope.IsStatic)
|
||||
sb.Append("static ");
|
||||
else
|
||||
sb.Append("var ");
|
||||
sb.Append(GetTopScopeName(scope.TopScope) + scope.Name + ": " + type_name);
|
||||
append_modifiers(sb, scope);
|
||||
//if (scope.IsStatic) sb.Append("; static");
|
||||
if (scope.IsReadOnly) sb.Append("; readonly");
|
||||
break;
|
||||
case SymbolKind.Property:
|
||||
if (scope.IsStatic)
|
||||
sb.Append("static ");
|
||||
sb.Append("property " + GetTopScopeName(scope.TopScope) + scope.Name + get_index_description(scope) + ": " + type_name);
|
||||
if (scope.IsReadOnly)
|
||||
sb.Append("; readonly");
|
||||
append_modifiers(sb, scope);
|
||||
break;
|
||||
|
||||
}
|
||||
sb.Append(';');
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public string GetDescriptionForCompiledField(FieldInfo fi)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -1976,13 +2132,13 @@ namespace Languages.Pascal.Frontend.Data
|
|||
|
||||
}
|
||||
|
||||
public override string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out KeywordKind keyw, out string expr_without_brackets)
|
||||
public override string FindExpressionFromAnyPosition(int off, string Text, int line, int col, out string expr_without_brackets)
|
||||
{
|
||||
int i = off - 1;
|
||||
|
||||
// это например вызов метода без параметров
|
||||
expr_without_brackets = null;
|
||||
keyw = KeywordKind.None;
|
||||
var keyw = KeywordKind.None;
|
||||
if (i < 0)
|
||||
return "";
|
||||
bool is_char = false;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.11.0.3642
|
||||
3.11.0.3646
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.11.0.3642'
|
||||
!define VERSION '3.11.0.3646'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
///Модуль предоставляет константы, типы, процедуры, функции и классы для рисования в графическом окне
|
||||
unit GraphABC;
|
||||
|
|
@ -4203,7 +4203,7 @@ begin
|
|||
InitForm;
|
||||
StartIsComplete := True;
|
||||
|
||||
mre.Set();
|
||||
MainForm.Load += (s,e) -> mre.Set();
|
||||
Application.Run(MainForm);
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
unit RobotField;
|
||||
|
||||
|
|
@ -28,27 +28,27 @@ var
|
|||
LabelGoodEndColor: Color;
|
||||
|
||||
HelpStr :=
|
||||
'Разработчик исполнителя Робот: Михалкович С.С., 2002-19 '#10#13#10#13+
|
||||
'Команды исполнителя Робот:'#10#13+
|
||||
' Right - вправо'#10#13+
|
||||
' Left - влево'#10#13
|
||||
' Up - вверх'#10#13+
|
||||
' Down - вниз'#10#13
|
||||
' Paint - закрасить текущую клетку'#10#13
|
||||
' Task(name) - вызвать задание с указанным именем'#10#13
|
||||
' StandardField - вызвать стандартное поле'#10#13
|
||||
' Field(n,m) - вызвать поле размера n на m'#10#13#10#13
|
||||
'Условия, проверяемые исполнителем Робот:'#10#13
|
||||
' WallFromRight - справа стена'#10#13
|
||||
' WallFromLeft - слева стена'#10#13
|
||||
' WallFromUp - сверху стена'#10#13
|
||||
' WallFromDown - снизу стена'#10#13
|
||||
' FreeFromRight - справа свободно'#10#13
|
||||
' FreeFromLeft - слева свободно'#10#13
|
||||
' FreeFromUp - сверху свободно'#10#13
|
||||
' FreeFromDown - снизу свободно'#10#13
|
||||
' CellIsPainted - клетка закрашена'#10#13
|
||||
' CellIsFree - клетка не закрашена'#10#13;
|
||||
'Разработчик исполнителя Робот: Михалкович С.С., 2002-19 ' + NewLine + NewLine +
|
||||
'Команды исполнителя Робот:' + NewLine +
|
||||
' Right - вправо' + NewLine +
|
||||
' Left - влево' + NewLine +
|
||||
' Up - вверх' + NewLine +
|
||||
' Down - вниз' + NewLine +
|
||||
' Paint - закрасить текущую клетку' + NewLine +
|
||||
' Task(name) - вызвать задание с указанным именем' + NewLine +
|
||||
' StandardField - вызвать стандартное поле' + NewLine +
|
||||
' Field(n,m) - вызвать поле размера n на m' + NewLine + NewLine +
|
||||
'Условия, проверяемые исполнителем Робот:' + NewLine +
|
||||
' WallFromRight - справа стена' + NewLine +
|
||||
' WallFromLeft - слева стена' + NewLine +
|
||||
' WallFromUp - сверху стена' + NewLine +
|
||||
' WallFromDown - снизу стена' + NewLine +
|
||||
' FreeFromRight - справа свободно' + NewLine +
|
||||
' FreeFromLeft - слева свободно' + NewLine +
|
||||
' FreeFromUp - сверху свободно' + NewLine +
|
||||
' FreeFromDown - снизу свободно' + NewLine +
|
||||
' CellIsPainted - клетка закрашена' + NewLine +
|
||||
' CellIsFree - клетка не закрашена' + NewLine;
|
||||
|
||||
type
|
||||
TRobotField = class
|
||||
|
|
@ -909,9 +909,9 @@ begin
|
|||
labelExState.AutoSize := true;
|
||||
labelExState.Dock := DockStyle.Fill;
|
||||
//labelExState.FlatStyle := FlatStyle.System;
|
||||
labelExState.Font := new System.Drawing.Font('Microsoft Sans Serif', 8, System.Drawing.FontStyle.Bold{, System.Drawing.GraphicsUnit.Point, ((byte)(204))});
|
||||
labelExState.Font := new System.Drawing.Font('Sans Serif', 8, System.Drawing.FontStyle.Bold{, System.Drawing.GraphicsUnit.Point, ((byte)(204))});
|
||||
labelExState.Location := new Point(5, 2);
|
||||
labelExState.Margin := new Padding(3, 3, 3, 3);
|
||||
if not IsUnix then labelExState.Margin := new Padding(3, 3, 3, 3);
|
||||
labelExState.Size := new Size(453, 15)*ScreenScale;
|
||||
labelExState.Text := 'Робот: Готов';
|
||||
labelExState.TextAlign := ContentAlignment.MiddleCenter;
|
||||
|
|
@ -993,11 +993,11 @@ begin
|
|||
//labelZad.AutoSize := true;
|
||||
labelZad.Dock := DockStyle.Fill;
|
||||
//labelZad.FlatStyle := FlatStyle.System;
|
||||
labelZad.Font := new System.Drawing.Font('Microsoft Sans Serif', 8, System.Drawing.FontStyle.Bold{, System.Drawing.GraphicsUnit.Point, ((byte)(204))});
|
||||
labelZad.Font := new System.Drawing.Font('Sans Serif', 8, System.Drawing.FontStyle.Bold{, System.Drawing.GraphicsUnit.Point, ((byte)(204))});
|
||||
labelZad.ForeColor := SystemColors.HotTrack;
|
||||
labelZad.Location := new Point(6, 3);
|
||||
labelZad.Margin := new Padding(4, 1, 3, 0);
|
||||
labelZad.Size := new Size(668, 14)*ScreenScale;
|
||||
if(not IsUnix) then labelZad.Margin := new Padding(4, 1, 3, 0);
|
||||
labelZad.Size := new Size(668, 15)*ScreenScale;
|
||||
labelZad.Text := 'Задание';
|
||||
labelZad.TextAlign := ContentAlignment.MiddleLeft;
|
||||
//
|
||||
|
|
@ -1094,7 +1094,12 @@ begin
|
|||
if RobField.TaskName = '' then
|
||||
labelExState.Text := 'Робот: Работа окончена'
|
||||
else
|
||||
begin
|
||||
tableLayoutPanel1.BackColor := LabelBadEndColor;
|
||||
labelExState.BackColor := LabelBadEndColor;
|
||||
tableLayoutPanelBottom.BackColor := LabelBadEndColor;
|
||||
labelExState.Text := 'Робот: Работа окончена, задание не выполнено';
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
|
|
@ -1142,7 +1147,7 @@ begin
|
|||
RobField := new TRobotField(0,0,50);
|
||||
|
||||
t := System.Threading.Thread.CurrentThread;
|
||||
robField.SetSpeed(settings.Speed);
|
||||
RobField.SetSpeed(settings.Speed);
|
||||
//MainWindow.Bounds := new System.Drawing.Rectangle(settings.Left,settings.Top,settings.Width,settings.Height);
|
||||
var del : procedure := MainForm.Show;
|
||||
MainForm.Invoke(del);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//!Невозможно вывести типы-параметры обобщённой подпрограммы f1 (укажите типы-параметры явно)
|
||||
//!Обобщенная подпрограмма f1 не может быть аргументом
|
||||
function f1<T> := 1;
|
||||
begin
|
||||
var x := f1 + 2;
|
||||
|
|
|
|||
12
TestSuite/errors/err0546.pas
Normal file
12
TestSuite/errors/err0546.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
procedure p0<T>(p: T->());
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure p1<T>(o: T);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
p0(p1);
|
||||
end.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
type TClass = class
|
||||
type TClass = class
|
||||
a: integer;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -290,6 +290,21 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
}
|
||||
|
||||
public class GenericFunctionCannotBeAnArgument : CompilationErrorWithLocation
|
||||
{
|
||||
private readonly string _name;
|
||||
public GenericFunctionCannotBeAnArgument(string name, location loc)
|
||||
: base(loc)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
public type_node name { get; }
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format(StringResources.Get("GENERIC_FUNCTION_{0}_CANNOT_BE_AN_ARGUMENT"), _name);
|
||||
}
|
||||
}
|
||||
|
||||
public class CanNotConvertTypes : CompilationErrorWithLocation
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1183,6 +1183,15 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
else
|
||||
{
|
||||
if (factparams[i].type is delegated_methods dm2
|
||||
&& dm2.proper_methods[0].function.is_generic_function
|
||||
&& !syntax_tree_visitor.context.WithSection)
|
||||
{
|
||||
var name = dm2.proper_methods[0].function.name;
|
||||
error = new GenericFunctionCannotBeAnArgument(name, locg);
|
||||
return null; // фактический параметр - имя неинстанцированной generic-функции!
|
||||
}
|
||||
|
||||
ptc = type_table.get_convertions(factparams[i].type, formal_param_type);
|
||||
|
||||
if (factparams[i] is null_const_node && !type_table.is_with_nil_allowed(formal_param_type) && !formal_param_type.IsPointer) // SSM 01.07.19 - nil не может быть преобразована за счёт вызова функции
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ AUTO_CLASS_MUST_NOT_HAVE_PROPERTIES=Auto class can not have properties
|
|||
UNDEFINED_NAME_REFERENCE_{0}=Undefined name reference '{0}'
|
||||
TWO_TYPE_CONVERTIONS_POSSIBLE_FIRST_TYPE_{0}_SECOND_TYE_{1}=Two type of convertions are possible: to type '{0}' and to type '{1}'
|
||||
CAN_NOT_CONVERT_TYPES_FROM_{0}_TO_{1}=Incompatible types: '{0}' and '{1}'
|
||||
GENERIC_FUNCTION_{0}_CANNOT_BE_AN_ARGUMENT=Generic function {0} cannot be an argument
|
||||
NO_FUNCION_WITH_THIS_NAME=No function with this name
|
||||
INVALID_FUNCTION_PARAMETERS_NUM=Wrong number of function parameters
|
||||
INVALID_PROCEDURE_PARAMETERS_NUM=Wrong number of procedure parameters
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ AUTO_CLASS_MUST_NOT_HAVE_PROPERTIES=Авто класс не может имет
|
|||
UNDEFINED_NAME_REFERENCE_{0}=Неизвестное имя '{0}'
|
||||
TWO_TYPE_CONVERTIONS_POSSIBLE_FIRST_TYPE_{0}_SECOND_TYE_{1}=Возможны два преобразования типа: к типу {0} и к типу {1}
|
||||
CAN_NOT_CONVERT_TYPES_FROM_{0}_TO_{1}=Нельзя преобразовать тип {0} к {1}
|
||||
GENERIC_FUNCTION_{0}_CANNOT_BE_AN_ARGUMENT=Обобщенная подпрограмма {0} не может быть аргументом
|
||||
NO_FUNCION_WITH_THIS_NAME=Нет функции с таким именем
|
||||
INVALID_FUNCTION_PARAMETERS_NUM=Неверное количество параметров функции
|
||||
INVALID_PROCEDURE_PARAMETERS_NUM=Неверное количество параметров процедуры
|
||||
|
|
|
|||
Loading…
Reference in a new issue