diff options
-rw-r--r-- | server/src/service.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index 74ff98e7..1c102bfa 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -333,20 +333,26 @@ function mt:compileVM(uri) local clock = os.clock() local vm = buildVM(ast, self, uri) + if vm then + CachedVM[vm] = true + end if version ~= obj.version then + if vm then + vm:remove() + end return nil end if self._needCompile[uri] then self:_markCompiled(uri, compiled) else + if vm then + vm:remove() + end return nil end if obj.vm then obj.vm:remove() end - if vm then - CachedVM[vm] = true - end obj.vm = vm obj.vmCost = os.clock() - clock obj.vmVersion = version |