protected override void CreateArguments (ResolveContext ec, Parameter parameter, ref Arguments args)
{
if (args == null) {
if (IdentifierType != null)
expr = CreateCastExpression (expr);
base.CreateArguments (ec, parameter.Clone (), ref args);
}
Expression result_selector_expr;
QueryBlock result_block;
var target = GetIntoVariable ();
var target_param = new ImplicitLambdaParameter (target.Name, target.Location);
//
// When select follows use it as a result selector
//
if (next is Select) {
result_selector_expr = next.Expr;
result_block = next.block;
result_block.SetParameters (parameter, target_param);
next = next.next;
} else {
result_selector_expr = CreateRangeVariableType (ec, parameter, target, new SimpleName (target.Name, target.Location));
result_block = new QueryBlock (ec.Compiler, block.Parent, block.StartLocation);
result_block.SetParameters (parameter, target_param);
}
LambdaExpression result_selector = new LambdaExpression (Location);
result_selector.Block = result_block;
result_selector.Block.AddStatement (new ContextualReturn (result_selector_expr));
args.Add (new Argument (result_selector));
}