shithub: libmujs

Download patch

ref: 8b6493eecefde0d1a0eda4bdab029c4b4650c68b
parent: 5cdcc209367f3497006fe43a51e187f6ae7d2e86
author: Tor Andersson <[email protected]>
date: Tue Jan 21 10:49:36 EST 2014

Implement with statement.

--- a/jsrun.c
+++ b/jsrun.c
@@ -793,6 +793,18 @@
 			js_pushnumber(J, toint32(x) | toint32(y));
 			break;
 
+		/* With */
+
+		case OP_WITH:
+			obj = js_toobject(J, -1);
+			J->E = jsR_newenvironment(J, obj, J->E);
+			js_pop(J, 1);
+			break;
+
+		case OP_ENDWITH:
+			J->E = J->E->outer;
+			break;
+
 		/* Branching */
 
 		case OP_DEBUGGER: