/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. using System;
  4. using System.Collections.Generic;
  5. namespace ICSharpCode.NRefactory.VB.Ast
  6. {
  7. /// <summary>
  8. /// Identifier As Type = Expression
  9. /// </summary>
  10. public class VariableInitializer : AstNode
  11. {
  12. public static readonly Role<VariableInitializer> VariableInitializerRole = new Role<VariableInitializer>("VariableInitializer");
  13. public VariableIdentifier Identifier {
  14. get { return GetChildByRole(VariableIdentifier.VariableIdentifierRole); }
  15. set { SetChildByRole(VariableIdentifier.VariableIdentifierRole, value); }
  16. }
  17. public AstType Type {
  18. get { return GetChildByRole(Roles.Type); }
  19. set { SetChildByRole(Roles.Type, value); }
  20. }
  21. public VBTokenNode AssignToken {
  22. get { return GetChildByRole (Roles.Assign); }
  23. }
  24. public Expression Expression {
  25. get { return GetChildByRole (Roles.Expression); }
  26. set { SetChildByRole (Roles.Expression, value); }
  27. }
  28. public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
  29. {
  30. return visitor.VisitVariableInitializer(this, data);
  31. }
  32. protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
  33. {
  34. VariableInitializer o = other as VariableInitializer;
  35. return o != null && this.Identifier.DoMatch(o.Identifier, match) && this.Type.DoMatch(o.Type, match) && this.Expression.DoMatch(o.Expression, match);
  36. }
  37. }
  38. }