aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-12-19 11:36:32 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-12-19 11:36:32 -0200
commit2b83711fbac0509a40cfb616b9a68bdf683e8471 (patch)
tree1f244bc08de68b01df8b9d2ff558558703a1a6bb /lcode.c
parent3ae21a352c4cad550a97974c68cd57c3abc39570 (diff)
downloadlua-2b83711fbac0509a40cfb616b9a68bdf683e8471.tar.gz
lua-2b83711fbac0509a40cfb616b9a68bdf683e8471.tar.bz2
lua-2b83711fbac0509a40cfb616b9a68bdf683e8471.zip
new macro 'nvalue' (to convert an object to a float when we know
object is a number)
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lcode.c b/lcode.c
index ddbc6522..f84b7b6b 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.96 2014/11/21 12:15:57 roberto Exp roberto $ 2** $Id: lcode.c,v 2.97 2014/11/24 14:59:22 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -761,12 +761,8 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
761** return false if folding can raise an error 761** return false if folding can raise an error
762*/ 762*/
763static int validop (int op, TValue *v1, TValue *v2) { 763static int validop (int op, TValue *v1, TValue *v2) {
764 lua_Number a, b;
765 lua_Integer i; 764 lua_Integer i;
766 cast_void(a); cast_void(b); /* macro may not use its arguments */ 765 if (luai_numinvalidop(op, nvalue(v1), nvalue(v2))) return 0;
767 if (luai_numinvalidop(op, (cast_void(tonumber(v1, &a)), a),
768 (cast_void(tonumber(v2, &b)), b)))
769 return 0;
770 switch (op) { 766 switch (op) {
771 case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: 767 case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR:
772 case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: /* conversion errors */ 768 case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: /* conversion errors */