internal override MSA.Expression/*!*/ Transform(AstGenerator/*!*/ gen) {
MSA.Expression transformedReturnValue = TransformReturnValue(gen);
// eval:
if (gen.CompilerOptions.IsEval) {
return Methods.EvalBreak.OpCall(gen.CurrentScopeVariable, AstUtils.Box(transformedReturnValue));
}
// loop:
if (gen.CurrentLoop != null) {
return Ast.Block(
Ast.Assign(
gen.CurrentLoop.ResultVariable,
Ast.Convert(transformedReturnValue, gen.CurrentLoop.ResultVariable.Type)
),
Ast.Break(gen.CurrentLoop.BreakLabel),
AstUtils.Empty()
);
}
// block:
if (gen.CurrentBlock != null) {
return gen.Return(Methods.BlockBreak.OpCall(gen.CurrentBlock.BfcVariable, AstUtils.Box(transformedReturnValue)));
}
// primary frame:
return Methods.MethodBreak.OpCall(AstUtils.Box(transformedReturnValue));
}
}