Skip to content

Commit

Permalink
fbc: fix bad error recovery on BYREF intializer
Browse files Browse the repository at this point in the history
For example:
    Type UDT Extends Object
        Declare Constructor(Byval nop As Integer = 0)
    End Type
    Constructor UDT(Byval nop As Integer = 0)
    End Constructor

    Dim Byref As UDT u = UDT()
  • Loading branch information
jayrm committed Apr 23, 2023
1 parent 3457e4d commit 1d931e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Expand Up @@ -130,6 +130,7 @@ Version 1.10.0
- fbc: extend lifetime of temporary variables in WITH TYPE(...) expressions to the END WITH statement
- fbc: #cmdline "-r -rr -R -RR -o objfile ..." needs to restart the parser and handle changes in keeping the ASM file. In the case of '-o objfile' a major restart is needed since some initialization of filenames is done before parsing starts. By default the temporary ASM file was being kept even if #cmdline options indicate to keep it.
- sf.net #569: gfxlib2: GetMouse/SetMouse scaling problem in QB modes Screen 2 & 8 - adjust GetMouse/SetMouse by internal scanline_size
- fbc: fbc: fix bad error recovery on BYREF intializer. 'Dim Byref As UDT u = UDT()' would case compiler crash if UDT constructor argument optional


Version 1.09.0
Expand Down
7 changes: 7 additions & 0 deletions src/compiler/ast-node-arg.bas
Expand Up @@ -1029,6 +1029,12 @@ function astNewARG _
'' optional/default?
if( arg = NULL ) then
arg = hCreateOptArg( param )

'' still NULL? then hCreateOptArg() failed
if( arg = NULL ) then
function = NULL
exit function
end if
end if

if( dtype = FB_DATATYPE_INVALID ) then
Expand All @@ -1049,6 +1055,7 @@ function astNewARG _
else
errReportParam( parent->sym, parent->call.args+1, NULL, FB_ERRMSG_ILLEGALASSIGNMENT )
end if
function = NULL
exit function
end if
end if
Expand Down

0 comments on commit 1d931e6

Please sign in to comment.