/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/ExitStatement.cs

http://github.com/icsharpcode/ILSpy · C# · 55 lines · 41 code · 9 blank · 5 comment · 3 complexity · d2c268654f902f75cbb64682194b6176 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.IO;
  5. namespace ICSharpCode.NRefactory.VB.Ast
  6. {
  7. /// <summary>
  8. /// Exit ( Do | For | While | Select | Sub | Function | Property | Try )
  9. /// </summary>
  10. public class ExitStatement : Statement
  11. {
  12. public static readonly Role<VBTokenNode> ExitKindTokenRole = new Role<VBTokenNode>("ExitKindToken");
  13. public ExitKind ExitKind { get; set; }
  14. public VBTokenNode ExitToken {
  15. get { return GetChildByRole (Roles.Keyword); }
  16. }
  17. public VBTokenNode ExitKindToken {
  18. get { return GetChildByRole (ExitKindTokenRole); }
  19. }
  20. public ExitStatement(ExitKind kind)
  21. {
  22. this.ExitKind = kind;
  23. }
  24. public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
  25. {
  26. return visitor.VisitExitStatement(this, data);
  27. }
  28. protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
  29. {
  30. ExitStatement o = other as ExitStatement;
  31. return o != null && this.ExitKind == o.ExitKind;
  32. }
  33. }
  34. public enum ExitKind
  35. {
  36. None,
  37. Sub,
  38. Function,
  39. Property,
  40. Do,
  41. For,
  42. While,
  43. Select,
  44. Try
  45. }
  46. }