浏览代码

detail
put explicit all cases for a switch of an enumeration

Roberto Ierusalimschy 7 年之前
父节点
当前提交
13256a4173
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lcode.c

+ 4 - 2
lcode.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lcode.c,v 2.122 2017/09/13 19:50:08 roberto Exp roberto $
+** $Id: lcode.c,v 2.123 2017/09/19 18:38:14 roberto Exp roberto $
 ** Code generator for Lua
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -1263,10 +1263,12 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
       /* else keep numeral, which may be folded with 2nd operand */
       /* else keep numeral, which may be folded with 2nd operand */
       break;
       break;
     }
     }
-    default: {
+    case OPR_EQ: case OPR_LT: case OPR_LE:
+    case OPR_NE: case OPR_GT: case OPR_GE: {
       luaK_exp2RK(fs, v);
       luaK_exp2RK(fs, v);
       break;
       break;
     }
     }
+    default: lua_assert(0);
   }
   }
 }
 }