< prev index next >

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

Print this page




 629      */
 630     public final MethodHandle getBoundInvokeHandle(final Object self) {
 631         return MH.bindTo(bindToCalleeIfNeeded(data.getGenericInvoker(scope)), self);
 632     }
 633 
 634     /**
 635      * Bind the method handle to this {@code ScriptFunction} instance if it
 636      * needs a callee parameter. If this function's method handles don't have a
 637      * callee parameter, the handle is returned unchanged.
 638      *
 639      * @param methodHandle the method handle to potentially bind to this
 640      * function instance.
 641      * @return the potentially bound method handle
 642      */
 643     private MethodHandle bindToCalleeIfNeeded(final MethodHandle methodHandle) {
 644         return ScriptFunctionData.needsCallee(methodHandle) ? MH.bindTo(methodHandle, this) : methodHandle;
 645 
 646     }
 647 
 648     /**


















 649      * Get the name for this function
 650      *
 651      * @return the name
 652      */
 653     public final String getName() {
 654         return data.getName();
 655     }
 656 
 657     /**
 658      * Get the scope for this function
 659      *
 660      * @return the scope
 661      */
 662     public final ScriptObject getScope() {
 663         return scope;
 664     }
 665 
 666     /**
 667      * Prototype getter for this ScriptFunction - follows the naming convention
 668      * used by Nasgen and the code generator




 629      */
 630     public final MethodHandle getBoundInvokeHandle(final Object self) {
 631         return MH.bindTo(bindToCalleeIfNeeded(data.getGenericInvoker(scope)), self);
 632     }
 633 
 634     /**
 635      * Bind the method handle to this {@code ScriptFunction} instance if it
 636      * needs a callee parameter. If this function's method handles don't have a
 637      * callee parameter, the handle is returned unchanged.
 638      *
 639      * @param methodHandle the method handle to potentially bind to this
 640      * function instance.
 641      * @return the potentially bound method handle
 642      */
 643     private MethodHandle bindToCalleeIfNeeded(final MethodHandle methodHandle) {
 644         return ScriptFunctionData.needsCallee(methodHandle) ? MH.bindTo(methodHandle, this) : methodHandle;
 645 
 646     }
 647 
 648     /**
 649      * Get the documentation for this function
 650      *
 651      * @return the documentation
 652      */
 653     public final String getDocumentation() {
 654         return data.getDocumentation();
 655     }
 656 
 657     /**
 658      * Set the documentation for this function
 659      *
 660      * @param doc documentation String for this function
 661      */
 662     public final void setDocumentation(final String doc) {
 663         data.setDocumentation(doc);
 664     }
 665 
 666     /**
 667      * Get the name for this function
 668      *
 669      * @return the name
 670      */
 671     public final String getName() {
 672         return data.getName();
 673     }
 674 
 675     /**
 676      * Get the scope for this function
 677      *
 678      * @return the scope
 679      */
 680     public final ScriptObject getScope() {
 681         return scope;
 682     }
 683 
 684     /**
 685      * Prototype getter for this ScriptFunction - follows the naming convention
 686      * used by Nasgen and the code generator


< prev index next >