本文整理汇总了C#中Analyzer.LeaveConditionalCode方法的典型用法代码示例。如果您正苦于以下问题:C# Analyzer.LeaveConditionalCode方法的具体用法?C# Analyzer.LeaveConditionalCode怎么用?C# Analyzer.LeaveConditionalCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer
的用法示例。
在下文中一共展示了Analyzer.LeaveConditionalCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Analyze
internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
{
access = info.Access;
Evaluation cond_eval = condExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);
if (cond_eval.HasValue)
{
if (Convert.ObjectToBoolean(cond_eval.Value))
{
if (trueExpr != null)
return trueExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);
else
return cond_eval; // condExpr ?: falseExpr // ternary shortcut
}
else
return falseExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);
}
else
{
if (trueExpr != null)
{
analyzer.EnterConditionalCode();
trueExpr = trueExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
analyzer.LeaveConditionalCode();
}
analyzer.EnterConditionalCode();
falseExpr = falseExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
analyzer.LeaveConditionalCode();
return new Evaluation(this);
}
}
示例2: Analyze
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
{
access = info.Access;
ExInfoFromParent operand_info = ExInfoFromParent.DefaultExInfo;
Evaluation left_eval = leftExpr.Analyze(analyzer, operand_info);
Evaluation right_eval;
// Boolean expression evaluation semantics:
if (operation == Operations.Or)
{
analyzer.EnterConditionalCode();
right_eval = rightExpr.Analyze(analyzer, operand_info);
analyzer.LeaveConditionalCode();
}
else
{
right_eval = rightExpr.Analyze(analyzer, operand_info);
}
Evaluation result = Evaluation.Evaluate(this, left_eval, out leftExpr, right_eval, out rightExpr);
// division by zero check:
if ((operation == Operations.Div || operation == Operations.Mod) && result.HasValue && result.Value is bool && (bool)result.Value == false)
{
analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position);
}
else if ((operation == Operations.Div || operation == Operations.Mod) && right_eval.HasValue && right_eval.Value is int && (int)right_eval.Value == 0)
{
result = new Evaluation(this, false);
analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position);
}
return result;
}
示例3: Analyze
internal override Statement Analyze(Analyzer/*!*/ analyzer)
{
analyzer.EnterConditionalCode();
this.Statements.Analyze(analyzer);
analyzer.LeaveConditionalCode();
for (int i = 0; i < catches.Count; i++)
catches[i].Analyze(analyzer);
return this;
}
示例4: Analyze
internal virtual void Analyze(Analyzer/*!*/ analyzer)
{
analyzer.EnterConditionalCode();
this.Statements.Analyze(analyzer);
analyzer.LeaveConditionalCode();
}