nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java
changeset 16256 f2d9a0c49914
parent 16246 f60e04200be3
child 16277 fd698c5ee684
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Fri Feb 22 11:27:40 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Fri Feb 22 12:22:16 2013 +0100
@@ -80,22 +80,17 @@
         switch (operator) {
         case "new":
             if(BeansLinker.isDynamicMethod(self)) {
-                typeError("method.not.constructor", ScriptRuntime.safeToString(self));
-            } else {
-                typeError("not.a.function", ScriptRuntime.safeToString(self));
+                throw typeError("method.not.constructor", ScriptRuntime.safeToString(self));
             }
-            break;
+            throw typeError("not.a.function", ScriptRuntime.safeToString(self));
         case "call":
             if(BeansLinker.isDynamicMethod(self)) {
-                typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
-            } else {
-                typeError("not.a.function", ScriptRuntime.safeToString(self));
+                throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
             }
-            break;
+            throw typeError("not.a.function", ScriptRuntime.safeToString(self));
         case "callMethod":
         case "getMethod":
-            typeError("no.such.function", getArgument(linkRequest), ScriptRuntime.safeToString(self));
-            break;
+            throw typeError("no.such.function", getArgument(linkRequest), ScriptRuntime.safeToString(self));
         case "getProp":
         case "getElem":
             if (desc.getOperand() != null) {
@@ -130,20 +125,16 @@
         switch (operator) {
         case "new":
         case "call":
-            typeError("not.a.function", "null");
-            break;
+            throw typeError("not.a.function", "null");
         case "callMethod":
         case "getMethod":
-            typeError("no.such.function", getArgument(linkRequest), "null");
-            break;
+            throw typeError("no.such.function", getArgument(linkRequest), "null");
         case "getProp":
         case "getElem":
-            typeError("cant.get.property", getArgument(linkRequest), "null");
-            break;
+            throw typeError("cant.get.property", getArgument(linkRequest), "null");
         case "setProp":
         case "setElem":
-            typeError("cant.set.property", getArgument(linkRequest), "null");
-            break;
+            throw typeError("cant.set.property", getArgument(linkRequest), "null");
         default:
             break;
         }