aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-07 13:44:10 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-07 13:44:10 -0200
commit9fa1baf6de64e3e9a3288c21e2da2a10bcd25cd4 (patch)
tree27a952143c9395defdf5a4fbc62f510e65f4489d
parent49dfaf7447ab707d17fc6061fe1d59c187e4e221 (diff)
downloadlua-9fa1baf6de64e3e9a3288c21e2da2a10bcd25cd4.tar.gz
lua-9fa1baf6de64e3e9a3288c21e2da2a10bcd25cd4.tar.bz2
lua-9fa1baf6de64e3e9a3288c21e2da2a10bcd25cd4.zip
opcodes for order and shift can use several metamethods,
so it is better to use a generic description + metamethod names in some error messages shown without '__' prefix
-rw-r--r--ldebug.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ldebug.c b/ldebug.c
index 10102405..160b38fc 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.145 2017/11/23 16:35:54 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.146 2017/11/23 19:29:04 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -606,12 +606,16 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
606 case OP_LEN: tm = TM_LEN; break; 606 case OP_LEN: tm = TM_LEN; break;
607 case OP_CONCAT: tm = TM_CONCAT; break; 607 case OP_CONCAT: tm = TM_CONCAT; break;
608 case OP_EQ: tm = TM_EQ; break; 608 case OP_EQ: tm = TM_EQ; break;
609 case OP_LT: tm = TM_LT; break; 609 case OP_LT: case OP_LE: case OP_LTI: case OP_LEI:
610 case OP_LE: tm = TM_LE; break; 610 *name = "order"; /* '<=' can call '__lt', etc. */
611 return "metamethod";
612 case OP_SHRI: case OP_SHLI:
613 *name = "shift";
614 return "metamethod";
611 default: 615 default:
612 return NULL; /* cannot find a reasonable name */ 616 return NULL; /* cannot find a reasonable name */
613 } 617 }
614 *name = getstr(G(L)->tmname[tm]); 618 *name = getstr(G(L)->tmname[tm]) + 2;
615 return "metamethod"; 619 return "metamethod";
616} 620}
617 621