Class NativeFunction

All Implemented Interfaces:
Serializable, Callable, ConstProperties, Constructable, DebuggableObject, Function, IdFunctionCall, Scriptable, SymbolScriptable

public abstract class NativeFunction extends BaseFunction
This class implements the Function native object. See ECMA 15.3.
Author:
Norris Boyd
See Also:
  • Constructor Details

    • NativeFunction

      public NativeFunction()
  • Method Details

    • initScriptFunction

      public final void initScriptFunction(Context cx, Scriptable scope)
    • initScriptFunction

      public final void initScriptFunction(Context cx, Scriptable scope, boolean es6GeneratorFunction)
    • getLength

      public int getLength()
      Overrides:
      getLength in class BaseFunction
    • getArity

      public int getArity()
      Overrides:
      getArity in class BaseFunction
    • jsGet_name

      @Deprecated public String jsGet_name()
      Deprecated.
      Use BaseFunction.getFunctionName() instead. For backwards compatibility keep an old method name used by Batik and possibly others.
    • getRawSource

      public String getRawSource()
      Get raw source string.
    • getDebuggableView

      public DebuggableScript getDebuggableView()
    • resumeGenerator

      public Object resumeGenerator(Context cx, Scriptable scope, int operation, Object state, Object value)
      Resume execution of a suspended generator.
      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)
    • getLanguageVersion

      protected abstract int getLanguageVersion()
    • getParamCount

      protected abstract int getParamCount()
      Get number of declared parameters. It should be 0 for scripts.
    • getParamAndVarCount

      protected abstract int getParamAndVarCount()
      Get number of declared parameters and variables defined through var statements.
    • getParamOrVarName

      protected abstract String getParamOrVarName(int index)
      Get parameter or variable name. If index < getParamCount(), then return the name of the corresponding parameter. Otherwise return the name of variable.
    • getParamOrVarConst

      protected boolean getParamOrVarConst(int index)
      Get parameter or variable const-ness. If index < getParamCount(), then return the const-ness of the corresponding parameter. Otherwise return whether the variable is const.