summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 8126f393..8df28e7b 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -455,6 +455,9 @@ local function getReturn(func, index, args)
result:merge(rnode)
end
end
+ if result and returnNode:isOptional() then
+ result:addOptional()
+ end
end
end
end
@@ -1115,6 +1118,9 @@ local compilerSwitch = util.switch()
for _, typeUnit in ipairs(source.types) do
vm.setNode(source, vm.compileNode(typeUnit))
end
+ if source.optional then
+ vm.getNode(source):addOptional()
+ end
end)
: case 'doc.type.integer'
: case 'doc.type.string'
@@ -1220,6 +1226,9 @@ local compilerSwitch = util.switch()
else
vm.setNode(source, globalMgr.getGlobal('type', 'any'))
end
+ if source.optional then
+ vm.getNode(source):addOptional()
+ end
end)
: case 'generic'
: call(function (source)