From d93a2812bfaadcf6c3ea83bf569994709e613a8e Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 27 Aug 2016 15:09:15 -0300 Subject: [PATCH] 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. --- source/global/version.bas | 2 +- source/qb64.bas | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/global/version.bas b/source/global/version.bas index 310505b50..d1bf30e69 100644 --- a/source/global/version.bas +++ b/source/global/version.bas @@ -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" diff --git a/source/qb64.bas b/source/qb64.bas index 6b400569c..4a81453a6 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -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