PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/CSEdit/CSParse/Parser/Nodes/Using.cs

https://bitbucket.org/floAr/personal
C# | 37 lines | 31 code | 6 blank | 0 comment | 2 complexity | 51fdcf85296c18ea7df980c32ed63720 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace CSParse
  6. {
  7. public class UsingNode : ObjectNode, IVisitable
  8. {
  9. public override NodeType NodeType { get { return NodeType.Using; } }
  10. public Reference Name { get; set; }
  11. public string Alias { get; set; }
  12. public UsingNode()
  13. {
  14. }
  15. internal override void ToCode(StringBuilder builder, int nestLevel)
  16. {
  17. if (this.Alias != null)
  18. {
  19. AppendLine(builder, nestLevel, string.Format("using {0}={1};", this.Alias, this.Name));
  20. }
  21. else
  22. {
  23. AppendLine(builder, nestLevel, string.Format("using {0};", this.Name));
  24. }
  25. }
  26. void IVisitable.Visit(Visitor visitor)
  27. {
  28. visitor.VisitUsing(this);
  29. }
  30. }
  31. }