mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-20 13:55:14 +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:
parent
1da1dc5379
commit
d93a2812bf
|
@ -3,5 +3,5 @@ DIM SHARED BuildNum AS STRING
|
||||||
Version$ = "1.000"
|
Version$ = "1.000"
|
||||||
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
|
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
|
||||||
'integer. If you make a change, update the date and increase the id!
|
'integer. If you make a change, update the date and increase the id!
|
||||||
BuildNum$ = "20160820/46"
|
BuildNum$ = "20160828/47"
|
||||||
|
|
||||||
|
|
|
@ -7117,9 +7117,10 @@ DO
|
||||||
IF Error_Happened THEN GOTO errmes
|
IF Error_Happened THEN GOTO errmes
|
||||||
LOOP
|
LOOP
|
||||||
'unknown variable
|
'unknown variable
|
||||||
IF a THEN a$ = "Array not defined": GOTO errmes
|
IF a THEN a$ = "Array '" + n$ + "' not defined": GOTO errmes
|
||||||
'create variable
|
'create variable
|
||||||
IF LEN(s$) THEN typ$ = s$ ELSE typ$ = t$
|
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, "")
|
retval = dim2(n$, typ$, method, "")
|
||||||
IF Error_Happened THEN GOTO errmes
|
IF Error_Happened THEN GOTO errmes
|
||||||
'note: variable created!
|
'note: variable created!
|
||||||
|
@ -14812,7 +14813,7 @@ FUNCTION evaluate$ (a2$, typ AS LONG)
|
||||||
NEXT
|
NEXT
|
||||||
fakee$ = "10": FOR i2 = 2 TO nume: fakee$ = fakee$ + sp + "," + sp + "10": 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 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
|
IF Error_Happened THEN EXIT FUNCTION
|
||||||
olddimstatic = dimstatic
|
olddimstatic = dimstatic
|
||||||
method = 1
|
method = 1
|
||||||
|
@ -15033,7 +15034,7 @@ FUNCTION evaluate$ (a2$, typ AS LONG)
|
||||||
LOOP
|
LOOP
|
||||||
|
|
||||||
IF Debug THEN PRINT #9, "CREATING VARIABLE:" + x$
|
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, "")
|
retval = dim2(x$, typ$, 1, "")
|
||||||
IF Error_Happened THEN EXIT FUNCTION
|
IF Error_Happened THEN EXIT FUNCTION
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue