also fix misidentification of scope in function declarations

because code like below does not create a global "a" or "b" variables:

do
	local a = {}
	function a.b()
		-- ...
	end
end

will need to update testcases too.
update functions testcases broken by previous commit
get rid of isLocal variable

its only use has been eliminated, there's no reason to keep it.
fix more scoping bugs

minimal testcases:

local a = {}
function a:b()
	return self -- false global
end

repeat
	local b = true
until b -- false global; this loop executes only once

local a = function (b) end
print(b) -- undetected global

for a in pairs { } do end
print(a) -- undetected global