// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) using System; using System.Collections.Generic; namespace ICSharpCode.NRefactory.VB.Ast { public class BinaryOperatorExpression : Expression { public readonly static Role LeftExpressionRole = new Role("Left"); public readonly static Role OperatorRole = new Role("Operator"); public readonly static Role RightExpressionRole = new Role("Right"); public BinaryOperatorExpression(Expression left, BinaryOperatorType type, Expression right) { AddChild(left, LeftExpressionRole); AddChild(right, RightExpressionRole); Operator = type; } public Expression Left { get { return GetChildByRole(LeftExpressionRole); } set { SetChildByRole(LeftExpressionRole, value); } } public BinaryOperatorType Operator { get; set; } public Expression Right { get { return GetChildByRole(RightExpressionRole); } set { SetChildByRole(RightExpressionRole, value); } } protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match) { throw new NotImplementedException(); } public override S AcceptVisitor(IAstVisitor visitor, T data) { return visitor.VisitBinaryOperatorExpression(this, data); } } public enum BinaryOperatorType { None, /// '&' in C#, 'And' in VB. BitwiseAnd, /// '|' in C#, 'Or' in VB. BitwiseOr, /// '&&' in C#, 'AndAlso' in VB. LogicalAnd, /// '||' in C#, 'OrElse' in VB. LogicalOr, /// '^' in C#, 'Xor' in VB. ExclusiveOr, /// > GreaterThan, /// >= GreaterThanOrEqual, /// '==' in C#, '=' in VB. Equality, /// '!=' in C#, '<>' in VB. InEquality, /// < LessThan, /// <= LessThanOrEqual, /// + Add, /// - Subtract, /// * Multiply, /// / Divide, /// '%' in C#, 'Mod' in VB. Modulus, /// VB-only: \ DivideInteger, /// VB-only: ^ Power, /// VB-only: & Concat, /// C#: << ShiftLeft, /// C#: >> ShiftRight, /// VB-only: Is ReferenceEquality, /// VB-only: IsNot ReferenceInequality, /// VB-only: Like Like, /// /// C#: ?? /// VB: IF(x, y) /// NullCoalescing, /// VB-only: ! DictionaryAccess } }