本文整理汇总了C#中IronRuby.Compiler.Ast.AstGenerator.DebugMarker方法的典型用法代码示例。如果您正苦于以下问题:C# AstGenerator.DebugMarker方法的具体用法?C# AstGenerator.DebugMarker怎么用?C# AstGenerator.DebugMarker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Compiler.Ast.AstGenerator
的用法示例。
在下文中一共展示了AstGenerator.DebugMarker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
};
}
示例2: TransformRead
internal sealed override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
string debugString = (IsSingletonDeclaration) ? "SINGLETON" : ((this is ClassDefinition) ? "CLASS" : "MODULE") + " " + QualifiedName.Name;
ScopeBuilder outerLocals = gen.CurrentScope;
// definition needs to take place outside the defined lexical scope:
var definition = MakeDefinitionExpression(gen);
var selfVariable = outerLocals.DefineHiddenVariable("#module", typeof(RubyModule));
var parentScope = gen.CurrentScopeVariable;
// inner locals:
ScopeBuilder scope = DefineLocals();
var scopeVariable = scope.DefineHiddenVariable("#scope", typeof(RubyScope));
gen.EnterModuleDefinition(
scope,
selfVariable,
scopeVariable,
IsSingletonDeclaration
);
// transform body:
MSA.Expression transformedBody = Body.TransformRead(gen);
// outer local:
MSA.Expression resultVariable = outerLocals.DefineHiddenVariable("#result", transformedBody.Type);
// begin with new scope
// self = DefineModule/Class(... parent scope here ...)
// <body>
// end
MSA.Expression result = new AstBlock {
gen.DebugMarker(debugString),
Ast.Assign(selfVariable, definition),
scope.CreateScope(
scopeVariable,
Methods.CreateModuleScope.OpCall(
scope.MakeLocalsStorage(),
scope.GetVariableNamesExpression(),
parentScope,
selfVariable
),
Ast.Block(
Ast.Assign(resultVariable, transformedBody),
AstUtils.Empty()
)
),
gen.DebugMarker("END OF " + debugString),
resultVariable
};
gen.LeaveModuleDefinition();
return result;
}