/// <summary> /// Returns the existing expression plus the specified integer value. /// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression /// (and thus its parent property is modified). /// </summary> public static Expression AddInteger(Expression expr, int value) { PrimitiveExpression pe = expr as PrimitiveExpression; if (pe != null && pe.Value is int) { int newVal = (int)pe.Value + value; return new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); } BinaryOperatorExpression boe = expr as BinaryOperatorExpression; if (boe != null && boe.Op == BinaryOperatorType.Add) { // clone boe: boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right); boe.Right = AddInteger(boe.Right, value); if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int) { int newVal = (int)((PrimitiveExpression)boe.Right).Value; if (newVal == 0) { return boe.Left; } else if (newVal < 0) { ((PrimitiveExpression)boe.Right).Value = -newVal; boe.Op = BinaryOperatorType.Subtract; } } return boe; } if (boe != null && boe.Op == BinaryOperatorType.Subtract) { pe = boe.Right as PrimitiveExpression; if (pe != null && pe.Value is int) { int newVal = (int)pe.Value - value; if (newVal == 0) return boe.Left; // clone boe: boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right); if (newVal < 0) { newVal = -newVal; boe.Op = BinaryOperatorType.Add; } boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); return boe; } } BinaryOperatorType opType = BinaryOperatorType.Add; if (value < 0) { value = -value; opType = BinaryOperatorType.Subtract; } return new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); }
// The following conversions are implemented: // a == null -> a Is Nothing // a != null -> a Is Not Nothing // i++ / ++i as statement: convert to i += 1 // i-- / --i as statement: convert to i -= 1 // ForStatement -> ForNextStatement when for-loop is simple // if (Event != null) Event(this, bla); -> RaiseEvent Event(this, bla) // Casts to value types are marked as conversions public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { if (binaryOperatorExpression.Op == BinaryOperatorType.Equality || binaryOperatorExpression.Op == BinaryOperatorType.InEquality) { if (IsNullLiteralExpression(binaryOperatorExpression.Left)) { Expression tmp = binaryOperatorExpression.Left; binaryOperatorExpression.Left = binaryOperatorExpression.Right; binaryOperatorExpression.Right = tmp; } if (IsNullLiteralExpression(binaryOperatorExpression.Right)) { if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) { binaryOperatorExpression.Op = BinaryOperatorType.ReferenceEquality; } else { binaryOperatorExpression.Op = BinaryOperatorType.ReferenceInequality; } } } return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data); }
public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { bool lhs = binaryOperatorExpression.Left.AcceptVisitor(this, data) == SymbolDefined; bool rhs = binaryOperatorExpression.Right.AcceptVisitor(this, data) == SymbolDefined; bool result; switch (binaryOperatorExpression.Op) { case BinaryOperatorType.LogicalAnd: result = lhs && rhs; break; case BinaryOperatorType.LogicalOr: result = lhs || rhs; break; case BinaryOperatorType.Equality: result = lhs == rhs; break; case BinaryOperatorType.InEquality: result = lhs != rhs; break; default: return null; } return result ? SymbolDefined : null; }
public virtual object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data); }
void ConjunctionExpr( #line 1795 "VBNET.ATG" out Expression outExpr) { #line 1797 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; NotExpr( #line 1800 "VBNET.ATG" out outExpr); while (la.kind == 47 || la.kind == 48) { if (la.kind == 47) { lexer.NextToken(); #line 1803 "VBNET.ATG" op = BinaryOperatorType.BitwiseAnd; } else { lexer.NextToken(); #line 1804 "VBNET.ATG" op = BinaryOperatorType.LogicalAnd; } NotExpr( #line 1806 "VBNET.ATG" out expr); #line 1806 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
void MultiplicativeExpr( #line 2304 "Frames/cs.ATG" ref Expression outExpr) { #line 2306 "Frames/cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; while (la.kind == 6 || la.kind == 7 || la.kind == 8) { if (la.kind == 6) { lexer.NextToken(); #line 2312 "Frames/cs.ATG" op = BinaryOperatorType.Multiply; } else if (la.kind == 7) { lexer.NextToken(); #line 2313 "Frames/cs.ATG" op = BinaryOperatorType.Divide; } else { lexer.NextToken(); #line 2314 "Frames/cs.ATG" op = BinaryOperatorType.Modulus; } UnaryExpr( #line 2316 "Frames/cs.ATG" out expr); #line 2316 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
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; } }
void ExclusiveOrExpr( #line 2211 "Frames/cs.ATG" ref Expression outExpr) { #line 2212 "Frames/cs.ATG" Expression expr; AndExpr( #line 2214 "Frames/cs.ATG" ref outExpr); while (la.kind == 30) { lexer.NextToken(); UnaryExpr( #line 2214 "Frames/cs.ATG" out expr); AndExpr( #line 2214 "Frames/cs.ATG" ref expr); #line 2214 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr); } }
void ShiftExpr( #line 1846 "VBNET.ATG" out Expression outExpr) { #line 1848 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConcatenationExpr( #line 1851 "VBNET.ATG" out outExpr); while (la.kind == 32 || la.kind == 33) { if (la.kind == 32) { lexer.NextToken(); #line 1854 "VBNET.ATG" op = BinaryOperatorType.ShiftLeft; } else { lexer.NextToken(); #line 1855 "VBNET.ATG" op = BinaryOperatorType.ShiftRight; } ConcatenationExpr( #line 1857 "VBNET.ATG" out expr); #line 1857 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
void ExponentiationExpr( #line 1929 "VBNET.ATG" out Expression outExpr) { #line 1930 "VBNET.ATG" Expression expr; SimpleExpr( #line 1932 "VBNET.ATG" out outExpr); while (la.kind == 20) { lexer.NextToken(); SimpleExpr( #line 1932 "VBNET.ATG" out expr); #line 1932 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr); } }
void ConditionalAndExpr( #line 2199 "Frames/cs.ATG" ref Expression outExpr) { #line 2200 "Frames/cs.ATG" Expression expr; InclusiveOrExpr( #line 2202 "Frames/cs.ATG" ref outExpr); while (la.kind == 25) { lexer.NextToken(); UnaryExpr( #line 2202 "Frames/cs.ATG" out expr); InclusiveOrExpr( #line 2202 "Frames/cs.ATG" ref expr); #line 2202 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr); } }
void IntegerDivisionExpr( #line 1888 "VBNET.ATG" out Expression outExpr) { #line 1889 "VBNET.ATG" Expression expr; MultiplicativeExpr( #line 1891 "VBNET.ATG" out outExpr); while (la.kind == 15) { lexer.NextToken(); MultiplicativeExpr( #line 1891 "VBNET.ATG" out expr); #line 1891 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr); } }
void MultiplicativeExpr( #line 1894 "VBNET.ATG" out Expression outExpr) { #line 1896 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; UnaryExpr( #line 1899 "VBNET.ATG" out outExpr); while (la.kind == 14 || la.kind == 22) { if (la.kind == 22) { lexer.NextToken(); #line 1902 "VBNET.ATG" op = BinaryOperatorType.Multiply; } else { lexer.NextToken(); #line 1903 "VBNET.ATG" op = BinaryOperatorType.Divide; } UnaryExpr( #line 1905 "VBNET.ATG" out expr); #line 1905 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
void ModuloExpr( #line 1882 "VBNET.ATG" out Expression outExpr) { #line 1883 "VBNET.ATG" Expression expr; IntegerDivisionExpr( #line 1885 "VBNET.ATG" out outExpr); while (la.kind == 140) { lexer.NextToken(); IntegerDivisionExpr( #line 1885 "VBNET.ATG" out expr); #line 1885 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr); } }
void AdditiveExpr( #line 1867 "VBNET.ATG" out Expression outExpr) { #line 1869 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ModuloExpr( #line 1872 "VBNET.ATG" out outExpr); while (la.kind == 18 || la.kind == 19) { if (la.kind == 19) { lexer.NextToken(); #line 1875 "VBNET.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); #line 1876 "VBNET.ATG" op = BinaryOperatorType.Subtract; } ModuloExpr( #line 1878 "VBNET.ATG" out expr); #line 1878 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
void ConcatenationExpr( #line 1861 "VBNET.ATG" out Expression outExpr) { #line 1862 "VBNET.ATG" Expression expr; AdditiveExpr( #line 1864 "VBNET.ATG" out outExpr); while (la.kind == 13) { lexer.NextToken(); AdditiveExpr( #line 1864 "VBNET.ATG" out expr); #line 1864 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr); } }
void ConditionalOrExpr( #line 2193 "Frames/cs.ATG" ref Expression outExpr) { #line 2194 "Frames/cs.ATG" Expression expr; ConditionalAndExpr( #line 2196 "Frames/cs.ATG" ref outExpr); while (la.kind == 26) { lexer.NextToken(); UnaryExpr( #line 2196 "Frames/cs.ATG" out expr); ConditionalAndExpr( #line 2196 "Frames/cs.ATG" ref expr); #line 2196 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr); } }
public void VisitExpression (BinaryOperatorExpression expression, MethodProperties meth) { if(((BinaryOperatorExpression)expression).Op==BinaryOperatorType.LogicalAnd||((BinaryOperatorExpression)expression).Op==BinaryOperatorType.LogicalOr) { meth.CyclometricComplexity++; VisitExpression(((BinaryOperatorExpression)expression).Left , meth); VisitExpression(((BinaryOperatorExpression)expression).Right, meth); } }
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; } }
void EqualityExpr( #line 2223 "Frames/cs.ATG" ref Expression outExpr) { #line 2225 "Frames/cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; RelationalExpr( #line 2229 "Frames/cs.ATG" ref outExpr); while (la.kind == 33 || la.kind == 34) { if (la.kind == 34) { lexer.NextToken(); #line 2232 "Frames/cs.ATG" op = BinaryOperatorType.InEquality; } else { lexer.NextToken(); #line 2233 "Frames/cs.ATG" op = BinaryOperatorType.Equality; } UnaryExpr( #line 2235 "Frames/cs.ATG" out expr); RelationalExpr( #line 2235 "Frames/cs.ATG" ref expr); #line 2235 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
void InclusiveOrExpr( #line 2205 "Frames/cs.ATG" ref Expression outExpr) { #line 2206 "Frames/cs.ATG" Expression expr; ExclusiveOrExpr( #line 2208 "Frames/cs.ATG" ref outExpr); while (la.kind == 29) { lexer.NextToken(); UnaryExpr( #line 2208 "Frames/cs.ATG" out expr); ExclusiveOrExpr( #line 2208 "Frames/cs.ATG" ref expr); #line 2208 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr); } }
void ShiftExpr( #line 2271 "Frames/cs.ATG" ref Expression outExpr) { #line 2273 "Frames/cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; AdditiveExpr( #line 2277 "Frames/cs.ATG" ref outExpr); while (la.kind == 37 || #line 2280 "Frames/cs.ATG" IsShiftRight()) { if (la.kind == 37) { lexer.NextToken(); #line 2279 "Frames/cs.ATG" op = BinaryOperatorType.ShiftLeft; } else { Expect(22); Expect(22); #line 2281 "Frames/cs.ATG" op = BinaryOperatorType.ShiftRight; } UnaryExpr( #line 2284 "Frames/cs.ATG" out expr); AdditiveExpr( #line 2284 "Frames/cs.ATG" ref expr); #line 2284 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
void AndExpr( #line 2217 "Frames/cs.ATG" ref Expression outExpr) { #line 2218 "Frames/cs.ATG" Expression expr; EqualityExpr( #line 2220 "Frames/cs.ATG" ref outExpr); while (la.kind == 28) { lexer.NextToken(); UnaryExpr( #line 2220 "Frames/cs.ATG" out expr); EqualityExpr( #line 2220 "Frames/cs.ATG" ref expr); #line 2220 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr); } }
void ComparisonExpr( #line 1819 "VBNET.ATG" out Expression outExpr) { #line 1821 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( #line 1824 "VBNET.ATG" out outExpr); while (StartOf(33)) { switch (la.kind) { case 28: { lexer.NextToken(); #line 1827 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 27: { lexer.NextToken(); #line 1828 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 31: { lexer.NextToken(); #line 1829 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 30: { lexer.NextToken(); #line 1830 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 29: { lexer.NextToken(); #line 1831 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } case 10: { lexer.NextToken(); #line 1832 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 136: { lexer.NextToken(); #line 1833 "VBNET.ATG" op = BinaryOperatorType.Like; break; } case 131: { lexer.NextToken(); #line 1834 "VBNET.ATG" op = BinaryOperatorType.ReferenceEquality; break; } case 132: { lexer.NextToken(); #line 1835 "VBNET.ATG" op = BinaryOperatorType.ReferenceInequality; break; } } if (StartOf(34)) { ShiftExpr( #line 1838 "VBNET.ATG" out expr); #line 1838 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else if (la.kind == 150) { lexer.NextToken(); ShiftExpr( #line 1841 "VBNET.ATG" out expr); #line 1841 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not)); } else SynErr(263); } }
void RelationalExpr( #line 2239 "Frames/cs.ATG" ref Expression outExpr) { #line 2241 "Frames/cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( #line 2246 "Frames/cs.ATG" ref outExpr); while (StartOf(37)) { if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); #line 2248 "Frames/cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); #line 2249 "Frames/cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); #line 2250 "Frames/cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); #line 2251 "Frames/cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(215); UnaryExpr( #line 2253 "Frames/cs.ATG" out expr); ShiftExpr( #line 2254 "Frames/cs.ATG" ref expr); #line 2255 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( #line 2258 "Frames/cs.ATG" out type, false, false); if ( #line 2259 "Frames/cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2260 "Frames/cs.ATG" ref type); } #line 2261 "Frames/cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( #line 2263 "Frames/cs.ATG" out type, false, false); if ( #line 2264 "Frames/cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2265 "Frames/cs.ATG" ref type); } #line 2266 "Frames/cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(216); } } }
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); }
void AdditiveExpr( #line 2288 "Frames/cs.ATG" ref Expression outExpr) { #line 2290 "Frames/cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; MultiplicativeExpr( #line 2294 "Frames/cs.ATG" ref outExpr); while (la.kind == 4 || la.kind == 5) { if (la.kind == 4) { lexer.NextToken(); #line 2297 "Frames/cs.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); #line 2298 "Frames/cs.ATG" op = BinaryOperatorType.Subtract; } UnaryExpr( #line 2300 "Frames/cs.ATG" out expr); MultiplicativeExpr( #line 2300 "Frames/cs.ATG" ref expr); #line 2300 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } }
public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { base.VisitBinaryOperatorExpression(binaryOperatorExpression, data); if (IsEmptyStringLiteral(binaryOperatorExpression.Right)) { if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) { ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Left)); } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) { ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Left), UnaryOperatorType.Not)); } } else if (IsEmptyStringLiteral(binaryOperatorExpression.Left)) { if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) { ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Right)); } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) { ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Right), UnaryOperatorType.Not)); } } return null; }
public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { Debug.Assert((binaryOperatorExpression != null)); Debug.Assert((binaryOperatorExpression.Left != null)); Debug.Assert((binaryOperatorExpression.Right != null)); binaryOperatorExpression.Left.AcceptVisitor(this, data); return binaryOperatorExpression.Right.AcceptVisitor(this, data); }
public sealed override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) { this.BeginVisit(binaryOperatorExpression); object result = this.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data); this.EndVisit(binaryOperatorExpression); return result; }