Skip to content

Commit 94b8f77

Browse files
committed
Chang "True" to Tokens.True in Attributes methods
Also fixed a bug in HasHiddenMemberAttribute.
1 parent f9b81cb commit 94b8f77

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

Rubberduck.Parsing/Symbols/Attributes.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ public void AddHiddenMemberAttribute(string identifierName)
141141

142142
public bool HasHiddenMemberAttribute(string identifierName, out AttributeNode attribute)
143143
{
144-
attribute = this.SingleOrDefault(a => a.HasValue("-4") &&
145-
a.Name.Equals($"{identifierName}.VB_UserMemId", StringComparison.OrdinalIgnoreCase));
144+
attribute = this.SingleOrDefault(a => a.HasValue("40")
145+
&& a.Name.Equals($"{identifierName}.VB_UserMemId", StringComparison.OrdinalIgnoreCase));
146146
return attribute != null;
147147
}
148148

@@ -160,6 +160,13 @@ public void AddEvaluateMemberAttribute(string identifierName)
160160
Add(new AttributeNode(identifierName + ".VB_UserMemId", new[] { "-5" }));
161161
}
162162

163+
public bool HasEvaluateMemberAttribute(string identifierName, out AttributeNode attribute)
164+
{
165+
attribute = this.SingleOrDefault(a => a.HasValue("-5")
166+
&& a.Name.Equals($"{identifierName}.VB_UserMemId", StringComparison.OrdinalIgnoreCase));
167+
return attribute != null;
168+
}
169+
163170
public void AddMemberDescriptionAttribute(string identifierName, string description)
164171
{
165172
Add(new AttributeNode(identifierName + ".VB_Description", new[] {description}));
@@ -176,7 +183,7 @@ public bool HasMemberDescriptionAttribute(string identifierName, out AttributeNo
176183
/// </summary>
177184
public void AddPredeclaredIdTypeAttribute()
178185
{
179-
Add(new AttributeNode("VB_PredeclaredId", new[] {"True"}));
186+
Add(new AttributeNode("VB_PredeclaredId", new[] {Tokens.True}));
180187
}
181188

182189
public AttributeNode PredeclaredIdAttribute
@@ -197,7 +204,7 @@ public AttributeNode ExposedAttribute
197204

198205
public bool HasPredeclaredIdAttribute(out AttributeNode attribute)
199206
{
200-
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_PredeclaredId", StringComparison.OrdinalIgnoreCase) && a.HasValue("True"));
207+
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_PredeclaredId", StringComparison.OrdinalIgnoreCase) && a.HasValue(Tokens.True));
201208
return attribute != null;
202209
}
203210

@@ -206,23 +213,23 @@ public bool HasPredeclaredIdAttribute(out AttributeNode attribute)
206213
/// </summary>
207214
public void AddGlobalClassAttribute()
208215
{
209-
Add(new AttributeNode("VB_GlobalNamespace", new[] {"True"}));
216+
Add(new AttributeNode("VB_GlobalNamespace", new[] {Tokens.True}));
210217
}
211218

212219
public bool HasGlobalAttribute(out AttributeNode attribute)
213220
{
214-
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_GlobalNamespace", StringComparison.OrdinalIgnoreCase) && a.HasValue("True"));
221+
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_GlobalNamespace", StringComparison.OrdinalIgnoreCase) && a.HasValue(Tokens.True));
215222
return attribute != null;
216223
}
217224

218225
public void AddExposedClassAttribute()
219226
{
220-
Add(new AttributeNode("VB_Exposed", new[] { "True" }));
227+
Add(new AttributeNode("VB_Exposed", new[] { Tokens.True }));
221228
}
222229

223230
public bool HasExposedAttribute(out AttributeNode attribute)
224231
{
225-
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_Exposed", StringComparison.OrdinalIgnoreCase) && a.HasValue("True"));
232+
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_Exposed", StringComparison.OrdinalIgnoreCase) && a.HasValue(Tokens.True));
226233
return attribute != null;
227234
}
228235

@@ -231,12 +238,12 @@ public bool HasExposedAttribute(out AttributeNode attribute)
231238
/// </summary>
232239
public void AddExtensibleClassAttribute()
233240
{
234-
Add(new AttributeNode("VB_Customizable", new[] { "True" }));
241+
Add(new AttributeNode("VB_Customizable", new[] { Tokens.True }));
235242
}
236243

237244
public bool HasExtensibleAttribute(out AttributeNode attribute)
238245
{
239-
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_Customizable", StringComparison.OrdinalIgnoreCase) && a.HasValue("True"));
246+
attribute = this.SingleOrDefault(a => a.Name.Equals("VB_Customizable", StringComparison.OrdinalIgnoreCase) && a.HasValue(Tokens.True));
240247
return attribute != null;
241248
}
242249

0 commit comments

Comments
 (0)