shithub: libmujs

Download patch

ref: c67ca523aa2331728ef77ef25b31f4f37389941f
parent: a42d36ba8e43455a9785008c3e811bf332b05784
author: Tor Andersson <tor@ccxvii.net>
date: Tue Feb 25 15:08:16 EST 2014

Remove more dead code.

--- a/jslex.c
+++ b/jslex.c
@@ -150,7 +150,7 @@
 #define PEEK (J->lexchar)
 #define NEXT() jsY_next(J)
 #define ACCEPT(x) (PEEK == x ? (NEXT(), 1) : 0)
-#define EXPECT(x) (ACCEPT(x) || (jsY_error(J, "expected '%c'", x), 0))
+#define EXPECT(x) if (!ACCEPT(x)) jsY_error(J, "expected '%c'", x)
 
 static void jsY_next(js_State *J)
 {
--- a/jsparse.c
+++ b/jsparse.c
@@ -191,7 +191,6 @@
 		return a;
 	}
 	jsP_error(J, "unexpected token: %s (expected identifier)", TOKSTR);
-	return NULL;
 }
 
 static js_Ast *identifieropt(js_State *J)
@@ -209,7 +208,6 @@
 		return a;
 	}
 	jsP_error(J, "unexpected token: %s (expected identifier or keyword)", TOKSTR);
-	return NULL;
 }
 
 static js_Ast *arrayelement(js_State *J)
@@ -376,7 +374,6 @@
 	if (accept(J, '(')) { a = expression(J, 0); expect(J, ')'); return a; }
 
 	jsP_error(J, "unexpected token in expression: %s", TOKSTR);
-	return NULL;
 }
 
 static js_Ast *arguments(js_State *J)
@@ -632,7 +629,6 @@
 	}
 
 	jsP_error(J, "unexpected token in switch: %s (expected 'case' or 'default')", TOKSTR);
-	return NULL;
 }
 
 static js_Ast *caselist(js_State *J)
@@ -683,7 +679,6 @@
 			return STM3(FOR_IN_VAR, a, b, c);
 		}
 		jsP_error(J, "unexpected token in for-var-statement: %s", TOKSTR);
-		return NULL;
 	}
 
 	if (J->lookahead != ';')
@@ -703,7 +698,6 @@
 		return STM3(FOR_IN, a, b, c);
 	}
 	jsP_error(J, "unexpected token in for-statement: %s", TOKSTR);
-	return NULL;
 }
 
 static js_Ast *statement(js_State *J)
@@ -847,9 +841,6 @@
 	a = expression(J, 0);
 	semicolon(J);
 	return a;
-
-	jsP_error(J, "unexpected token in statement: %s", TOKSTR);
-	return NULL;
 }
 
 /* Program */