mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-01 13:50:36 +00:00
Fix undefined variables in CONST expressions to trigger an error
Overall this is fairly straight forward, `evaluateconst$` has type information on the parameters for its expressions, but it's not actually checking that both parameters have a proper type. The result is that expressions with nonsense values such as undefined variable names end up just trying to use that nonsense value as an integer. Fixes: #177
This commit is contained in:
parent
47682e91c3
commit
59dd8d3c51
|
@ -23735,6 +23735,11 @@ FUNCTION evaluateconst$ (a2$, t AS LONG)
|
|||
'string/numeric mismatch?
|
||||
IF (btype(i) AND ISSTRING) <> (et AND ISSTRING) THEN Give_Error "Invalid CONST expression.11": EXIT FUNCTION
|
||||
|
||||
' The left and right operands needs to have valid types. They might not if
|
||||
' the user wrote something invalid like `1 OR OR 2`
|
||||
IF et = 0 THEN Give_Error "Invalid CONST expression.14": EXIT FUNCTION
|
||||
IF btype(i) = 0 THEN Give_Error "Invalid CONST expression.15": EXIT FUNCTION
|
||||
|
||||
IF et AND ISSTRING THEN
|
||||
IF o$ <> "+" THEN Give_Error "Invalid CONST expression.12": EXIT FUNCTION
|
||||
'concat strings
|
||||
|
|
Loading…
Reference in a new issue