File tree Expand file tree Collapse file tree 3 files changed +35
-12
lines changed
Rubberduck.Parsing/Symbols
RubberduckTests/Inspections Expand file tree Collapse file tree 3 files changed +35
-12
lines changed Original file line number Diff line number Diff line change @@ -349,13 +349,24 @@ private static string CorrectlyFormatedDescription(string literalDescription)
349
349
/// </summary>
350
350
public bool IsEnumeratorMember => _attributes . Any ( a => a . Name . EndsWith ( "VB_UserMemId" ) && a . Values . Contains ( "-4" ) ) ;
351
351
352
- public virtual bool IsObject =>
353
- AsTypeName == Tokens . Object || (
354
- AsTypeDeclaration ? . DeclarationType . HasFlag ( DeclarationType . ClassModule ) ??
355
- ! AsTypeIsBaseType
356
- && ! IsArray
357
- && ! DeclarationType . HasFlag ( DeclarationType . UserDefinedType )
358
- && ! DeclarationType . HasFlag ( DeclarationType . Enumeration ) ) ;
352
+ public virtual bool IsObject
353
+ {
354
+ get
355
+ {
356
+ if ( AsTypeName == Tokens . Object ||
357
+ ( AsTypeDeclaration ? . DeclarationType . HasFlag ( DeclarationType . ClassModule ) ?? false ) )
358
+ {
359
+ return true ;
360
+ }
361
+
362
+ var result = ! ( AsTypeIsBaseType ||
363
+ IsArray ||
364
+ DeclarationType . HasFlag ( DeclarationType . UserDefinedType ) ||
365
+ DeclarationType . HasFlag ( DeclarationType . Enumeration ) ) ;
366
+
367
+ return result ;
368
+ }
369
+ }
359
370
360
371
public void AddReference (
361
372
QualifiedModuleName module ,
Original file line number Diff line number Diff line change @@ -44,8 +44,20 @@ protected PropertyDeclaration(
44
44
attributes )
45
45
{ }
46
46
47
- public override bool IsObject =>
48
- base . IsObject || ( Parameters . OrderBy ( p => p . Selection ) . LastOrDefault ( ) ? . IsObject ?? false ) ;
47
+ public override bool IsObject
48
+ {
49
+ get
50
+ {
51
+ if ( base . IsObject )
52
+ {
53
+ return true ;
54
+ }
55
+
56
+ return ( DeclarationType == DeclarationType . PropertyLet ||
57
+ DeclarationType == DeclarationType . PropertySet ) &&
58
+ ( Parameters . OrderBy ( p => p . Selection ) . LastOrDefault ( ) ? . IsObject ?? false ) ;
59
+ }
60
+ }
49
61
50
62
/// <inheritdoc/>
51
63
protected abstract override bool Implements ( IInterfaceExposable member ) ;
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ public class ObjectVariableNotSetInspectionTests
13
13
{
14
14
[ Test ]
15
15
[ Category ( "Inspections" ) ]
16
- public void ObjectVariableNotSet_NotResultForBoolean ( )
16
+ public void ObjectVariableNotSet_NotResultForNonObjectPropertyGetWithObjectArgument ( )
17
17
{
18
18
var expectedResultCount = 0 ;
19
19
var input = @"
20
- Public Property Get Something( ) As Boolean
21
- Something = True
20
+ Public Property Get Foo(ByVal bar As Object ) As Boolean
21
+ Foo = True
22
22
End Property
23
23
" ;
24
24
AssertInputCodeYieldsExpectedInspectionResultCount ( input , expectedResultCount ) ;
You can’t perform that action at this time.
0 commit comments