diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-11-10 12:46:05 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-11-10 12:46:05 -0200 |
| commit | ad20689febfe15e20c9bce6bb74459f169499524 (patch) | |
| tree | 35ea80b8a81e86e375b8cc57444919dbcc7f8137 | |
| parent | e32079015495f01e470b285a9a1f09552ab5c615 (diff) | |
| download | lua-ad20689febfe15e20c9bce6bb74459f169499524.tar.gz lua-ad20689febfe15e20c9bce6bb74459f169499524.tar.bz2 lua-ad20689febfe15e20c9bce6bb74459f169499524.zip | |
better error message for bitwise operators (they are not arithmetic...)
| -rw-r--r-- | ldebug.h | 7 | ||||
| -rw-r--r-- | ltm.c | 6 |
2 files changed, 8 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.h,v 2.10 2013/05/06 17:19:11 roberto Exp roberto $ | 2 | ** $Id: ldebug.h,v 2.11 2014/02/25 14:31:16 roberto Exp roberto $ |
| 3 | ** Auxiliary functions from Debug Interface module | 3 | ** Auxiliary functions from Debug Interface module |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -25,8 +25,9 @@ LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, | |||
| 25 | const char *opname); | 25 | const char *opname); |
| 26 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, | 26 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, |
| 27 | const TValue *p2); | 27 | const TValue *p2); |
| 28 | LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1, | 28 | LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, |
| 29 | const TValue *p2); | 29 | const TValue *p2, |
| 30 | const char *msg); | ||
| 30 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, | 31 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, |
| 31 | const TValue *p2); | 32 | const TValue *p2); |
| 32 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, | 33 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltm.c,v 2.29 2014/07/18 13:36:14 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.30 2014/11/02 19:19:04 roberto Exp roberto $ |
| 3 | ** Tag methods | 3 | ** Tag methods |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -122,10 +122,12 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, | |||
| 122 | lua_Number dummy; | 122 | lua_Number dummy; |
| 123 | if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) | 123 | if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) |
| 124 | luaG_tointerror(L, p1, p2); | 124 | luaG_tointerror(L, p1, p2); |
| 125 | else if (event != TM_IDIV) | ||
| 126 | luaG_opinterror(L, p1, p2, "perform bitwise operation on"); | ||
| 125 | /* else go through */ | 127 | /* else go through */ |
| 126 | } | 128 | } |
| 127 | default: | 129 | default: |
| 128 | luaG_aritherror(L, p1, p2); | 130 | luaG_opinterror(L, p1, p2, "perform arithmetic on"); |
| 129 | } | 131 | } |
| 130 | } | 132 | } |
| 131 | } | 133 | } |
