當前位置: 首頁>>代碼示例>>C#>>正文


C# Analyzer.LeaveConditionalCode方法代碼示例

本文整理匯總了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);
			}
		}
開發者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.LeaveConditionalCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。