コード例 #1
0
 public virtual Expression VisitTernaryExpression(TernaryExpression expression)
 {
     if (expression == null) return null;
     expression.Operand1 = this.VisitExpression(expression.Operand1);
     expression.Operand2 = this.VisitExpression(expression.Operand2);
     expression.Operand3 = this.VisitExpression(expression.Operand3);
     return expression;
 }
コード例 #2
0
ファイル: Duplicator.cs プロジェクト: modulexcite/SHFB-1
 public override Expression VisitTernaryExpression(TernaryExpression expression)
 {
     if (expression == null) return null;
     return base.VisitTernaryExpression((TernaryExpression)expression.Clone());
 }
コード例 #3
0
ファイル: Parser.cs プロジェクト: dbremner/specsharp
 private Expression ParseConditional(Expression condition, TokenSet followers){
   Debug.Assert(this.currentToken == Token.Conditional);
   this.GetNextToken();
   Expression trueExpr = this.ParseExpression(followers|Token.Colon);
   if (trueExpr == null) //Supply a dummy
     trueExpr = new Literal(null, null, this.scanner.CurrentSourceContext);
   Expression falseExpr;
   if (this.currentToken == Token.Colon){
     this.GetNextToken();
     falseExpr = this.ParseExpression(followers);
   }else{
     this.Skip(Token.Colon); //gives appropriate error message
     if (!followers[this.currentToken])
       //Assume that only the : is missing. Go ahead as if it were specified.
       falseExpr = this.ParseExpression(followers);
     else
       falseExpr = null;
   }
   if (falseExpr == null) //Supply a dummy
     falseExpr = new Literal(null, null, this.scanner.CurrentSourceContext);
   TernaryExpression result = new TernaryExpression(condition, trueExpr, falseExpr, NodeType.Conditional, null);
   result.SourceContext = condition.SourceContext;
   result.SourceContext.EndPos = falseExpr.SourceContext.EndPos;
   this.SkipTo(followers);
   return result;
 }
コード例 #4
0
ファイル: CodeFlattener.cs プロジェクト: dbremner/specsharp
		public override Expression VisitTernaryExpression(TernaryExpression ternaryExpression)
		{
      ternaryExpression = (TernaryExpression)ternaryExpression.Clone();

			ternaryExpression.Operand1 = simplify(ternaryExpression.Operand1);
			ternaryExpression.Operand2 = simplify(ternaryExpression.Operand2);
			ternaryExpression.Operand3 = simplify(ternaryExpression.Operand3);
			return ternaryExpression;
		}
コード例 #5
0
ファイル: Decompiler.cs プロジェクト: ZingModelChecker/Zing
 public override Expression VisitTernaryExpression(TernaryExpression expression)
 {
     Write("(");
     this.VisitExpression(expression.Operand1);
     Write(" ? ");
     this.VisitExpression(expression.Operand2);
     Write(" : ");
     this.VisitExpression(expression.Operand3);
     Write(")");
     return expression;
 }
コード例 #6
0
 public EventingVisitor(Action<TernaryExpression> visitTernaryExpression) { VisitedTernaryExpression += visitTernaryExpression; } public event Action<TernaryExpression> VisitedTernaryExpression; public override Expression VisitTernaryExpression(TernaryExpression expression) { if (VisitedTernaryExpression != null) VisitedTernaryExpression(expression); return base.VisitTernaryExpression(expression); }