本文整理汇总了C#中IronRuby.Compiler.Ast.AstGenerator.ClearDebugInfo方法的典型用法代码示例。如果您正苦于以下问题:C# AstGenerator.ClearDebugInfo方法的具体用法?C# AstGenerator.ClearDebugInfo怎么用?C# AstGenerator.ClearDebugInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Compiler.Ast.AstGenerator
的用法示例。
在下文中一共展示了AstGenerator.ClearDebugInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformRead
// see Ruby Language.doc/Runtime/Control Flow Implementation/While-Until
internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
MSA.Expression resultVariable = gen.CurrentScope.DefineHiddenVariable("#loop-result", typeof(object));
MSA.Expression redoVariable = gen.CurrentScope.DefineHiddenVariable("#skip-condition", typeof(bool));
MSA.ParameterExpression unwinder;
bool isInnerLoop = gen.CurrentLoop != null;
MSA.LabelTarget breakLabel = Ast.Label();
MSA.LabelTarget continueLabel = Ast.Label();
gen.EnterLoop(redoVariable, resultVariable, breakLabel, continueLabel);
MSA.Expression transformedBody = gen.TransformStatements(_statements, ResultOperation.Ignore);
MSA.Expression transformedCondition = _condition.TransformCondition(gen, true);
gen.LeaveLoop();
MSA.Expression conditionPositiveStmt, conditionNegativeStmt;
if (_isWhileLoop) {
conditionPositiveStmt = AstUtils.Empty();
conditionNegativeStmt = Ast.Break(breakLabel);
} else {
conditionPositiveStmt = Ast.Break(breakLabel);
conditionNegativeStmt = AstUtils.Empty();
}
// make the loop first:
MSA.Expression loop = new AstBlock {
gen.ClearDebugInfo(),
Ast.Assign(redoVariable, AstUtils.Constant(_isPostTest)),
AstFactory.Infinite(breakLabel, continueLabel,
AstUtils.Try(
AstUtils.If(redoVariable,
Ast.Assign(redoVariable, AstUtils.Constant(false))
).ElseIf(transformedCondition,
conditionPositiveStmt
).Else(
conditionNegativeStmt
),
transformedBody,
AstUtils.Empty()
).Catch(unwinder = Ast.Parameter(typeof(BlockUnwinder), "#u"),
// redo = u.IsRedo
Ast.Assign(redoVariable, Ast.Field(unwinder, BlockUnwinder.IsRedoField)),
AstUtils.Empty()
).Filter(unwinder = Ast.Parameter(typeof(EvalUnwinder), "#u"),
Ast.Equal(Ast.Field(unwinder, EvalUnwinder.ReasonField), AstFactory.BlockReturnReasonBreak),
// result = unwinder.ReturnValue
Ast.Assign(resultVariable, Ast.Field(unwinder, EvalUnwinder.ReturnValueField)),
Ast.Break(breakLabel)
)
),
gen.ClearDebugInfo(),
AstUtils.Empty(),
};
// wrap it to try finally that updates RFC state:
if (!isInnerLoop) {
loop = AstUtils.Try(
Methods.EnterLoop.OpCall(gen.CurrentScopeVariable),
loop
).Finally(
Methods.LeaveLoop.OpCall(gen.CurrentScopeVariable)
);
}
return Ast.Block(loop, resultVariable);
}