summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/reference.lua11
-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
8 files changed, 36 insertions, 16 deletions
diff --git a/script/core/reference.lua b/script/core/reference.lua
index 5e4a4cbf..60a25940 100644
--- a/script/core/reference.lua
+++ b/script/core/reference.lua
@@ -1,4 +1,3 @@
-local searcher = require 'core.searcher'
local guide = require 'parser.guide'
local files = require 'files'
local vm = require 'vm'
@@ -66,22 +65,12 @@ return function (uri, position)
local metaSource = vm.isMetaFile(uri)
local refs = vm.getAllRefs(source)
- local values = {}
- for _, src in ipairs(refs) do
- local value = searcher.getObjectValue(src)
- if value and value ~= src and guide.isLiteral(value) then
- values[value] = true
- end
- end
local results = {}
for _, src in ipairs(refs) do
if src.dummy then
goto CONTINUE
end
- if values[src] then
- goto CONTINUE
- end
local root = guide.getRoot(src)
if not root then
goto CONTINUE
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