Exemplo n.º 1
0
		public void Visit(TernaryExpression expression)
		{
			expression.LeftExpression.Accept(this);
			Builder.Append(" ? ");
			expression.MiddleExpression.Accept(this);
			Builder.Append(" : ");
			expression.RightExpression.Accept(this);
		}
Exemplo n.º 2
0
        public void Visit(TernaryExpression expression)
        {
            Result = null;

            // Evaluates the left expression and saves the value
            expression.LeftExpression.Accept(this);
            JsInstance left = (JsInstance)Result;

            Result = null;

            if (left.ToBoolean())
            {
                // Evaluates the middle expression
                expression.MiddleExpression.Accept(this);
            }
            else
            {
                // Evaluates the right expression
                expression.RightExpression.Accept(this);
            }
        }
Exemplo n.º 3
0
        public void Visit(TernaryExpression expression)
        {
            Result = null;

            // Evaluates the left expression and saves the value
            expression.LeftExpression.Accept(this);
            var left = Result;

            Result = null;

            EnsureIdentifierIsDefined(left);

            if (left.ToBoolean()) {
                // Evaluates the middle expression
                expression.MiddleExpression.Accept(this);
            }
            else {
                // Evaluates the right expression
                expression.RightExpression.Accept(this);
            }
        }
Exemplo n.º 4
0
 void Analyze(TernaryExpression Stmt)
 {
     SetCurrentLineAndCharNos(Stmt);
     if (Stmt.LeftExpression != null) Analyze(Stmt.LeftExpression);
     if (Stmt.MiddleExpression != null) Analyze(Stmt.MiddleExpression);
     if (Stmt.RightExpression != null) Analyze(Stmt.RightExpression);
 }