File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -20,37 +20,35 @@ public enum Instancing
20
20
21
21
public class AttributeNode : IEquatable < AttributeNode >
22
22
{
23
- private readonly string _name ;
24
23
private readonly IList < string > _values ;
25
24
26
25
public AttributeNode ( VBAParser . AttributeStmtContext context )
27
26
{
28
27
Context = context ;
28
+ Name = Context ? . attributeName ( ) . GetText ( ) ?? String . Empty ;
29
+ _values = Context ? . attributeValue ( ) . Select ( a => a . GetText ( ) ) . ToList ( ) ?? new List < string > ( ) ;
29
30
}
30
31
31
32
public AttributeNode ( string name , IEnumerable < string > values )
32
33
{
33
- _name = name ;
34
+ Name = name ;
34
35
_values = values . ToList ( ) ;
35
36
}
36
37
37
38
public VBAParser . AttributeStmtContext Context { get ; }
38
39
39
- public string Name => Context ? . attributeName ( ) . GetText ( ) ?? _name ;
40
-
40
+ public string Name { get ; }
41
+
41
42
public void AddValue ( string value )
42
43
{
43
- _values ? . Add ( value ) ;
44
+ _values . Add ( value ) ;
44
45
}
45
46
46
- public IReadOnlyList < string > Values
47
- {
48
- get { return Context ? . attributeValue ( ) . Select ( a => a . GetText ( ) ) . ToArray ( ) ?? _values . ToArray ( ) ; }
49
- }
47
+ public IReadOnlyCollection < string > Values => _values . AsReadOnly ( ) ;
50
48
51
49
public bool HasValue ( string value )
52
50
{
53
- return Values . Any ( item => item . Equals ( value , StringComparison . OrdinalIgnoreCase ) ) ;
51
+ return _values . Any ( item => item . Equals ( value , StringComparison . OrdinalIgnoreCase ) ) ;
54
52
}
55
53
56
54
public bool Equals ( AttributeNode other )
You can’t perform that action at this time.
0 commit comments