本文整理匯總了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;
}