diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-08 20:40:35 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-08 20:40:35 +0800 |
commit | 429a75cb3564b3a9a612fde78aeb7aa937f4a683 (patch) | |
tree | 72e24007af8fb31ea81dfe43bc4f0f60d10bba80 /script/vm/compiler.lua | |
parent | 6ef8cb96f7834c99e998b49a4b8632a784b67e89 (diff) | |
download | lua-language-server-429a75cb3564b3a9a612fde78aeb7aa937f4a683.zip |
stash
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 9e804dfb..ec2834bd 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -553,6 +553,7 @@ local compilerMap = util.switch() local result = valueMgr.test(source[1]) if result == nil then nodeMgr.setNode(source, globalMgr.getGlobal('type', 'boolean')) + return else nodeMgr.setNode(source, { type = 'boolean', @@ -561,16 +562,52 @@ local compilerMap = util.switch() parent = source, [1] = not result, }) + return end end if source.op.type == '#' then nodeMgr.setNode(source, globalMgr.getGlobal('type', 'integer')) + return end if source.op.type == '-' then nodeMgr.setNode(source, globalMgr.getGlobal('type', 'number')) + return end if source.op.type == '~' then nodeMgr.setNode(source, globalMgr.getGlobal('type', 'integer')) + return + end + end) + : case 'binary' + : call(function (source) + if source.op.type == 'and' then + local r1 = valueMgr.test(source[1]) + if r1 == true then + nodeMgr.setNode(source, m.compileNode(source[2])) + return + end + if r1 == false then + nodeMgr.setNode(source, m.compileNode(source[1])) + return + end + nodeMgr.setNode(source, globalMgr.getGlobal('type', 'boolean')) + return + end + if source.op.type == 'or' then + local r1 = valueMgr.test(source[1]) + if r1 == true then + nodeMgr.setNode(source, m.compileNode(source[1])) + return + end + if r1 == false then + nodeMgr.setNode(source, m.compileNode(source[2])) + return + end + nodeMgr.setNode(source, globalMgr.getGlobal('type', 'boolean')) + return + end + if source.op.type == '==' then + end end) : getMap() |