瀏覽代碼

Add default error case in switch(getType()) to remove warnings of enumeration values not handled in switch

master
mtardy 4 年之前
父節點
當前提交
a1bc3ba26b
共有 1 個檔案被更改,包括 24 行新增8 行删除
  1. +24
    -8
      parse.leg

+ 24
- 8
parse.leg 查看文件

@ -1736,8 +1736,10 @@ oop eval(oop scope, oop ast)
}
return res;
}
default: {
runtimeError("slicing a non-String or non-Map");
}
}
runtimeError("slicing a non-String or non-Map");
}
case t_Symbol:
case t_Integer:
@ -2100,8 +2102,10 @@ oop prim_String(oop scope, oop params)
case Symbol: {
return makeString(get(arg, Symbol, name));
}
default: {
runtimeError("cannot make string from: %s", printString(arg));
}
}
runtimeError("cannot make string from: %s", printString(arg));
return NULL;
}
@ -2135,9 +2139,11 @@ oop prim_Symbol(oop scope, oop params)
case Symbol: {
return arg;
}
default: {
runtimeError("cannot make symbol from: %s", printString(arg));
}
}
}
runtimeError("cannot make symbol from: %s", printString(arg));
return NULL;
}
@ -2163,9 +2169,11 @@ oop prim_Integer(oop scope, oop params)
}
return makeInteger(strtoll(get(arg, String, value), NULL, base));
}
default: {
runtimeError("cannot make integer from: %s", printString(arg));
}
}
}
runtimeError("cannot make integer from: %s", printString(arg));
return NULL;
}
@ -2183,8 +2191,10 @@ oop prim_Map(oop scope, oop params)
case Map: {
return clone(arg);
}
default: {
runtimeError("cannot make map from: %s", printString(arg));
}
}
runtimeError("cannot make map from: %s", printString(arg));
return NULL;
}
@ -2215,8 +2225,10 @@ oop prim_Array(oop scope, oop params)
case Map: {
return clone(arg);
}
default: {
runtimeError("cannot make array from: %s", printString(arg));
}
}
runtimeError("cannot make array from: %s", printString(arg));
return NULL;
}
@ -2246,9 +2258,11 @@ oop prim_Function(oop scope, oop params)
}
}
}
default: {
runtimeError("cannot make function from: %s", printString(arg));
}
}
}
runtimeError("cannot make function from: %s", printString(arg));
return NULL;
}
@ -2278,9 +2292,11 @@ oop prim_Syntax(oop scope, oop params)
}
}
}
default: {
runtimeError("cannot make syntax from: %s", printString(arg));
}
}
}
runtimeError("cannot make syntax from: %s", printString(arg));
return NULL;
}

Loading…
取消
儲存