From 45e533599f08d849951b49bcab0be4fd735a966d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 15 Dec 1997 14:17:20 -0200 Subject: optimization: closures without upvalues don't need to be closures --- lobject.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lobject.c') diff --git a/lobject.c b/lobject.c index c575030d..0ace7836 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 1.6 1997/11/03 20:45:23 roberto Exp roberto $ +** $Id: lobject.c,v 1.7 1997/11/19 17:29:23 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -12,8 +12,8 @@ char *luaO_typenames[] = { /* ORDER LUA_T */ - "userdata", "number", "string", "table", "prototype", "cprototype", - "nil", "function", "mark", "cmark", "line", NULL + "userdata", "number", "string", "table", "function", "function", + "nil", "function", "mark", "mark", "mark", "line", NULL }; @@ -48,7 +48,9 @@ int luaO_equalObj (TObject *t1, TObject *t2) case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2); case LUA_T_STRING: case LUA_T_USERDATA: return svalue(t1) == svalue(t2); case LUA_T_ARRAY: return avalue(t1) == avalue(t2); - case LUA_T_FUNCTION: return t1->value.cl == t2->value.cl; + case LUA_T_CLOSURE: return t1->value.cl == t2->value.cl; + case LUA_T_PROTO: return tfvalue(t1) == tfvalue(t2); + case LUA_T_CPROTO: return fvalue(t1) == fvalue(t2); default: lua_error("internal error in `lua_equalObj'"); return 0; /* UNREACHEABLE */ -- cgit v1.2.3-55-g6feb