1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 17:00:26 +00:00

Fix OPTION _EXPLICIT ignoring variables created with SHARED in SUBs.

Also:
- When a "variable not defined" error is triggered, the expected type is now also reported.
This commit is contained in:
FellippeHeitor 2016-08-27 15:09:15 -03:00
parent 1da1dc5379
commit d93a2812bf
2 changed files with 5 additions and 4 deletions

View file

@ -3,5 +3,5 @@ DIM SHARED BuildNum AS STRING
Version$ = "1.000"
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
'integer. If you make a change, update the date and increase the id!
BuildNum$ = "20160820/46"
BuildNum$ = "20160828/47"

View file

@ -7117,9 +7117,10 @@ DO
IF Error_Happened THEN GOTO errmes
LOOP
'unknown variable
IF a THEN a$ = "Array not defined": GOTO errmes
IF a THEN a$ = "Array '" + n$ + "' not defined": GOTO errmes
'create variable
IF LEN(s$) THEN typ$ = s$ ELSE typ$ = t$
IF optionexplicit THEN a$ = "Variable '" + n$ + "' (" + symbol2fulltypename$(typ$) + ") not defined": GOTO errmes
retval = dim2(n$, typ$, method, "")
IF Error_Happened THEN GOTO errmes
'note: variable created!
@ -14812,7 +14813,7 @@ FUNCTION evaluate$ (a2$, typ AS LONG)
NEXT
fakee$ = "10": FOR i2 = 2 TO nume: fakee$ = fakee$ + sp + "," + sp + "10": NEXT
IF Debug THEN PRINT #9, "evaluate:creating undefined array using dim2(" + l$ + "," + dtyp$ + ",1," + fakee$ + ")"
IF optionexplicit THEN Give_Error "Array '" + l$ + "' not defined": EXIT FUNCTION
IF optionexplicit THEN Give_Error "Array '" + l$ + "' (" + symbol2fulltypename$(dtyp$) + ") not defined": EXIT FUNCTION
IF Error_Happened THEN EXIT FUNCTION
olddimstatic = dimstatic
method = 1
@ -15033,7 +15034,7 @@ FUNCTION evaluate$ (a2$, typ AS LONG)
LOOP
IF Debug THEN PRINT #9, "CREATING VARIABLE:" + x$
IF optionexplicit THEN Give_Error "Variable '" + x$ + "' not defined": EXIT FUNCTION
IF optionexplicit THEN Give_Error "Variable '" + x$ + "' (" + symbol2fulltypename$(typ$) + ") not defined": EXIT FUNCTION
retval = dim2(x$, typ$, 1, "")
IF Error_Happened THEN EXIT FUNCTION