本文整理汇总了C#中Mono.CSharp.BlockContext.NeedReturnLabel方法的典型用法代码示例。如果您正苦于以下问题:C# BlockContext.NeedReturnLabel方法的具体用法?C# BlockContext.NeedReturnLabel怎么用?C# BlockContext.NeedReturnLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.BlockContext
的用法示例。
在下文中一共展示了BlockContext.NeedReturnLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
public override bool Resolve (BlockContext ec)
{
bool ok = true;
ec.StartFlowBranching (this);
if (!Block.Resolve (ec))
ok = false;
TypeSpec[] prev_catches = new TypeSpec [Specific.Count];
int last_index = 0;
foreach (Catch c in Specific){
ec.CurrentBranching.CreateSibling (c.Block, FlowBranching.SiblingType.Catch);
if (!c.Resolve (ec)) {
ok = false;
continue;
}
TypeSpec resolved_type = c.CatchType;
for (int ii = 0; ii < last_index; ++ii) {
if (resolved_type == prev_catches[ii] || TypeSpec.IsBaseClass (resolved_type, prev_catches[ii], true)) {
ec.Report.Error (160, c.loc,
"A previous catch clause already catches all exceptions of this or a super type `{0}'",
TypeManager.CSharpName (prev_catches [ii]));
ok = false;
}
}
prev_catches [last_index++] = resolved_type;
}
if (General != null) {
if (CodeGen.Assembly.WrapNonExceptionThrows) {
foreach (Catch c in Specific){
if (c.CatchType == TypeManager.exception_type && ec.Compiler.PredefinedAttributes.RuntimeCompatibility.IsDefined) {
ec.Report.Warning (1058, 1, c.loc,
"A previous catch clause already catches all exceptions. All non-exceptions thrown will be wrapped in a `System.Runtime.CompilerServices.RuntimeWrappedException'");
}
}
}
ec.CurrentBranching.CreateSibling (General.Block, FlowBranching.SiblingType.Catch);
if (!General.Resolve (ec))
ok = false;
}
ec.EndFlowBranching ();
// System.Reflection.Emit automatically emits a 'leave' at the end of a try/catch clause
// So, ensure there's some IL code after this statement
if (!inside_try_finally && !code_follows && ec.CurrentBranching.CurrentUsageVector.IsUnreachable)
ec.NeedReturnLabel ();
return ok;
}