本文整理汇总了C#中IronRuby.Compiler.Ast.AstGenerator.TryCatchAny方法的典型用法代码示例。如果您正苦于以下问题:C# AstGenerator.TryCatchAny方法的具体用法?C# AstGenerator.TryCatchAny怎么用?C# AstGenerator.TryCatchAny使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Compiler.Ast.AstGenerator
的用法示例。
在下文中一共展示了AstGenerator.TryCatchAny方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformDefinedCondition
internal override MSA.Expression TransformDefinedCondition(AstGenerator/*!*/ gen) {
if (_target != null) {
return gen.TryCatchAny(
Methods.IsDefinedMethod.OpCall(
AstFactory.Box(_target.TransformRead(gen)), gen.CurrentScopeVariable, AstUtils.Constant(_methodName)
),
AstUtils.Constant(false)
);
} else {
return Methods.IsDefinedMethod.OpCall(gen.CurrentSelfVariable, gen.CurrentScopeVariable, AstUtils.Constant(_methodName));
}
}
示例2: TransformDefinedCondition
internal override MSA.Expression TransformDefinedCondition(AstGenerator/*!*/ gen) {
// MRI doesn't evaluate the arguments
MSA.Expression result = AstUtils.LightDynamic(
RubyCallAction.Make(gen.Context, _methodName, RubyCallSignature.IsDefined(_target == null)),
typeof(bool),
gen.CurrentScopeVariable,
(_target != null) ? AstUtils.Box(_target.TransformRead(gen)) : gen.CurrentSelfVariable
);
return (_target != null) ? gen.TryCatchAny(result, AstFactory.False) : result;
}
示例3: TransformRead
private MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen, int/*!*/ opKind) {
MSA.Expression transformedName = TransformName(gen);
MSA.Expression transformedQualifier;
switch (TransformQualifier(gen, out transformedQualifier)) {
case StaticScopeKind.Global:
return (opKind == OpGet ? Methods.GetGlobalConstant : Methods.IsDefinedGlobalConstant).
OpCall(gen.CurrentScopeVariable, transformedName);
case StaticScopeKind.EnclosingModule:
return (opKind == OpGet ? Methods.GetUnqualifiedConstant : Methods.IsDefinedUnqualifiedConstant).
OpCall(gen.CurrentScopeVariable, transformedName);
case StaticScopeKind.Explicit:
if (opKind == OpGet) {
return Methods.GetQualifiedConstant.OpCall(AstFactory.Box(transformedQualifier), gen.CurrentScopeVariable, transformedName);
} else {
return gen.TryCatchAny(
Methods.IsDefinedQualifiedConstant.OpCall(AstFactory.Box(transformedQualifier), gen.CurrentScopeVariable, transformedName),
AstUtils.Constant(false)
);
}
}
throw Assert.Unreachable;
}