From 46910e464bfab9992895898b4c1795e494796e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 29 Jun 2022 16:02:15 +0800 Subject: resolve #1248 supports spaces before `--[[@as]]` --- script/vm/compiler.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'script/vm') diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 549ace71..5a306308 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -585,12 +585,12 @@ local function bindAs(source) ases = {} docs._asCache = ases for _, doc in ipairs(docs) do - if doc.type == 'doc.as' and doc.as then + if doc.type == 'doc.as' and doc.as and doc.touch then ases[#ases+1] = doc end end table.sort(ases, function (a, b) - return a.start < b.start + return a.touch < b.touch end) end @@ -609,7 +609,7 @@ local function bindAs(source) end index = left + (right - left) // 2 local doc = ases[index] - if doc.originalComment.start < source.finish + 2 then + if doc.touch < source.finish then left = index + 1 else right = index @@ -617,7 +617,7 @@ local function bindAs(source) end local doc = ases[index] - if doc and doc.originalComment.start == source.finish + 2 then + if doc and doc.touch == source.finish then vm.setNode(source, vm.compileNode(doc.as), true) return true end -- cgit v1.2.3