This commit is contained in:
parent
dc9320cd90
commit
70d9fc52bb
|
|
@ -9033,11 +9033,13 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
Label lb_true = il.DefineLabel();
|
Label lb_true = il.DefineLabel();
|
||||||
Label lb_end = il.DefineLabel();
|
Label lb_end = il.DefineLabel();
|
||||||
Label lb_common = il.DefineLabel();
|
Label lb_common = il.DefineLabel();
|
||||||
LocalBuilder lb_left = il.DeclareLocal(ti_left.tp);
|
LocalBuilder lb_left = null;
|
||||||
LocalBuilder lb_right = il.DeclareLocal(ti_right.tp);
|
LocalBuilder lb_right = null;
|
||||||
if (!(real_parameters[0] is IDefaultOperatorNode) && !(real_parameters[1] is IDefaultOperatorNode))
|
if (!(real_parameters[0] is IDefaultOperatorNode) && !(real_parameters[1] is IDefaultOperatorNode))
|
||||||
{
|
{
|
||||||
is_dot_expr = true;
|
//is_dot_expr = true;
|
||||||
|
lb_left = il.DeclareLocal(ti_left.tp);
|
||||||
|
lb_right = il.DeclareLocal(ti_right.tp);
|
||||||
real_parameters[0].visit(this);
|
real_parameters[0].visit(this);
|
||||||
il.Emit(OpCodes.Stloc, lb_left);
|
il.Emit(OpCodes.Stloc, lb_left);
|
||||||
il.Emit(OpCodes.Ldloca, lb_left);
|
il.Emit(OpCodes.Ldloca, lb_left);
|
||||||
|
|
@ -9049,7 +9051,7 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
LocalBuilder tmp_lb = il.DeclareLocal(TypeFactory.BoolType);
|
LocalBuilder tmp_lb = il.DeclareLocal(TypeFactory.BoolType);
|
||||||
il.Emit(OpCodes.Stloc, tmp_lb);
|
il.Emit(OpCodes.Stloc, tmp_lb);
|
||||||
il.Emit(OpCodes.Ldloc, tmp_lb);
|
il.Emit(OpCodes.Ldloc, tmp_lb);
|
||||||
is_dot_expr = true;
|
//is_dot_expr = true;
|
||||||
real_parameters[1].visit(this);
|
real_parameters[1].visit(this);
|
||||||
il.Emit(OpCodes.Stloc, lb_right);
|
il.Emit(OpCodes.Stloc, lb_right);
|
||||||
il.Emit(OpCodes.Ldloca, lb_right);
|
il.Emit(OpCodes.Ldloca, lb_right);
|
||||||
|
|
@ -9131,15 +9133,32 @@ namespace PascalABCCompiler.NETGenerator
|
||||||
|
|
||||||
if (!(real_parameters[0] is IDefaultOperatorNode))
|
if (!(real_parameters[0] is IDefaultOperatorNode))
|
||||||
{
|
{
|
||||||
is_dot_expr = true;
|
if (lb_left != null)
|
||||||
il.Emit(OpCodes.Ldloca, lb_left);
|
{
|
||||||
il.Emit(OpCodes.Call, mi_left);
|
il.Emit(OpCodes.Ldloca, lb_left);
|
||||||
|
il.Emit(OpCodes.Call, mi_left);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is_dot_expr = true;
|
||||||
|
real_parameters[0].visit(this);
|
||||||
|
il.Emit(OpCodes.Call, mi_left);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!(real_parameters[1] is IDefaultOperatorNode))
|
if (!(real_parameters[1] is IDefaultOperatorNode))
|
||||||
{
|
{
|
||||||
is_dot_expr = true;
|
if (lb_right != null)
|
||||||
il.Emit(OpCodes.Ldloca, lb_right);
|
{
|
||||||
il.Emit(OpCodes.Call, mi_right);
|
il.Emit(OpCodes.Ldloca, lb_right);
|
||||||
|
il.Emit(OpCodes.Call, mi_right);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is_dot_expr = true;
|
||||||
|
real_parameters[1].visit(this);
|
||||||
|
il.Emit(OpCodes.Call, mi_right);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
MethodInfo eq_mi = null;
|
MethodInfo eq_mi = null;
|
||||||
if (real_parameters[0].type is IGenericTypeInstance)
|
if (real_parameters[0].type is IGenericTypeInstance)
|
||||||
|
|
|
||||||
11
TestSuite/lambdas_generics15.pas
Normal file
11
TestSuite/lambdas_generics15.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
type
|
||||||
|
Container = record
|
||||||
|
val: integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var c: Container;
|
||||||
|
c.val := 2;
|
||||||
|
var s: sequence of Container := Arr(c);
|
||||||
|
assert(s.Max(a->a.val) = 2);
|
||||||
|
end.
|
||||||
|
|
@ -2414,6 +2414,14 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool is_extension_method
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _original_function.is_extension_method;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool is_generic_function_instance
|
public override bool is_generic_function_instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue