summaryrefslogtreecommitdiff
path: root/server-beta/src/parser/compile.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-25 16:53:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-25 16:53:16 +0800
commitc08ce9af7a35be058aafabcb5dd88748aae75282 (patch)
treed00ab5a5bdbb97ade99fb85e78f35db240fd94f5 /server-beta/src/parser/compile.lua
parent9c79e11ff4c7778e7f35d25c62390be13f9d1959 (diff)
downloadlua-language-server-c08ce9af7a35be058aafabcb5dd88748aae75282.zip
rawset
Diffstat (limited to 'server-beta/src/parser/compile.lua')
-rw-r--r--server-beta/src/parser/compile.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/server-beta/src/parser/compile.lua b/server-beta/src/parser/compile.lua
index 457af42c..45fd808b 100644
--- a/server-beta/src/parser/compile.lua
+++ b/server-beta/src/parser/compile.lua
@@ -3,7 +3,7 @@ local type = type
_ENV = nil
-local pushError, Root, Compile, CompileBlock, Cache, Block, GoToTag
+local pushError, Root, Compile, CompileBlock, Cache, Block, GoToTag, Version, ENVMode
local vmMap = {
['nil'] = function (obj)
@@ -475,6 +475,15 @@ local vmMap = {
Block = obj
Root[#Root+1] = obj
local id = #Root
+ if ENVMode == '_ENV' then
+ Compile({
+ type = 'local',
+ start = 0,
+ finish = 0,
+ effect = 0,
+ [1] = '_ENV',
+ }, id)
+ end
CompileBlock(obj, id)
Block = nil
return id
@@ -584,6 +593,12 @@ return function (self, lua, mode, version)
end
pushError = state.pushError
Root = state.root
+ Version = version
+ if version == 'Lua 5.1' or version == 'LuaJIT' then
+ ENVMode = 'fenv'
+ else
+ ENVMode = '_ENV'
+ end
Cache = {}
GoToTag = {}
if type(state.ast) == 'table' then