summaryrefslogtreecommitdiff
path: root/script/parser/compile.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-11 20:34:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-11 20:34:44 +0800
commit2469dbae153066fad83edcced82f17aee77d0a9f (patch)
tree1f2fc76ce1344ee9e48935f94fe5b44182325453 /script/parser/compile.lua
parent8f056d36ec61dd91cfab282780dc1786df646fcb (diff)
downloadlua-language-server-2469dbae153066fad83edcced82f17aee77d0a9f.zip
resolve #1029
treat _ENV = {} as local _ENV = {} local _ENV = nil will disable all globals local _ENV = {} will enable all globals local _ENV = {} ---@type mathlib will open globals in mathlib
Diffstat (limited to 'script/parser/compile.lua')
-rw-r--r--script/parser/compile.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua
index bae1e21a..e396cb21 100644
--- a/script/parser/compile.lua
+++ b/script/parser/compile.lua
@@ -2834,7 +2834,16 @@ local function compileExpAsAction(exp)
pushActionIntoCurrentChunk(exp)
if GetToSetMap[exp.type] then
skipSpace()
- local action, isSet = parseMultiVars(exp, parseExp)
+ local isLocal
+ if exp.type == 'getlocal' and exp[1] == State.ENVMode then
+ exp.special = nil
+ local loc = createLocal(exp, parseLocalAttrs())
+ loc.locPos = exp.start
+ loc.effect = maxinteger
+ isLocal = true
+ skipSpace()
+ end
+ local action, isSet = parseMultiVars(exp, parseExp, isLocal)
if isSet
or action.type == 'getmethod' then
return action