NanoGoat
[org.ibex.core.git] / src / org / ibex / js / Interpreter.java
index 07712aa..6cbaf23 100644 (file)
@@ -93,7 +93,9 @@ class Interpreter implements ByteCodes, Tokens {
             case DUP: stack.push(stack.peek()); break;
             case NEWSCOPE: scope = new JSScope(scope); break;
             case OLDSCOPE: scope = scope.getParentScope(); break;
-            case ASSERT: if (!JS.toBoolean(stack.pop())) throw je("ibex.assertion.failed" /*FEATURE: line number*/); break;
+            case ASSERT:
+                if (JS.checkAssertions && !JS.toBoolean(stack.pop()))
+                    throw je("ibex.assertion.failed" /*FEATURE: line number*/); break;
             case BITNOT: stack.push(JS.N(~JS.toLong(stack.pop()))); break;
             case BANG: stack.push(JS.B(!JS.toBoolean(stack.pop()))); break;
             case NEWFUNCTION: stack.push(((JSFunction)arg)._cloneWithNewParentScope(scope)); break;
@@ -365,7 +367,7 @@ class Interpreter implements ByteCodes, Tokens {
 
             case THROW:
                 throw new JSExn(stack.pop());
-
+                /* FIXME
             case MAKE_GRAMMAR: {
                 final Grammar r = (Grammar)arg;
                 final JSScope final_scope = scope;
@@ -387,7 +389,7 @@ class Interpreter implements ByteCodes, Tokens {
                 stack.push(r2);
                 break;
             }
-
+                */
             case ADD_TRAP: case DEL_TRAP: {
                 Object val = stack.pop();
                 Object key = stack.pop();