Skip to content

Commit

Permalink
parser-decl-var: Fix crash after Redim array expression parsing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dkl committed Jun 2, 2014
1 parent 0d50e8e commit 12f1e2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/parser-decl-var.bas
Expand Up @@ -1025,7 +1025,7 @@ private function hIdxInParensOnlyExpr( ) as ASTNODE ptr
end function

private function hCheckDynamicArrayExpr( byval varexpr as ASTNODE ptr ) as ASTNODE ptr
if( astIsNIDXARRAY( varexpr ) ) then
if( varexpr andalso astIsNIDXARRAY( varexpr ) ) then
varexpr = astRemoveNIDXARRAY( varexpr )

if( astIsVAR( varexpr ) or astIsFIELD( varexpr ) ) then
Expand Down
7 changes: 7 additions & 0 deletions tests/dim/redim-expression-invalid.bas
@@ -0,0 +1,7 @@
' TEST_MODE : COMPILE_ONLY_FAIL

'' It looks like a REDIM with an expression to fbc (since there's a
'' keyword/identifier that's not followed by a '(' that would indicate the
'' array dimension list), but the expression parser will fail, since it's an
'' invalid expression, and the REDIM parser should handle that.
redim print foo

0 comments on commit 12f1e2d

Please sign in to comment.