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