Skip to content

Commit

Permalink
Dim Byref: Require an initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
dkl committed May 14, 2015
1 parent 4f39d87 commit e905911
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/compiler/error.bas
Expand Up @@ -400,7 +400,8 @@ declare function hMakeParamDesc _
@"Byref function result not set", _
@"Function result assignment outside of the function", _
@"Type mismatch in byref function result assignment", _
@"-asm att|intel option given, but not supported for this target (only x86 or x86_64)" _
@"-asm att|intel option given, but not supported for this target (only x86 or x86_64)", _
@"Reference not initialized" _
}


Expand Down
1 change: 1 addition & 0 deletions src/compiler/error.bi
Expand Up @@ -322,6 +322,7 @@ enum FB_ERRMSG
FB_ERRMSG_RESULTASSIGNOUTSIDEFUNCTION
FB_ERRMSG_TYPEMISMATCHINBYREFRESULTASSIGN
FB_ERRMSG_ASMOPTIONGIVENFORNONX86
FB_ERRMSG_MISSINGREFINIT

FB_ERRMSGS
end enum
Expand Down
6 changes: 6 additions & 0 deletions src/compiler/parser-decl-var.bas
Expand Up @@ -1608,6 +1608,12 @@ function cVarDecl _
end if
end if
else
if( symbIsRef( sym ) ) then
errReport( FB_ERRMSG_MISSINGREFINIT )
hSkipStmt( )
exit function
end if

'' default initialization
if( sym ) then
if( symbArrayHasUnknownBounds( sym ) ) then
Expand Down
2 changes: 1 addition & 1 deletion todo.txt
@@ -1,6 +1,6 @@
o Dim Byref
- Var Byref
- initializer required; same checks as for byref result assignments
- check initializer as for byref result assignments
- ref var's real dtype = pointer, matters at least when emitting/allocating
- implicit deref on access like for byref params
- extend temp var life-time like WITH
Expand Down

0 comments on commit e905911

Please sign in to comment.