From 10680f1a44f92aa0cd32db5e3bb1960bdbb29a25 Mon Sep 17 00:00:00 2001 From: sumneko Date: Thu, 18 Apr 2019 13:36:23 +0800 Subject: =?UTF-8?q?=E5=80=BC=E7=B1=BB=E5=9E=8B=E5=8F=82=E8=80=83class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/vm/emmy.lua | 5 +---- server/src/vm/value.lua | 6 +++--- server/src/vm/vm.lua | 2 ++ 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'server/src/vm') diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua index a9899477..900747e6 100644 --- a/server/src/vm/emmy.lua +++ b/server/src/vm/emmy.lua @@ -1,10 +1,7 @@ local mt = require 'vm.manager' function mt:doEmmyClass(action) - if not self.lsp then - return - end - local emmyMgr = self.lsp.emmyMgr + local emmyMgr = self.emmyMgr local class = action[1] local parent = action[2] self:instantSource(class) diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 3b3a8c01..b3cc5f80 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -77,10 +77,10 @@ end function mt:getType() if self:getEmmy() then - return self:getEmmy():getType() + return self:getEmmy():getType(), 1.0 end if not self._type then - return 'nil' + return 'nil', 0.0 end local mRate = 0.0 local mType @@ -97,7 +97,7 @@ function mt:getType() end end end - return mType or 'any' + return mType or 'any', mRate end function mt:rawSet(index, value, source) diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 3bacfc6c..6f6a4d59 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -7,6 +7,7 @@ local sourceMgr = require 'vm.source' local buildGlobal = require 'vm.global' local createMulti = require 'vm.multi' local libraryBuilder = require 'vm.library' +local emmyMgr = require 'emmy.manager' local config = require 'config' local mt = require 'vm.manager' @@ -1277,6 +1278,7 @@ return function (ast, lsp, uri) main = nil, env = nil, emmy = nil, + emmyMgr = lsp and lsp.emmyMgr or emmyMgr(), lsp = lsp, uri = uri or '', }, mt) -- cgit v1.2.3