File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Rubberduck.Parsing/Binding Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ with a parameter list that cannot accept any parameters and an <argument-list> t
127
127
bool isVariable = lExpression . Classification == ExpressionClassification . Variable ;
128
128
bool propertyWithParameters = lExpression . Classification == ExpressionClassification . Property && ! ( ( IParameterizedDeclaration ) lExpression . ReferencedDeclaration ) . Parameters . Any ( ) ;
129
129
bool functionWithParameters = lExpression . Classification == ExpressionClassification . Function && ! ( ( IParameterizedDeclaration ) lExpression . ReferencedDeclaration ) . Parameters . Any ( ) ;
130
- if ( isVariable || ( ( propertyWithParameters || functionWithParameters ) && _argumentList . HasArguments ) )
130
+ if ( lExpression . ReferencedDeclaration != null && ( isVariable || ( ( propertyWithParameters || functionWithParameters ) && _argumentList . HasArguments ) ) )
131
131
{
132
132
IBoundExpression boundExpression = null ;
133
133
var asTypeName = lExpression . ReferencedDeclaration . AsTypeName ;
Original file line number Diff line number Diff line change @@ -112,6 +112,32 @@ End Function
112
112
}
113
113
}
114
114
115
+ [ TestCategory ( "Resolver" ) ]
116
+ [ TestMethod ]
117
+ public void JaggedArrayReference_DoesNotBlowUp ( )
118
+ {
119
+ // see https://github.com/rubberduck-vba/Rubberduck/issues/3098
120
+ var code = @"Option Explicit
121
+
122
+ Public Sub Test()
123
+ Dim varTemp() As Variant
124
+
125
+ ReDim varTemp(0)
126
+
127
+ varTemp(0) = Array(0)
128
+ varTemp(0)(0) = Array(0)
129
+
130
+ Debug.Print varTemp(0)(0)
131
+ End Sub
132
+ " ;
133
+
134
+ using ( var state = Resolve ( code ) )
135
+ {
136
+ var declaration = state . AllUserDeclarations . Single ( item => item . DeclarationType == DeclarationType . Variable && item . IdentifierName == "varTemp" ) ;
137
+ Assert . IsTrue ( declaration . IsArray ) ;
138
+ }
139
+ }
140
+
115
141
[ TestCategory ( "Resolver" ) ]
116
142
[ TestMethod ]
117
143
public void OptionalParameterDefaultConstValue_IsReferenceToDeclaredConst ( )
You can’t perform that action at this time.
0 commit comments