summaryrefslogtreecommitdiff
path: root/src/lcode.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-01 13:58:39 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-01 13:58:39 +0100
commit69a7af7a8af1e737fe6afe47998b90c8fd778998 (patch)
tree41e8e7fae91044ea90eeb003a66d76add378dd08 /src/lcode.js
parentfcbf535dc7f14ce00d307bc3874d22f0d6cce9e5 (diff)
downloadfengari-69a7af7a8af1e737fe6afe47998b90c8fd778998.tar.gz
fengari-69a7af7a8af1e737fe6afe47998b90c8fd778998.tar.bz2
fengari-69a7af7a8af1e737fe6afe47998b90c8fd778998.zip
[Parsing tests] Binary op
Diffstat (limited to 'src/lcode.js')
-rw-r--r--src/lcode.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lcode.js b/src/lcode.js
index 46b8c74..3c6500d 100644
--- a/src/lcode.js
+++ b/src/lcode.js
@@ -513,8 +513,8 @@ const luaK_stringK = function(fs, s) {
** are no "precision" problems.
*/
const luaK_intK = function(fs, n) {
- let k = new TValue(CT.LUA_TLNGSTR, `${n.value}`);
- let o = new TValue(CT.LUA_TNUMINT, n.value);
+ let k = new TValue(CT.LUA_TLNGSTR, `${n}`);
+ let o = new TValue(CT.LUA_TNUMINT, n);
return addk(fs, k, o);
};
@@ -522,7 +522,8 @@ const luaK_intK = function(fs, n) {
** Add a float to list of constants and return its index.
*/
const luaK_numberK = function(fs, r) {
- return addk(fs, r, r); /* use number itself as key */
+ let o = new TValue(CT.LUA_TNUMFLT, r);
+ return addk(fs, o, o); /* use number itself as key */
};
@@ -530,7 +531,8 @@ const luaK_numberK = function(fs, r) {
** Add a boolean to list of constants and return its index.
*/
const boolK = function(fs, b) {
- return addk(fs, b, b); /* use boolean itself as key */
+ let o = new TValue(CT.LUA_TBOOLEAN, b);
+ return addk(fs, o, o); /* use boolean itself as key */
};