PageRenderTime 31ms CodeModel.GetById 15ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 1ms

/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/BinaryOperatorExpression.cs

http://github.com/icsharpcode/ILSpy
C# | 110 lines | 64 code | 15 blank | 31 comment | 0 complexity | 443a48d1c754c6c5a26484c414bde829 MD5 | raw file
  1// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
  3
  4using System;
  5using System.Collections.Generic;
  6
  7namespace ICSharpCode.NRefactory.VB.Ast
  8{
  9	public class BinaryOperatorExpression : Expression
 10	{
 11		public readonly static Role<Expression> LeftExpressionRole = new Role<Expression>("Left");
 12		public readonly static Role<VBTokenNode> OperatorRole = new Role<VBTokenNode>("Operator");
 13		public readonly static Role<Expression> RightExpressionRole = new Role<Expression>("Right");
 14		
 15		public BinaryOperatorExpression(Expression left, BinaryOperatorType type, Expression right)
 16		{
 17			AddChild(left, LeftExpressionRole);
 18			AddChild(right, RightExpressionRole);
 19			Operator = type;
 20		}
 21		
 22		public Expression Left {
 23			get { return GetChildByRole(LeftExpressionRole); }
 24			set { SetChildByRole(LeftExpressionRole, value); }
 25		}
 26		
 27		public BinaryOperatorType Operator { get; set; }
 28		
 29		public Expression Right {
 30			get { return GetChildByRole(RightExpressionRole); }
 31			set { SetChildByRole(RightExpressionRole, value); }
 32		}
 33		
 34		protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 35		{
 36			throw new NotImplementedException();
 37		}
 38		
 39		public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 40		{
 41			return visitor.VisitBinaryOperatorExpression(this, data);
 42		}
 43	}
 44	
 45		public enum BinaryOperatorType
 46	{
 47		None,
 48		
 49		/// <summary>'&amp;' in C#, 'And' in VB.</summary>
 50		BitwiseAnd,
 51		/// <summary>'|' in C#, 'Or' in VB.</summary>
 52		BitwiseOr,
 53		/// <summary>'&amp;&amp;' in C#, 'AndAlso' in VB.</summary>
 54		LogicalAnd,
 55		/// <summary>'||' in C#, 'OrElse' in VB.</summary>
 56		LogicalOr,
 57		/// <summary>'^' in C#, 'Xor' in VB.</summary>
 58		ExclusiveOr,
 59		
 60		/// <summary>&gt;</summary>
 61		GreaterThan,
 62		/// <summary>&gt;=</summary>
 63		GreaterThanOrEqual,
 64		/// <summary>'==' in C#, '=' in VB.</summary>
 65		Equality,
 66		/// <summary>'!=' in C#, '&lt;&gt;' in VB.</summary>
 67		InEquality,
 68		/// <summary>&lt;</summary>
 69		LessThan,
 70		/// <summary>&lt;=</summary>
 71		LessThanOrEqual,
 72		
 73		/// <summary>+</summary>
 74		Add,
 75		/// <summary>-</summary>
 76		Subtract,
 77		/// <summary>*</summary>
 78		Multiply,
 79		/// <summary>/</summary>
 80		Divide,
 81		/// <summary>'%' in C#, 'Mod' in VB.</summary>
 82		Modulus,
 83		/// <summary>VB-only: \</summary>
 84		DivideInteger,
 85		/// <summary>VB-only: ^</summary>
 86		Power,
 87		/// <summary>VB-only: &amp;</summary>
 88		Concat,
 89		
 90		/// <summary>C#: &lt;&lt;</summary>
 91		ShiftLeft,
 92		/// <summary>C#: &gt;&gt;</summary>
 93		ShiftRight,
 94		/// <summary>VB-only: Is</summary>
 95		ReferenceEquality,
 96		/// <summary>VB-only: IsNot</summary>
 97		ReferenceInequality,
 98		
 99		/// <summary>VB-only: Like</summary>
100		Like,
101		/// <summary>
102		/// 	C#: ??
103		/// 	VB: IF(x, y)
104		/// </summary>
105		NullCoalescing,
106		
107		/// <summary>VB-only: !</summary>
108		DictionaryAccess
109	}
110}