Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable set at the end of a loop gets flagged as unused #47

Open
chrisdp opened this issue Oct 25, 2021 · 1 comment
Open

Variable set at the end of a loop gets flagged as unused #47

chrisdp opened this issue Oct 25, 2021 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@chrisdp
Copy link

chrisdp commented Oct 25, 2021

function convertKeyValueArrayToBase64(keyValueArray as Object) as String
	binaryByte = ""
	ba = createObject("roByteArray")
	topIndex = getLastIndex(keyValueArray)
	for i = 0 to topIndex
		item = keyValueArray[i]
		if getBooleanAtKeyPath(item, "value") then
			binaryByte = binaryByte + "1"
		else
			binaryByte = binaryByte + "0"
		end if

		if i = topIndex then
			' NOTE!!! THIS is opposite of updateKeyValueArrayFromBase64String() on purpose
			binaryByte = binaryByte + string(8 - binaryByte.len(), "0")
		end if

		if binaryByte.len() = 8 OR i = topIndex then
			ba.push(val(binaryByte, 2))
			binaryByte = ""
		end if
	end for
	base64String = ba.toBase64String()

	return base64String
end function

In the above function the binaryByte = "" near the end of the loop is getting flagged with the following:

image

The same thing can be see in this code with focusedChild in the while loop

function getCurrentFocusedNode(parent = Invalid as Object, maxDepth = 30 as Integer) as Dynamic
	if isNode(parent) then
		node = parent
	else
		node = getScene()
	end if

	focusedChild = node.focusedChild

	if isNode(focusedChild) then
		while maxDepth > 0 AND focusedChild <> Invalid AND NOT node.isSameNode(focusedChild)
			node = focusedChild
			focusedChild = node.focusedChild
			maxDepth--
		end while

		return node
	end if

	return Invalid
end function

image

@chrisdp chrisdp added the bug Something isn't working label Oct 25, 2021
@elsassph
Copy link
Collaborator

Same within a goto loop.

@TwitchBronBron TwitchBronBron added the help wanted Extra attention is needed label Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants