Roberto Ierusalimschy 23 年之前
父节点
当前提交
13ab5a6bb1
共有 6 个文件被更改,包括 19 次插入15 次删除
  1. 2 2
      lcode.c
  2. 3 2
      lcode.h
  3. 2 2
      ldblib.c
  4. 2 2
      lmathlib.c
  5. 2 2
      lstrlib.c
  6. 8 5
      ltests.c

+ 2 - 2
lcode.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 1.92 2002/03/21 20:31:43 roberto Exp roberto $
+** $Id: lcode.c,v 1.93 2002/03/25 17:47:14 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -704,7 +704,7 @@ void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
         luaK_exp2nextreg(fs, e2);
         freeexp(fs, e2);
         freeexp(fs, e1);
-        e1->info = luaK_codeABC(fs, codes[op], 0, e1->info, e2->info);
+        e1->info = luaK_codeABC(fs, OP_CONCAT, 0, e1->info, e2->info);
         e1->k = VRELOCABLE;
       }
       break;

+ 3 - 2
lcode.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.h,v 1.28 2002/03/08 19:10:32 roberto Exp roberto $
+** $Id: lcode.h,v 1.29 2002/03/21 20:31:43 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -26,7 +26,8 @@
 typedef enum BinOpr {
   OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW,
   OPR_CONCAT,
-  OPR_NE, OPR_EQ, OPR_LT, OPR_LE, OPR_GT, OPR_GE,
+  OPR_NE, OPR_EQ,
+  OPR_LT, OPR_LE, OPR_GT, OPR_GE,
   OPR_AND, OPR_OR,
   OPR_NOBINOPR
 } BinOpr;

+ 2 - 2
ldblib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldblib.c,v 1.44 2002/03/20 12:54:08 roberto Exp roberto $
+** $Id: ldblib.c,v 1.45 2002/03/27 15:30:41 roberto Exp roberto $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -264,7 +264,7 @@ static const luaL_reg dblib[] = {
 
 
 LUALIB_API int lua_dblibopen (lua_State *L) {
-  luaL_opennamedlib(L, "dbg", dblib);
+  luaL_opennamedlib(L, "dbg", dblib, 0);
   lua_register(L, LUA_ERRORMESSAGE, errorfb);
   return 0;
 }

+ 2 - 2
lmathlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lmathlib.c,v 1.40 2001/12/05 20:15:18 roberto Exp roberto $
+** $Id: lmathlib.c,v 1.41 2002/03/20 12:54:08 roberto Exp roberto $
 ** Standard mathematical library
 ** See Copyright Notice in lua.h
 */
@@ -234,7 +234,7 @@ static const luaL_reg mathlib[] = {
 LUALIB_API int lua_mathlibopen (lua_State *L) {
   lua_pushliteral(L, "math");
   lua_newtable(L);
-  luaL_openlib(L, mathlib);
+  luaL_openlib(L, mathlib, 0);
   lua_pushliteral(L, "pi");
   lua_pushnumber(L, PI);
   lua_settable(L, -3);

+ 2 - 2
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.78 2002/03/11 13:29:40 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.79 2002/03/20 12:54:08 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -727,7 +727,7 @@ static const luaL_reg strlib[] = {
 ** Open string library
 */
 LUALIB_API int lua_strlibopen (lua_State *L) {
-  luaL_opennamedlib(L, "str", strlib);
+  luaL_opennamedlib(L, "str", strlib, 0);
   return 0;
 }
 

+ 8 - 5
ltests.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltests.c,v 1.113 2002/03/20 12:54:08 roberto Exp roberto $
+** $Id: ltests.c,v 1.114 2002/03/25 17:47:14 roberto Exp roberto $
 ** Internal Module for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 */
@@ -349,8 +349,10 @@ static int unref (lua_State *L) {
 
 static int metatable (lua_State *L) {
   luaL_check_any(L, 1);
-  if (lua_isnone(L, 2))
-    lua_getmetatable(L, 1);
+  if (lua_isnone(L, 2)) {
+    if (lua_getmetatable(L, 1) == 0)
+      lua_pushnil(L);
+  }
   else {
     lua_settop(L, 2);
     luaL_check_type(L, 2, LUA_TTABLE);
@@ -627,7 +629,8 @@ static int testC (lua_State *L) {
       lua_setmetatable(L, getnum);
     }
     else if EQ("getmetatable") {
-      lua_getmetatable(L, getnum);
+      if (lua_getmetatable(L, getnum) == 0)
+        lua_pushnil(L);
     }
     else if EQ("type") {
       lua_pushstring(L, lua_typename(L, lua_type(L, getnum)));
@@ -682,7 +685,7 @@ static void fim (void) {
 void luaB_opentests (lua_State *L) {
   *cast(int **, L) = &islocked;  /* init lock */
   lua_state = L;  /* keep first state to be opened */
-  luaL_opennamedlib(L, "T", tests_funcs);
+  luaL_opennamedlib(L, "T", tests_funcs, 0);
   atexit(fim);
 }