Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/FastExpressionCompiler.LightExpression/Expression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5380,13 +5380,13 @@ internal LoopExpression(Expression body, LabelTarget breakLabel, LabelTarget con
protected internal override Expression Accept(ExpressionVisitor visitor) => visitor.VisitLoop(this);
#endif
internal override SysExpr CreateSysExpression(ref SmallList<LightAndSysExpr> exprsConverted) =>
ContinueLabel != null
? SysExpr.Loop(Body.ToExpression(ref exprsConverted),
BreakLabel?.ToSystemLabelTarget(ref exprsConverted),
ContinueLabel.ToSystemLabelTarget(ref exprsConverted)) :
BreakLabel == null
? SysExpr.Loop(Body.ToExpression(ref exprsConverted)) :
ContinueLabel == null
? SysExpr.Loop(Body.ToExpression(ref exprsConverted), BreakLabel.ToSystemLabelTarget(ref exprsConverted)) :
SysExpr.Loop(Body.ToExpression(ref exprsConverted),
BreakLabel.ToSystemLabelTarget(ref exprsConverted),
ContinueLabel.ToSystemLabelTarget(ref exprsConverted));
? SysExpr.Loop(Body.ToExpression(ref exprsConverted))
: SysExpr.Loop(Body.ToExpression(ref exprsConverted), BreakLabel.ToSystemLabelTarget(ref exprsConverted));
}

public class TryExpression : Expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public int Run()
Can_embed_normal_Expression_into_LightExpression_eg_as_Constructor_argument();
Should_output_the_System_and_LightExpression_to_the_identical_construction_syntax();
Should_output_the_System_and_LightExpression_to_the_identical_CSharp_syntax();
Light_loop_with_continue_label_and_no_break_label_keeps_the_continue_label_in_the_system_expression();
Expression_produced_by_ToExpressionString_should_compile();
Multiple_methods_in_block_should_be_aligned_when_output_to_csharp();
Can_roundtrip_light_expression_through_flat_expression();
Expand Down Expand Up @@ -2549,6 +2550,15 @@ public void Should_output_the_System_and_LightExpression_to_the_identical_constr
}


public void Light_loop_with_continue_label_and_no_break_label_keeps_the_continue_label_in_the_system_expression()
{
var cont = Label("cont");
var le = Lambda<Action>(Loop(Block(Continue(cont)), null, cont));
var loop = (System.Linq.Expressions.LoopExpression)le.ToLambdaExpression().Body;
Asserts.AreEqual(null, loop.BreakLabel);
Asserts.AreEqual("cont", loop.ContinueLabel?.Name);
}

public void Should_output_the_System_and_LightExpression_to_the_identical_CSharp_syntax()
{
var se = CreateComplexExpression("p");
Expand Down
Loading