本文整理汇总了C#中Analyzer.EnterUnreachableCode方法的典型用法代码示例。如果您正苦于以下问题:C# Analyzer.EnterUnreachableCode方法的具体用法?C# Analyzer.EnterUnreachableCode怎么用?C# Analyzer.EnterUnreachableCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer
的用法示例。
在下文中一共展示了Analyzer.EnterUnreachableCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
{
access = info.Access;
if (resultExpr != null)
resultExpr = resultExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
analyzer.EnterUnreachableCode();
return new Evaluation(this);
}
示例2: Analyze
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/>
internal override Statement/*!*/ Analyze(Analyzer/*!*/ analyzer)
{
if (analyzer.IsThisCodeUnreachable())
{
analyzer.ReportUnreachableCode(position);
return EmptyStmt.Unreachable;
}
if (expr != null)
{
ExInfoFromParent sinfo = ExInfoFromParent.DefaultExInfo;
if (type == Types.Return
&& analyzer.CurrentRoutine != null && analyzer.CurrentRoutine.Signature.AliasReturn
&& expr is VarLikeConstructUse)
{
sinfo.Access = AccessType.ReadRef;
}
expr = expr.Analyze(analyzer, sinfo).Literalize();
if (type != Types.Return && expr.HasValue)
{
int level = Convert.ObjectToInteger(expr.Value);
if (level > analyzer.LoopNestingLevel || level < 0)
{
analyzer.ErrorSink.Add(Errors.InvalidBreakLevelCount, analyzer.SourceUnit, position, level);
}
}
}
else if (type != Types.Return && analyzer.LoopNestingLevel == 0)
{
analyzer.ErrorSink.Add(Errors.InvalidBreakLevelCount, analyzer.SourceUnit, position, 1);
}
// code in the same block after return, break, continue is unreachable
analyzer.EnterUnreachableCode();
return this;
}