< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java

Print this page

        

@@ -1857,11 +1857,11 @@
      * @param request The link request
      *
      * @return GuardedInvocation to be invoked at call site.
      */
     protected GuardedInvocation findNewMethod(final CallSiteDescriptor desc, final LinkRequest request) {
-        return notAFunction();
+        return notAFunction(desc);
     }
 
     /**
      * Find the appropriate CALL method for an invoke dynamic call.
      * This generates "not a function" always

@@ -1870,15 +1870,15 @@
      * @param request the link request
      *
      * @return GuardedInvocation to be invoked at call site.
      */
     protected GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final LinkRequest request) {
-        return notAFunction();
+        return notAFunction(desc);
     }
 
-    private GuardedInvocation notAFunction() {
-        throw typeError("not.a.function", ScriptRuntime.safeToString(this));
+    private GuardedInvocation notAFunction(final CallSiteDescriptor desc) {
+        throw typeError("not.a.function", NashornCallSiteDescriptor.getFunctionErrorMessage(desc, this));
     }
 
     /**
      * Find an implementation for a "dyn:callMethod" operation. Note that Nashorn internally never uses
      * "dyn:callMethod", but instead always emits two call sites in bytecode, one for "dyn:getMethod", and then another
< prev index next >