ifelsestatement.cs

来自「全功能c#编译器」· CS 代码 · 共 68 行

CS
68
字号
using System;
using System.Diagnostics;
using System.Collections;

namespace ICSharpCode.CsVbRefactory.Parser.AST 
{
	public class IfElseStatement : Statement
	{
		Expression condition;
		Statement  trueStatement;
		Statement  falseStatement;
		
		public Expression Condition {
			get {
				return condition;
			}
			set {
				condition = value == null ? Expression.Null : value;
			}
		}
		public Statement TrueStatement {
			get {
				return trueStatement;
			}
			set {
				trueStatement = value == null ? Statement.Null : value;
			}
		}
		
		public Statement FalseStatement {
			get {
				return falseStatement;
			}
			set {
				falseStatement = value == null ? Statement.Null : value;
			}
		}
		
		public IfElseStatement(Expression condition, Statement trueStatement)
		{
			this.Condition      = condition;
			this.TrueStatement  = trueStatement;
			this.falseStatement = Statement.Null;
		}
		
		public IfElseStatement(Expression condition, Statement trueStatement, Statement falseStatement)
		{
			this.Condition      = condition;
			this.TrueStatement  = trueStatement;
			this.FalseStatement = falseStatement;
		}
		
		public override object AcceptVisitor(IASTVisitor visitor, object data)
		{
			return visitor.Visit(this, data);
		}
		
		public override string ToString()
		{
			return String.Format("[IfElseStatement: Condition={0}, TrueStatement={1}, FalseStatement={2}]",
			                     condition,
			                     trueStatement,
			                     falseStatement
			                     );
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?