diff options
Diffstat (limited to 'src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java')
-rw-r--r-- | src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java b/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java index 2cbbf065..aade4551 100644 --- a/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java +++ b/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java @@ -27,6 +27,8 @@ package jdk.nashorn.internal.runtime.linker; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; +import static jdk.nashorn.internal.runtime.JSType.GET_UNDEFINED; +import static jdk.nashorn.internal.runtime.JSType.TYPE_OBJECT_INDEX; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; import java.lang.invoke.MethodHandle; @@ -86,10 +88,13 @@ final class NashornBottomLinker implements GuardingDynamicLinker, GuardingTypeCo final String operator = desc.getFirstOperator(); switch (operator) { case "new": + if(BeansLinker.isDynamicConstructor(self)) { + throw typeError("no.constructor.matches.args", ScriptRuntime.safeToString(self)); + } if(BeansLinker.isDynamicMethod(self)) { throw typeError("method.not.constructor", ScriptRuntime.safeToString(self)); } - throw typeError("not.a.function", ScriptRuntime.safeToString(self)); + throw typeError("not.a.function", desc.getFunctionErrorMessage(self)); case "call": if(BeansLinker.isDynamicConstructor(self)) { throw typeError("constructor.requires.new", ScriptRuntime.safeToString(self)); @@ -97,10 +102,12 @@ final class NashornBottomLinker implements GuardingDynamicLinker, GuardingTypeCo if(BeansLinker.isDynamicMethod(self)) { throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self)); } - throw typeError("not.a.function", ScriptRuntime.safeToString(self)); + throw typeError("not.a.function", desc.getFunctionErrorMessage(self)); case "callMethod": - case "getMethod": throw typeError("no.such.function", getArgument(linkRequest), ScriptRuntime.safeToString(self)); + case "getMethod": + // evaluate to undefined, later on Undefined will take care of throwing TypeError + return getInvocation(MH.dropArguments(GET_UNDEFINED.get(TYPE_OBJECT_INDEX), 0, Object.class), self, linkerServices, desc); case "getProp": case "getElem": if(NashornCallSiteDescriptor.isOptimistic(desc)) { |