This commit is contained in:
Бондарев Иван 2018-10-03 14:31:45 +02:00
parent 932600b1c6
commit 17897c2be6
7 changed files with 56 additions and 9 deletions

View file

@ -5192,6 +5192,12 @@ namespace CodeCompletion
_slice_expr_question.v.visit(this);
}
public override void visit(dot_question_node _dot_question_node)
{
dot_node dn = new dot_node(_dot_question_node.left, _dot_question_node.right, _dot_question_node.source_context);
dn.visit(this);
}
public override void visit(modern_proc_type _modern_proc_type)
{
template_type_reference ttr = new template_type_reference();

View file

@ -748,6 +748,12 @@ namespace CodeCompletion
return es;
}
public override void visit(dot_question_node _dot_question_node)
{
dot_node dn = new dot_node(_dot_question_node.left, _dot_question_node.right, _dot_question_node.source_context);
dn.visit(this);
}
public override void visit(dot_node _dot_node)
{
bool tmp = by_dot;

View file

@ -2719,7 +2719,7 @@ namespace PascalABCCompiler.Parsers
kav.Push('\'');
sb.Insert(0, ch);//.Append(Text[i]);
}
else if (ch == '.' || ch == '^' || ch == '&')
else if (ch == '.' || ch == '^' || ch == '&' || ch == '?')
{
if (ch == '.' && i >= 1 && Text[i - 1] == '.') end = true; else sb.Insert(0, ch);
if (ch != '.') punkt_sym = true;
@ -2765,7 +2765,7 @@ namespace PascalABCCompiler.Parsers
if (kav.Count == 0)
{
string tmps = sb.ToString().Trim(' ', '\r', '\t', '\n');
if (tmps.Length >= 1 && (char.IsLetter(tmps[0]) || tmps[0] == '_' || tmps[0] == '&') && tokens.Count == 0)
if (tmps.Length >= 1 && (char.IsLetter(tmps[0]) || tmps[0] == '_' || tmps[0] == '&' || tmps[0] == '?') && tokens.Count == 0)
end = true;
else
tokens.Push(ch);
@ -2837,7 +2837,7 @@ namespace PascalABCCompiler.Parsers
i--;
}
}
if (i >= 0 && (char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
if (i >= 0 && (char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&' || Text[i] == '?'))
{
bound = i + 1;
TestForKeyword(Text, i, ref bound, punkt_sym, out keyw);
@ -2938,10 +2938,10 @@ namespace PascalABCCompiler.Parsers
return "";
bool is_char = false;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (Text[i] != ' ' && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
if (Text[i] != ' ' && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&' || Text[i] == '?'))
{
//sb.Remove(0,sb.Length);
while (i >= 0 && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
while (i >= 0 && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&' || Text[i] == '?'))
{
//sb.Insert(0,Text[i]);//.Append(Text[i]);
i--;
@ -2949,7 +2949,7 @@ namespace PascalABCCompiler.Parsers
is_char = true;
}
i = off;
if (i < Text.Length && Text[i] != ' ' && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
if (i < Text.Length && Text[i] != ' ' && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&' || Text[i] == '?'))
{
while (i < Text.Length && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_'))
{
@ -3047,7 +3047,7 @@ namespace PascalABCCompiler.Parsers
sk_stack.Push('<');
}
else if (!char.IsLetterOrDigit(c) && c != '&' && c != '.' && c != ' ' && c != '\t' && c != '\n' && c != ',')
else if (!char.IsLetterOrDigit(c) && c != '?' && c != '&' && c != '.' && c != ' ' && c != '\t' && c != '\n' && c != ',')
{
break;
}

View file

@ -0,0 +1,7 @@
const
TempFile: string = System.IO.Path.GetTempFileName();
begin
writeln(TempFile);
writeln(TempFile);
end.

View file

@ -0,0 +1,7 @@
const
TempFile: string = System.Environment.CurrentDirectory;
begin
writeln(TempFile);
writeln(TempFile);
end.

View file

@ -14040,7 +14040,7 @@ namespace PascalABCCompiler.TreeConverter
{
compiled_static_method_call csmc = expr as compiled_static_method_call;
if (/*csmc.parameters.Count == 0 &&*/ csmc.type != null && csmc.type != SystemLibrary.SystemLibrary.void_type)
if (csmc.type != null && csmc.type != SystemLibrary.SystemLibrary.void_type && (csmc.function_node.IsSpecialName && csmc.function_node.is_readonly || NetHelper.NetHelper.PABCSystemType != null && csmc.function_node.cont_type.compiled_type.Assembly == NetHelper.NetHelper.PABCSystemType.Assembly))
constant = new compiled_static_method_call_as_constant(csmc, expr.location);
}
else if (expr is common_namespace_function_call && SystemLibrary.SystemLibInitializer.CreateSetProcedure != null && (expr as common_namespace_function_call).function_node == SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info as common_namespace_function_node)

View file

@ -1681,6 +1681,7 @@ namespace PascalABCCompiler.TreeRealization
private bool _is_extension_method=false;
private compiled_type_node connected_to_type;
private List<compiled_type_node> _generic_params;
private System.Reflection.PropertyInfo getter_of_property;
private static System.Collections.Generic.Dictionary<System.Reflection.MethodInfo, compiled_function_node> compiled_methods =
new System.Collections.Generic.Dictionary<System.Reflection.MethodInfo, compiled_function_node>();
@ -1700,6 +1701,7 @@ namespace PascalABCCompiler.TreeRealization
ret_val = null;
}
}
System.Reflection.ParameterInfo[] pinf=mi.GetParameters();
parameter_list pal = new parameter_list();
//if (!(_mi.IsGenericMethod))
@ -1749,7 +1751,16 @@ namespace PascalABCCompiler.TreeRealization
_is_extension_method = NetHelper.NetHelper.IsExtensionMethod(mi);
this.return_value_type=ret_val;
this.parameters.AddRange(pal);
}
if (mi.Name.StartsWith("get_"))
foreach (System.Reflection.PropertyInfo pi in mi.DeclaringType.GetProperties())
{
if (pi.GetGetMethod() == mi)
{
getter_of_property = pi;
break;
}
}
}
/// <summary>
/// Метод создания узла. Позволяет обеспичивать уникальность обертки для каждого метода.
@ -1779,6 +1790,16 @@ namespace PascalABCCompiler.TreeRealization
}
}
public bool is_readonly
{
get
{
if (getter_of_property != null && getter_of_property.GetSetMethod() == null)
return true;
return false;
}
}
public override bool is_extension_method
{
get