本文整理汇总了C#中IronRuby.Compiler.Ast.AstGenerator.MakeMethodBlockParameterSelfRead方法的典型用法代码示例。如果您正苦于以下问题:C# AstGenerator.MakeMethodBlockParameterSelfRead方法的具体用法?C# AstGenerator.MakeMethodBlockParameterSelfRead怎么用?C# AstGenerator.MakeMethodBlockParameterSelfRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Compiler.Ast.AstGenerator
的用法示例。
在下文中一共展示了AstGenerator.MakeMethodBlockParameterSelfRead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformRead
// see Ruby Language.doc/Runtime/Control Flow Implementation/Yield
internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
MSA.Expression bfcVariable = gen.CurrentScope.DefineHiddenVariable("#yielded-bfc", typeof(BlockParam));
MSA.Expression resultVariable = gen.CurrentScope.DefineHiddenVariable("#result", typeof(object));
MSA.Expression postYield;
if (gen.CompilerOptions.IsEval) {
// eval:
postYield = Methods.EvalYield.OpCall(gen.CurrentScopeVariable, bfcVariable, resultVariable);
} else if (gen.CurrentBlock != null) {
// block:
postYield = Methods.BlockYield.OpCall(gen.CurrentScopeVariable, gen.CurrentBlock.BfcVariable, bfcVariable, resultVariable);
} else {
// method:
postYield = Methods.MethodYield.OpCall(gen.CurrentScopeVariable, bfcVariable, resultVariable);
}
return new AstBlock {
gen.DebugMarker("#RB: yield begin"),
Ast.Assign(bfcVariable, Methods.CreateBfcForYield.OpCall(gen.MakeMethodBlockParameterRead())),
Ast.Assign(
resultVariable,
(Arguments ?? Arguments.Empty).TransformToYield(gen, bfcVariable, gen.MakeMethodBlockParameterSelfRead())
),
AstUtils.IfThen(postYield, gen.Return(resultVariable)),
gen.DebugMarker("#RB: yield end"),
resultVariable
};
}