summaryrefslogtreecommitdiff
path: root/server/src/vm/local.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-04 13:45:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-04 13:45:30 +0800
commitbcec4c1f25f0cac07a56e4fcfe98fe1477d97f29 (patch)
tree419a720e94bbd9b1dcb7a864c799241b5cd4a433 /server/src/vm/local.lua
parent93d6d913857c29caadcc6292c0befdfb278a63b7 (diff)
downloadlua-language-server-bcec4c1f25f0cac07a56e4fcfe98fe1477d97f29.zip
shadow
Diffstat (limited to 'server/src/vm/local.lua')
-rw-r--r--server/src/vm/local.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/src/vm/local.lua b/server/src/vm/local.lua
index 75f41db2..6062d28e 100644
--- a/server/src/vm/local.lua
+++ b/server/src/vm/local.lua
@@ -56,6 +56,19 @@ function mt:getName()
return self.name
end
+function mt:shadow(old)
+ if not old then
+ return self._shadow
+ end
+ local group = old._shadow
+ if not group then
+ group = {}
+ group[#group+1] = old
+ end
+ group[#group+1] = self
+ self._shadow = group
+end
+
return function (name, source, value)
if not value then
error('Local must has a value')