src/jdk/nashorn/internal/objects/NativeJSAdapter.java

changeset 769
5a1ae83c295f
parent 766
06ee95f094b4
child 771
5ab19753ce4a
equal deleted inserted replaced
768:27d6e99ae970 769:5a1ae83c295f
620 case "getElem": 620 case "getElem":
621 return findHook(desc, __get__); 621 return findHook(desc, __get__);
622 case "getMethod": 622 case "getMethod":
623 final FindProperty find = adaptee.findProperty(__call__, true); 623 final FindProperty find = adaptee.findProperty(__call__, true);
624 if (find != null) { 624 if (find != null) {
625 final Object value = getObjectValue(find); 625 final Object value = find.getObjectValue();
626 if (value instanceof ScriptFunction) { 626 if (value instanceof ScriptFunction) {
627 final ScriptFunctionImpl func = (ScriptFunctionImpl)value; 627 final ScriptFunctionImpl func = (ScriptFunctionImpl)value;
628 // TODO: It's a shame we need to produce a function bound to this and name, when we'd only need it bound 628 // TODO: It's a shame we need to produce a function bound to this and name, when we'd only need it bound
629 // to name. Probably not a big deal, but if we can ever make it leaner, it'd be nice. 629 // to name. Probably not a big deal, but if we can ever make it leaner, it'd be nice.
630 return new GuardedInvocation(MH.dropArguments(MH.constant(Object.class, 630 return new GuardedInvocation(MH.dropArguments(MH.constant(Object.class,
689 private GuardedInvocation findHook(final CallSiteDescriptor desc, final String hook, final boolean useName) { 689 private GuardedInvocation findHook(final CallSiteDescriptor desc, final String hook, final boolean useName) {
690 final FindProperty findData = adaptee.findProperty(hook, true); 690 final FindProperty findData = adaptee.findProperty(hook, true);
691 final MethodType type = desc.getMethodType(); 691 final MethodType type = desc.getMethodType();
692 if (findData != null) { 692 if (findData != null) {
693 final String name = desc.getNameTokenCount() > 2 ? desc.getNameToken(2) : null; 693 final String name = desc.getNameTokenCount() > 2 ? desc.getNameToken(2) : null;
694 final Object value = getObjectValue(findData); 694 final Object value = findData.getObjectValue();
695 if (value instanceof ScriptFunction) { 695 if (value instanceof ScriptFunction) {
696 final ScriptFunction func = (ScriptFunction)value; 696 final ScriptFunction func = (ScriptFunction)value;
697 697
698 final MethodHandle methodHandle = getCallMethodHandle(findData, type, 698 final MethodHandle methodHandle = getCallMethodHandle(findData, type,
699 useName ? name : null); 699 useName ? name : null);

mercurial