summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua4
-rw-r--r--script/vm/infer.lua8
-rw-r--r--script/vm/value.lua11
3 files changed, 8 insertions, 15 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 57816e24..e244c6c3 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -858,10 +858,8 @@ local compilerSwitch = util.switch()
end
end)
: case 'doc.type.integer'
- : call(function (source)
- nodeMgr.setNode(source, source)
- end)
: case 'doc.type.string'
+ : case 'doc.type.boolean'
: call(function (source)
nodeMgr.setNode(source, source)
end)
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index b436f9e1..e6ca14e2 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -32,6 +32,8 @@ local inferSorted = {
['integer'] = - 97,
['function'] = - 96,
['table'] = - 95,
+ ['true'] = 1,
+ ['false'] = 2,
['nil'] = 100,
}
@@ -82,10 +84,6 @@ local viewNodeSwitch = util.switch()
return source.name
end
end)
- : case 'doc.type.integer'
- : call(function (source, infer)
- return ('%d'):format(source[1])
- end)
: case 'doc.type.name'
: call(function (source, infer)
infer._hasClass = true
@@ -117,6 +115,8 @@ local viewNodeSwitch = util.switch()
infer._hasTable = true
end)
: case 'doc.type.string'
+ : case 'doc.type.integer'
+ : case 'doc.type.boolean'
: call(function (source, infer)
return ('%q'):format(source[1])
end)
diff --git a/script/vm/value.lua b/script/vm/value.lua
index 549cee02..4141ba8a 100644
--- a/script/vm/value.lua
+++ b/script/vm/value.lua
@@ -204,14 +204,9 @@ function m.getLiterals(v)
or n.type == 'integer' then
literal = n[1]
end
- if n.type == 'global' and n.cate == 'type' then
- if n.name == 'true' then
- literal = true
- elseif n.name == 'false' then
- literal = false
- end
- end
- if n.type == 'doc.type.integer' then
+ if n.type == 'doc.type.string'
+ or n.type == 'doc.type.integer'
+ or n.type == 'doc.type.boolean' then
literal = n[1]
end
if literal ~= nil then