summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 2f3cc36f..5ebf624c 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -629,7 +629,7 @@ local function bindAs(source)
local root = guide.getRoot(source)
local docs = root.docs
if not docs then
- return
+ return false
end
local ases = docs._asCache
if not ases then
@@ -645,19 +645,20 @@ local function bindAs(source)
end)
end
+ if #ases == 0 then
+ return false
+ end
+
local max = #ases
local index
local left = 1
local right = max
for _ = 1, 1000 do
- index = left + (right - left) // 2
- if index <= left then
+ if left == right then
index = left
break
- elseif index >= right then
- index = right
- break
end
+ index = left + (right - left) // 2
local doc = ases[index]
if doc.originalComment.start < source.finish + 2 then
left = index + 1