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

Properly add/remove variables from usedVariableList$

This commit is contained in:
FellippeHeitor 2019-01-12 15:28:08 -02:00
parent bb21552772
commit da24fde08d
2 changed files with 10 additions and 44 deletions

View file

@ -1293,40 +1293,6 @@ FUNCTION ide2 (ignore)
END IF
END IF
IF mX > 0 AND mY > 0 THEN
IF showingUnusedVariableWarning = 0 THEN
IF mX = 1 AND SCREEN(mY, mX) = 26 THEN
unusedVariableWarningX = mX
unusedVariableWarningY = mY
findItem = INSTR(usedVariableList$, CHR$(1) + MKL$((mY - 3) + idesy) + CHR$(2) + CHR$(3))
unusedVariableName$ = MID$(usedVariableList$, findItem + 6, INSTR(findItem, usedVariableList$, CHR$(5)) - findItem - 6)
findItem = MID$(usedVariableList$, findItem + 6 + LEN(unusedVariableName$) INSTR(findItem, usedVariableList$, CHR$(3))
unusedVariableName$ = LEFT$(unusedVariableName$, findItem - 1) + " (" + MID$(unusedVariableName$, findItem + 1) + ") "
unusedVariableWarning$ = LEFT$(" Variable hasn't yet been used: " + unusedVariableName$, idewx - 2)
LOCATE mY, mX
COLOR 0, 3
PRINT CHR$(26) + LEFT$(unusedVariableWarning$, 32);
COLOR 15
PRINT MID$(unusedVariableWarning$, 33);
'shadow
COLOR 2, 0
FOR x2 = mX + 2 TO mX + LEN(unusedVariableWarning$) + 1
LOCATE mY + 1, x2: PRINT CHR$(SCREEN(mY + 1, x2));
NEXT
PCOPY 3, 0
showingUnusedVariableWarning = -1
END IF
ELSE
IF unusedVariableWarningX <> mX OR unusedVariableWarningY <> mY THEN
ideshowtext
PCOPY 3, 0
showingUnusedVariableWarning = 0
END IF
END IF
END IF
IF _WINDOWHASFOCUS THEN
LOCATE , , 1
_PALETTECOLOR 5, IDEBracketHighlightColor, 0
@ -8543,7 +8509,7 @@ SUB ideshowtext
END IF
IF l <= iden THEN
IF idecompiling = 0 AND INSTR(usedVariableList$, CHR$(1) + MKL$(l) + CHR$(2) + CHR$(4)) > 0 THEN
IF idecompiling = 0 AND INSTR(usedVariableList$, CHR$(1) + MKL$(l) + CHR$(2) + CHR$(3)) > 0 THEN
LOCATE y + 3, 1
prevBG% = _BACKGROUNDCOLOR
COLOR 13, 1
@ -8931,7 +8897,7 @@ SUB ideshowtext
FOR b = 1 TO IdeBmkN
y = IdeBmk(b).y
IF y >= idesy AND y <= idesy + (idewy - 9) THEN
IF INSTR(usedVariableList$, CHR$(1) + MKL$(y) + CHR$(2) + CHR$(4)) = 0 THEN
IF INSTR(usedVariableList$, CHR$(1) + MKL$(y) + CHR$(2) + CHR$(3)) = 0 THEN
LOCATE 3 + y - idesy, 1: PRINT CHR$(197);
END IF
END IF

View file

@ -11631,10 +11631,10 @@ OPEN compilelog$ FOR OUTPUT AS #1: CLOSE #1 'Clear log
OPEN "unusedVariableList.txt" FOR OUTPUT AS #1: CLOSE #1
OPEN "unusedVariableList.txt" FOR BINARY AS #1
PUT #1, 1, usedVariableList$
CLOSE #1
'OPEN "unusedVariableList.txt" FOR OUTPUT AS #1: CLOSE #1
'OPEN "unusedVariableList.txt" FOR BINARY AS #1
'PUT #1, 1, usedVariableList$
'CLOSE #1
@ -17141,10 +17141,10 @@ FUNCTION evaluatetotyp$ (a2$, targettyp AS LONG)
IF E = 0 THEN 'no specific element, use size of entire type
bytes$ = str2(udtxsize(u) \ 8)
ELSE 'a specific element
if (udtetype(E) AND ISSTRING) > 0 AND (udtetype(E) AND ISFIXEDLENGTH) = 0 AND (targettyp = -5) then
IF (udtetype(E) AND ISSTRING) > 0 AND (udtetype(E) AND ISFIXEDLENGTH) = 0 AND (targettyp = -5) THEN
evaluatetotyp$ = "(*(qbs**)" + dst$ + ")->len"
exit function
end if
EXIT FUNCTION
END IF
bytes$ = str2(udtesize(E) \ 8)
END IF
evaluatetotyp$ = "byte_element((uint64)" + dst$ + "," + bytes$ + "," + NewByteElement$ + ")"
@ -24887,7 +24887,7 @@ SUB manageVariableList (name$, __cname$, action AS _BYTE)
'usedVariableList$ = usedVariableList$ + "Adding " + cname$ + " at line" + STR$(linenumber) + CHR$(10)
END IF
CASE ELSE 'find and remove
s$ = CHR$(3) + cname$ + CHR$(5)
s$ = CHR$(3) + MKI$(LEN(cname$)) + cname$ + CHR$(5)
findItem = INSTR(usedVariableList$, s$)
IF findItem THEN
ASC(usedVariableList$, findItem) = 4