Пример #1
0
		public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
			Debug.Assert((conditionalExpression != null));
			Debug.Assert((conditionalExpression.Condition != null));
			Debug.Assert((conditionalExpression.TrueExpression != null));
			Debug.Assert((conditionalExpression.FalseExpression != null));
			conditionalExpression.Condition.AcceptVisitor(this, data);
			conditionalExpression.TrueExpression.AcceptVisitor(this, data);
			return conditionalExpression.FalseExpression.AcceptVisitor(this, data);
		}
		public virtual object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
			return base.VisitConditionalExpression(conditionalExpression, data);
		}
Пример #3
0
	void Expr(
#line  1804 "Frames/cs.ATG" 
out Expression expr) {

#line  1805 "Frames/cs.ATG" 
		expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; 

#line  1807 "Frames/cs.ATG" 
		Location startLocation = la.Location; 
		UnaryExpr(
#line  1808 "Frames/cs.ATG" 
out expr);
		if (StartOf(7)) {
			AssignmentOperator(
#line  1811 "Frames/cs.ATG" 
out op);
			Expr(
#line  1811 "Frames/cs.ATG" 
out expr1);

#line  1811 "Frames/cs.ATG" 
			expr = new AssignmentExpression(expr, op, expr1); 
		} else if (
#line  1812 "Frames/cs.ATG" 
la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) {
			AssignmentOperator(
#line  1813 "Frames/cs.ATG" 
out op);
			Expr(
#line  1813 "Frames/cs.ATG" 
out expr1);

#line  1813 "Frames/cs.ATG" 
			expr = new AssignmentExpression(expr, op, expr1); 
		} else if (StartOf(8)) {
			ConditionalOrExpr(
#line  1815 "Frames/cs.ATG" 
ref expr);
			if (la.kind == 13) {
				lexer.NextToken();
				Expr(
#line  1816 "Frames/cs.ATG" 
out expr1);

#line  1816 "Frames/cs.ATG" 
				expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1); 
			}
			if (la.kind == 12) {
				lexer.NextToken();
				Expr(
#line  1817 "Frames/cs.ATG" 
out expr1);
				Expect(9);
				Expr(
#line  1817 "Frames/cs.ATG" 
out expr2);

#line  1817 "Frames/cs.ATG" 
				expr = new ConditionalExpression(expr, expr1, expr2);  
			}
		} else SynErr(150);

#line  1820 "Frames/cs.ATG" 
		if (expr != null) {
		expr.StartLocation = startLocation;
		expr.EndLocation = t.EndLocation;
		}
		
	}
		public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data)
		{
			IdentifierExpression ident = invocationExpression.TargetObject as IdentifierExpression;
			if (ident != null) {
				if ("IIF".Equals(ident.Identifier, StringComparison.InvariantCultureIgnoreCase)
				    && invocationExpression.Arguments.Count == 3)
				{
					ConditionalExpression ce = new ConditionalExpression(invocationExpression.Arguments[0],
					                                                     invocationExpression.Arguments[1],
					                                                     invocationExpression.Arguments[2]);
					ReplaceCurrentNode(new ParenthesizedExpression(ce));
					return base.VisitConditionalExpression(ce, data);
				}
				if ("IsNothing".Equals(ident.Identifier, StringComparison.InvariantCultureIgnoreCase)
				    && invocationExpression.Arguments.Count == 1)
				{
					BinaryOperatorExpression boe = new BinaryOperatorExpression(invocationExpression.Arguments[0],
					                                                            BinaryOperatorType.ReferenceEquality,
					                                                            new PrimitiveExpression(null, "null"));
					ReplaceCurrentNode(new ParenthesizedExpression(boe));
					return base.VisitBinaryOperatorExpression(boe, data);
				}
				if (methodTable == null) {
					methodTable = CreateDictionary("Conversion", "FileSystem", "Financial", "Information",
					                               "Interaction", "Strings", "VBMath");
				}
				Expression expr;
				if (methodTable.TryGetValue(ident.Identifier, out expr)) {
					MemberReferenceExpression fre = new MemberReferenceExpression(expr, ident.Identifier);
					invocationExpression.TargetObject = fre;
				}
			}
			return base.VisitInvocationExpression(invocationExpression, data);
		}
		public sealed override object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
			this.BeginVisit(conditionalExpression);
			object result = this.TrackedVisitConditionalExpression(conditionalExpression, data);
			this.EndVisit(conditionalExpression);
			return result;
		}
Пример #6
0
			public void VisitExpression (ConditionalExpression expression, MethodProperties meth)
			{
				VisitExpression(((ConditionalExpression)expression).Condition, meth);
				VisitExpression(((ConditionalExpression)expression).TrueExpression, meth);
			}
Пример #7
0
	void ConditionalExpression(
#line  1709 "VBNET.ATG" 
out Expression expr) {

#line  1711 "VBNET.ATG" 
		ConditionalExpression conditionalExpression = new ConditionalExpression();
		BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
		conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;
		
		Expression condition = null;
		Expression trueExpr = null;
		Expression falseExpr = null;
		
		Expect(122);
		Expect(25);
		Expr(
#line  1720 "VBNET.ATG" 
out condition);
		Expect(12);
		Expr(
#line  1720 "VBNET.ATG" 
out trueExpr);
		if (la.kind == 12) {
			lexer.NextToken();
			Expr(
#line  1720 "VBNET.ATG" 
out falseExpr);
		}
		Expect(26);

#line  1722 "VBNET.ATG" 
		if(falseExpr != null)
		{
			conditionalExpression.Condition = condition;
			conditionalExpression.TrueExpression = trueExpr;
			conditionalExpression.FalseExpression = falseExpr;
			conditionalExpression.EndLocation = t.EndLocation;
			
			expr = conditionalExpression;
		}
		else
		{
			binaryOperatorExpression.Left = condition;
			binaryOperatorExpression.Right = trueExpr;
			binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
			binaryOperatorExpression.EndLocation = t.EndLocation;
			
			expr = binaryOperatorExpression;
		}
		
	}
Пример #8
0
		public override object VisitConditionalExpression (ConditionalExpression conditionalExpression, object data) 
		{
			return CreateResult (GetCommonType (GetTypeSafe (conditionalExpression.TrueExpression), 
			                                    GetTypeSafe (conditionalExpression.FalseExpression)).FullName);
		}
		public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
			Debug.Assert((conditionalExpression != null));
			Debug.Assert((conditionalExpression.Condition != null));
			Debug.Assert((conditionalExpression.TrueExpression != null));
			Debug.Assert((conditionalExpression.FalseExpression != null));
			nodeStack.Push(conditionalExpression.Condition);
			conditionalExpression.Condition.AcceptVisitor(this, data);
			conditionalExpression.Condition = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(conditionalExpression.TrueExpression);
			conditionalExpression.TrueExpression.AcceptVisitor(this, data);
			conditionalExpression.TrueExpression = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(conditionalExpression.FalseExpression);
			conditionalExpression.FalseExpression.AcceptVisitor(this, data);
			conditionalExpression.FalseExpression = ((Expression)(nodeStack.Pop()));
			return null;
		}
		public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
			throw new global::System.NotImplementedException("ConditionalExpression");
		}