public static RuleGenerator/*!*/ Open() {
return new RuleGenerator((metaBuilder, args, name) => {
var targetClass = (RubyClass)args.Target;
targetClass.BuildObjectConstructionNoFlow(metaBuilder, args, name);
// TODO: initialize yields the block?
if (args.Signature.HasBlock) {
// ignore flow builder set up so far, we need one that creates a BlockParam for library calls:
metaBuilder.ControlFlowBuilder = null;
if (metaBuilder.BfcVariable == null) {
metaBuilder.BfcVariable = metaBuilder.GetTemporary(typeof(BlockParam), "#bfc");
}
metaBuilder.Result = Ast.Call(new Func<UnaryOpStorage, BlockParam, object, object>(InvokeOpenBlock).GetMethodInfo(),
Ast.Constant(new UnaryOpStorage(args.RubyContext)),
metaBuilder.BfcVariable,
metaBuilder.Result
);
RubyMethodGroupInfo.RuleControlFlowBuilder(metaBuilder, args);
} else {
metaBuilder.BuildControlFlow(args);
}
});
}