当前位置: 首页>>代码示例>>C#>>正文


C# Analyzer.EnterConditionalCode方法代码示例

本文整理汇总了C#中Analyzer.EnterConditionalCode方法的典型用法代码示例。如果您正苦于以下问题:C# Analyzer.EnterConditionalCode方法的具体用法?C# Analyzer.EnterConditionalCode怎么用?C# Analyzer.EnterConditionalCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Analyzer的用法示例。


在下文中一共展示了Analyzer.EnterConditionalCode方法的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);
			}
		}
开发者ID:jdluzen,项目名称:Phalanger,代码行数:34,代码来源:TernaryEx.cs

示例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;
		}
开发者ID:Ashod,项目名称:Phalanger,代码行数:36,代码来源:BinaryEx.cs

示例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;
		}
开发者ID:hansdude,项目名称:Phalanger,代码行数:11,代码来源:TryStmt.cs

示例4: Analyze

		internal virtual void Analyze(Analyzer/*!*/ analyzer)
		{
			analyzer.EnterConditionalCode();

            this.Statements.Analyze(analyzer);
			
			analyzer.LeaveConditionalCode();
		}
开发者ID:hansdude,项目名称:Phalanger,代码行数:8,代码来源:SwitchStmt.cs


注:本文中的Analyzer.EnterConditionalCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。