PageRenderTime 15ms CodeModel.GetById 6ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/icsharpcode/ILSpy
C# | 46 lines | 33 code | 8 blank | 5 comment | 4 complexity | f76939903c5fd9dbf6816ec07feddbf6 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	/// <summary>
10	/// Identifier As Type = Expression
11	/// </summary>
12	public class VariableInitializer : AstNode
13	{
14		public static readonly Role<VariableInitializer> VariableInitializerRole = new Role<VariableInitializer>("VariableInitializer");
15		
16		public VariableIdentifier Identifier {
17			get { return GetChildByRole(VariableIdentifier.VariableIdentifierRole); }
18			set { SetChildByRole(VariableIdentifier.VariableIdentifierRole, value); }
19		}
20		
21		public AstType Type {
22			get { return GetChildByRole(Roles.Type); }
23			set { SetChildByRole(Roles.Type, value); }
24		}
25		
26		public VBTokenNode AssignToken {
27			get { return GetChildByRole (Roles.Assign); }
28		}
29		
30		public Expression Expression {
31			get { return GetChildByRole (Roles.Expression); }
32			set { SetChildByRole (Roles.Expression, value); }
33		}
34		
35		public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
36		{
37			return visitor.VisitVariableInitializer(this, data);
38		}
39		
40		protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
41		{
42			VariableInitializer o = other as VariableInitializer;
43			return o != null && this.Identifier.DoMatch(o.Identifier, match) && this.Type.DoMatch(o.Type, match) && this.Expression.DoMatch(o.Expression, match);
44		}
45	}
46}