/
RtClass.cs
78 lines (65 loc) · 2.13 KB
/
RtClass.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System.Collections.Generic;
using System.Linq;
using Reinforced.Typings.Ast.TypeNames;
namespace Reinforced.Typings.Ast
{
/// <summary>
/// AST node for TypeScript class
/// </summary>
public class RtClass : RtCompilationUnit, ITypeMember, IDecoratable
{
/// <inheritdoc />
public List<RtDecorator> Decorators { get; private set; }
/// <inheritdoc />
public RtJsdocNode Documentation { get; set; }
/// <inheritdoc />
public RtSimpleTypeName Name { get; set; }
/// <inheritdoc />
public List<RtSimpleTypeName> Implementees { get; private set; }
/// <inheritdoc />
public RtTypeName Extendee { get; set; }
/// <inheritdoc />
public List<RtNode> Members { get; private set; } //todo this needs to be sorted to be cross-platform, it's returning different order for Mono
/// <summary>
/// Constructs new instance of AST node
/// </summary>
public RtClass()
{
Members = new List<RtNode>();
Implementees = new List<RtSimpleTypeName>();
Decorators = new List<RtDecorator>();
}
/// <inheritdoc />
public override IEnumerable<RtNode> Children
{
get
{
yield return Documentation;
foreach (var rtDecorator in Decorators)
{
yield return rtDecorator;
}
yield return Name;
foreach (var implementee in Implementees)
{
yield return implementee;
}
yield return Extendee;
foreach (var rtMember in Members)
{
yield return rtMember;
}
}
}
/// <inheritdoc />
public override void Accept(IRtVisitor visitor)
{
visitor.Visit(this);
}
/// <inheritdoc />
public override void Accept<T>(IRtVisitor<T> visitor)
{
visitor.Visit(this);
}
}
}