summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-22 21:03:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-22 21:03:50 +0800
commit30f1cea83c4d88775932dc4bc8c12b9c74ecfb19 (patch)
tree5f0e466931573e5d9e4da80f25b8355697de8cd4 /script/vm/compiler.lua
parentcdb6c06ca2983f1caf1a0964997c8c44ea784b27 (diff)
downloadlua-language-server-30f1cea83c4d88775932dc4bc8c12b9c74ecfb19.zip
display optional field in table
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 7bb9ba1b..76766734 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1253,14 +1253,22 @@ local compilerSwitch = util.switch()
if not source.extends then
return
end
- vm.setNode(source, vm.compileNode(source.extends))
+ local fieldNode = vm.compileNode(source.extends)
+ if source.optional then
+ fieldNode:addOptional()
+ end
+ vm.setNode(source, fieldNode)
end)
: case 'doc.type.field'
: call(function (source)
if not source.extends then
return
end
- vm.setNode(source, vm.compileNode(source.extends))
+ local fieldNode = vm.compileNode(source.extends)
+ if source.optional then
+ fieldNode:addOptional()
+ end
+ vm.setNode(source, fieldNode)
end)
: case 'doc.param'
: call(function (source)