summaryrefslogtreecommitdiff
path: root/script/core/infer.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-02-16 15:22:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-02-16 15:22:45 +0800
commit30bc6d37b823cab58114ea09c3f6388c6ef30b02 (patch)
tree18fa3cf12eafe6b06bf2eb60b08302311a3b2698 /script/core/infer.lua
parent8f2c4227753f300e717fa218d915c281dbc3e175 (diff)
parent12d6a9eb75f31b64cbc89eb3265805bc8dad01f0 (diff)
downloadlua-language-server-30bc6d37b823cab58114ea09c3f6388c6ef30b02.zip
Merge commit '12d6a9eb75f31b64cbc89eb3265805bc8dad01f0' into 3.0
Diffstat (limited to 'script/core/infer.lua')
-rw-r--r--script/core/infer.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua
index ab5e2180..d98449d1 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -3,11 +3,11 @@ local util = require 'utility'
local vm = require "vm.vm"
local guide = require "parser.guide"
-local CLASS = {'CLASS'}
-local TABLE = {'TABLE'}
-local CACHE = {'CACHE'}
+local CLASS = { 'CLASS' }
+local TABLE = { 'TABLE' }
+local CACHE = { 'CACHE' }
-local TypeSort = {
+local typeSort = {
['boolean'] = 1,
['string'] = 2,
['integer'] = 3,
@@ -50,7 +50,7 @@ local function searchInferOfUnary(value, infers, mark)
return
end
if op == '-' then
- if m.hasType(value[1], 'integer', mark) then
+ if m.hasType(value[1], 'integer', mark) then
infers['integer'] = true
elseif isBaseType(value[1], mark) then
infers['number'] = true
@@ -125,8 +125,8 @@ local function searchInferOfBinary(value, infers, mark)
or op == '*'
or op == '%'
or op == '//' then
- if m.hasType(value[1], 'integer', mark)
- and m.hasType(value[2], 'integer', mark) then
+ if m.hasType(value[1], 'integer', mark)
+ and m.hasType(value[2], 'integer', mark) then
infers['integer'] = true
elseif isBaseType(value[1], mark)
and isBaseType(value[2], mark) then
@@ -289,8 +289,8 @@ function m.viewInfers(uri, infers)
return 'any'
end
table.sort(result, function (a, b)
- local sa = TypeSort[a] or 100
- local sb = TypeSort[b] or 100
+ local sa = typeSort[a] or 100
+ local sb = typeSort[b] or 100
if sa == sb then
return a < b
else