bug fix #644
This commit is contained in:
parent
b0a074500b
commit
23c17a9e5a
|
|
@ -9837,14 +9837,20 @@ namespace PascalABCCompiler.NETGenerator
|
|||
{
|
||||
Label EndLabel = il.DefineLabel();
|
||||
Label FalseLabel = il.DefineLabel();
|
||||
|
||||
bool tmp_is_dot_expr = is_dot_expr;
|
||||
bool tmp_is_addr = is_addr;
|
||||
is_dot_expr = false;//don't box the condition expression
|
||||
is_addr = false;
|
||||
value.condition.visit(this);
|
||||
is_dot_expr = tmp_is_dot_expr;
|
||||
is_addr = tmp_is_addr;
|
||||
il.Emit(OpCodes.Brfalse, FalseLabel);
|
||||
value.ret_if_true.visit(this);
|
||||
il.Emit(OpCodes.Br, EndLabel);
|
||||
il.MarkLabel(FalseLabel);
|
||||
value.ret_if_false.visit(this);
|
||||
il.MarkLabel(EndLabel);
|
||||
|
||||
}
|
||||
|
||||
private Hashtable range_stmts_labels = new Hashtable();
|
||||
|
|
|
|||
18
TestSuite/cast2.pas
Normal file
18
TestSuite/cast2.pas
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
var i: integer;
|
||||
|
||||
procedure p(a: byte);
|
||||
begin
|
||||
i := 1;
|
||||
end;
|
||||
|
||||
type
|
||||
fb = function: byte;
|
||||
|
||||
begin
|
||||
var a: function: byte := ()->2;
|
||||
p(fb(a));
|
||||
assert(i = 1);
|
||||
var b := fb(a);
|
||||
assert(b = 2);
|
||||
assert(fb(a).ToString = 'cast2.fb');
|
||||
end.
|
||||
Loading…
Reference in a new issue