shithub: libmujs

Download patch

ref: fe723b6f8b0e5381235a9d8da63d251cdf8ae63b
parent: c7e9ab0b052f258508098073c5b488095ad871fa
author: Tor Andersson <[email protected]>
date: Mon Feb 24 19:21:47 EST 2014

Fix unreachable code warnings.

--- a/jsrun.c
+++ b/jsrun.c
@@ -187,7 +187,6 @@
 			return "function";
 		return "object";
 	}
-	return "object";
 }
 
 js_Value js_tovalue(js_State *J, int idx)
@@ -1376,7 +1375,6 @@
 
 		case OP_THROW:
 			js_throw(J);
-			break;
 
 		case OP_TRY:
 			offset = *pc++;
@@ -1445,9 +1443,6 @@
 
 		case OP_RETURN:
 			return;
-
-		default:
-			js_error(J, "illegal instruction: %s (pc=%d)", jsC_opcodestring(opcode), (int)(pc - F->code - 1));
 		}
 	}
 }
--- a/jsvalue.c
+++ b/jsvalue.c
@@ -108,7 +108,6 @@
 	case JS_TSTRING: return v->u.string[0] != 0;
 	case JS_TOBJECT: return 1;
 	}
-	return 0;
 }
 
 /* ToNumber() on a string */
@@ -141,7 +140,6 @@
 			return jsV_tonumber(J, &vv);
 		}
 	}
-	return 0;
 }
 
 double jsV_tointeger(js_State *J, const js_Value *v)
@@ -175,7 +173,6 @@
 			return jsV_tostring(J, &vv);
 		}
 	}
-	return "undefined";
 }
 
 /* Objects */
@@ -213,7 +210,6 @@
 	case JS_TSTRING: return jsV_newstring(J, v->u.string);
 	case JS_TOBJECT: return v->u.object;
 	}
-	js_typeerror(J, "cannot convert value to object");
 }
 
 void js_newobject(js_State *J)