Class NativeRegExpCtor

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

class NativeRegExpCtor extends BaseFunction
This class implements the RegExp constructor native object.

Revision History: Implementation in C by Brendan Eich Initial port to Java by Norris Boyd from jsregexp.c version 1.36 Merged up to version 1.38, which included Unicode support. Merged bug fixes in version 1.39. Merged JSFUN13_BRANCH changes up to 1.32.2.11

  • Field Details

  • Constructor Details

    • NativeRegExpCtor

      NativeRegExpCtor()
  • Method Details

    • getFunctionName

      public String getFunctionName()
      Overrides:
      getFunctionName in class BaseFunction
    • getLength

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

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

      public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
      Description copied from class: BaseFunction
      Should be overridden.
      Specified by:
      call in interface Callable
      Specified by:
      call in interface Function
      Overrides:
      call in class BaseFunction
      Parameters:
      cx - the current Context for this thread
      scope - the scope to execute the function relative to. This is set to the value returned by getParentScope() except when the function is called from a closure.
      thisObj - the JavaScript this object
      args - the array of arguments
      Returns:
      the result of the call
    • construct

      public Scriptable construct(Context cx, Scriptable scope, Object[] args)
      Description copied from interface: Function
      Call the function as a constructor.

      This method is invoked by the runtime in order to satisfy a use of the JavaScript new operator. This method is expected to create a new object and return it.

      Specified by:
      construct in interface Constructable
      Specified by:
      construct in interface Function
      Overrides:
      construct in class BaseFunction
      Parameters:
      cx - the current Context for this thread
      scope - an enclosing scope of the caller except when the function is called from a closure.
      args - the array of arguments
      Returns:
      the allocated object
    • getImpl

      private static RegExpImpl getImpl()
    • getMaxInstanceId

      protected int getMaxInstanceId()
      Description copied from class: IdScriptableObject
      Get maximum id findInstanceIdInfo can generate.
      Overrides:
      getMaxInstanceId in class BaseFunction
    • findInstanceIdInfo

      protected int findInstanceIdInfo(String s)
      Description copied from class: IdScriptableObject
      Map name to id of instance property. Should return 0 if not found or the result of IdScriptableObject.instanceIdInfo(int, int).
      Overrides:
      findInstanceIdInfo in class BaseFunction
    • getInstanceIdName

      protected String getInstanceIdName(int id)
      Description copied from class: IdScriptableObject
      Map id back to property name it defines.
      Overrides:
      getInstanceIdName in class BaseFunction
    • getInstanceIdValue

      protected Object getInstanceIdValue(int id)
      Description copied from class: IdScriptableObject
      Get id value. * If id value is constant, descendant can call cacheIdValue to store * value in the permanent cache. * Default implementation creates IdFunctionObject instance for given id * and cache its value
      Overrides:
      getInstanceIdValue in class BaseFunction
    • setInstanceIdValue

      protected void setInstanceIdValue(int id, Object value)
      Description copied from class: IdScriptableObject
      Set or delete id value. If value == NOT_FOUND , the implementation should make sure that the following getInstanceIdValue return NOT_FOUND.
      Overrides:
      setInstanceIdValue in class BaseFunction
    • setInstanceIdAttributes

      protected void setInstanceIdAttributes(int id, int attr)
      Description copied from class: IdScriptableObject
      Update the attributes of the given instance property. Classes which want to support changing property attributes via Object.defineProperty must override this method. The default implementation throws InternalError.
      Overrides:
      setInstanceIdAttributes in class BaseFunction
      Parameters:
      id - the instance property id
      attr - the new attribute bitset