summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-02-10 15:56:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-02-10 15:56:47 +0800
commitf335c413a409c1f03e379d7d5e1d5b377d378a0f (patch)
tree7c419f86b7bdfc5123f400cb48e8d100dea2ff1e /script/vm
parentea41c81ed7290827be63b58e61cf2334b41beace (diff)
downloadlua-language-server-f335c413a409c1f03e379d7d5e1d5b377d378a0f.zip
cleanup
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua25
-rw-r--r--script/vm/eachDef.lua1
-rw-r--r--script/vm/eachRef.lua1
-rw-r--r--script/vm/init.lua1
-rw-r--r--script/vm/object/class.lua10
-rw-r--r--script/vm/object/init.lua0
-rw-r--r--script/vm/vm.lua3
7 files changed, 36 insertions, 5 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
new file mode 100644
index 00000000..51fc5962
--- /dev/null
+++ b/script/vm/compiler.lua
@@ -0,0 +1,25 @@
+local files = require 'files'
+
+---@class vm.compiler
+local m = {}
+
+for uri in files.eachFile() do
+ local state = files.getState(uri)
+ if state then
+ --m.compileGlobalNodes(state.ast)
+ end
+end
+
+files.watch(function (ev, uri)
+ if ev == 'update' then
+ local state = files.getState(uri)
+ if state then
+ --m.compileGlobalNodes(state.ast)
+ end
+ end
+ if ev == 'remove' then
+ --collector:dropUri(uri)
+ end
+end)
+
+return m
diff --git a/script/vm/eachDef.lua b/script/vm/eachDef.lua
index ea14ed9f..3f7e1db9 100644
--- a/script/vm/eachDef.lua
+++ b/script/vm/eachDef.lua
@@ -1,6 +1,5 @@
---@class vm
local vm = require 'vm.vm'
-local searcher = require 'core.searcher'
function vm.getDefs(source, field)
return searcher.requestDefinition(source, field)
diff --git a/script/vm/eachRef.lua b/script/vm/eachRef.lua
index 899c04c6..ded95b61 100644
--- a/script/vm/eachRef.lua
+++ b/script/vm/eachRef.lua
@@ -1,6 +1,5 @@
---@class vm
local vm = require 'vm.vm'
-local searcher = require 'core.searcher'
function vm.getRefs(source, field)
return searcher.requestReference(source, field)
diff --git a/script/vm/init.lua b/script/vm/init.lua
index 935f39e3..c3ccabc1 100644
--- a/script/vm/init.lua
+++ b/script/vm/init.lua
@@ -1,4 +1,5 @@
local vm = require 'vm.vm'
+require 'vm.compiler'
require 'vm.getGlobals'
require 'vm.getDocs'
require 'vm.getLibrary'
diff --git a/script/vm/object/class.lua b/script/vm/object/class.lua
new file mode 100644
index 00000000..2e6e6094
--- /dev/null
+++ b/script/vm/object/class.lua
@@ -0,0 +1,10 @@
+---@class vm.object.class
+local mt = {}
+mt.__index = mt
+
+---@return vm.object.class
+return function ()
+ local class = setmetatable({
+ }, mt)
+ return class
+end
diff --git a/script/vm/object/init.lua b/script/vm/object/init.lua
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/script/vm/object/init.lua
diff --git a/script/vm/vm.lua b/script/vm/vm.lua
index aa18ea73..ff893f24 100644
--- a/script/vm/vm.lua
+++ b/script/vm/vm.lua
@@ -1,11 +1,8 @@
local guide = require 'parser.guide'
-local util = require 'utility'
local files = require 'files'
local timer = require 'timer'
local setmetatable = setmetatable
-local running = coroutine.running
-local ipairs = ipairs
local log = log
local xpcall = xpcall
local mathHuge = math.huge