1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-02 23:31:21 +00:00

Tries harder to prevent invalid values for watchpoints.

This commit is contained in:
FellippeHeitor 2021-09-18 20:33:57 -03:00
parent 3be8a806f8
commit cb050b2c0b

View file

@ -8464,21 +8464,46 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
MID$(v$, 1, 2) = op2$ + "="
GOTO StartWatchPointEval
END IF
op$ = "="
actualValue$ = _TRIM$(MID$(v$, 2))
CASE ">"
IF op2$ = "<" OR op2$ = ">" THEN
result = idemessagebox(dlgTitle$, "Invalid expression.\nYou can use =, <>, >, >=, < and <=", "#OK")
result = idemessagebox(dlgTitle$, "Invalid expression.\nYou can use =, <>, >, >=, <, <=, and a literal value", "#OK")
_KEYCLEAR
GOTO getNewValueInput
END IF
IF op2$ = "=" THEN
op$ = ">="
actualValue$ = _TRIM$(MID$(v$, 3))
ELSE
op$ = ">"
actualValue$ = _TRIM$(MID$(v$, 2))
END IF
CASE "<"
IF op2$ = ">" OR op2$ = "=" THEN
op$ = "<" + op2$
actualValue$ = _TRIM$(MID$(v$, 3))
ELSE
op$ = "<"
actualValue$ = _TRIM$(MID$(v$, 2))
END IF
CASE ELSE
result = idemessagebox(dlgTitle$, "Invalid expression.\nYou can use =, <>, >, >=, < and <=", "#OK")
result = idemessagebox(dlgTitle$, "Invalid expression.\nYou can use =, <>, >, >=, <, <=, and a literal value", "#OK")
_KEYCLEAR
GOTO getNewValueInput
END SELECT
END IF
END IF
IF INSTR(varType$, "STRING") = 0 THEN
v$ = op$ + actualValue$
IF v$ <> op$ + LTRIM$(STR$(VAL(actualValue$))) THEN
result = idemessagebox(dlgTitle$, "Invalid expression.\nYou can use =, <>, >, >=, <, <=, and a literal value\n(scientific notation not allowed).", "#OK")
_KEYCLEAR
GOTO getNewValueInput
END IF
END IF
cmd$ = ""
cmd$ = cmd$ + MKL$(tempIndex&)
cmd$ = cmd$ + _MK$(_BYTE, usedVariableList(tempIndex&).isarray)