Class InterpretedFunction

    • Constructor Detail

      • InterpretedFunction

        private InterpretedFunction​(InterpreterData idata,
                                    java.lang.Object staticSecurityDomain)
    • Method Detail

      • call

        public java.lang.Object call​(Context cx,
                                     Scriptable scope,
                                     Scriptable thisObj,
                                     java.lang.Object[] args)
        Calls the function.
        Specified by:
        call in interface Callable
        Specified by:
        call in interface Function
        Overrides:
        call in class BaseFunction
        Parameters:
        cx - the current context
        scope - the scope used for the call
        thisObj - the value of "this"
        args - function arguments. Must not be null. You can use ScriptRuntime.emptyArgs to pass empty arguments.
        Returns:
        the result of the function call.
      • exec

        public java.lang.Object exec​(Context cx,
                                     Scriptable scope)
        Description copied from interface: Script
        Execute the script.

        The script is executed in a particular runtime Context, which must be associated with the current thread. The script is executed relative to a scope--definitions and uses of global top-level variables and functions will access properties of the scope object. For compliant ECMA programs, the scope must be an object that has been initialized as a global object using Context.initStandardObjects.

        Specified by:
        exec in interface Script
        Parameters:
        cx - the Context associated with the current thread
        scope - the scope to execute relative to
        Returns:
        the result of executing the script
        See Also:
        Context.initStandardObjects()
      • isScript

        public boolean isScript()
      • resumeGenerator

        public java.lang.Object resumeGenerator​(Context cx,
                                                Scriptable scope,
                                                int operation,
                                                java.lang.Object state,
                                                java.lang.Object value)
        Description copied from class: NativeFunction
        Resume execution of a suspended generator.
        Overrides:
        resumeGenerator in class NativeFunction
        Parameters:
        cx - The current context
        scope - Scope for the parent generator function
        operation - The resumption operation (next, send, etc.. )
        state - The generator state (has locals, stack, etc.)
        value - The return value of yield (if required).
        Returns:
        The next yielded value (if any)
      • getParamCount

        protected int getParamCount()
        Description copied from class: NativeFunction
        Get number of declared parameters. It should be 0 for scripts.
        Specified by:
        getParamCount in class NativeFunction
      • getParamAndVarCount

        protected int getParamAndVarCount()
        Description copied from class: NativeFunction
        Get number of declared parameters and variables defined through var statements.
        Specified by:
        getParamAndVarCount in class NativeFunction
      • hasFunctionNamed

        boolean hasFunctionNamed​(java.lang.String name)