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

Print this page




  36 import jdk.nashorn.internal.runtime.ScriptObject;
  37 import jdk.nashorn.internal.runtime.arrays.ArrayData;
  38 
  39 /**
  40  * Objects of this class are used to represent return values from
  41  * RegExp.prototype.exec method.
  42  */
  43 @ScriptClass("RegExpExecResult")
  44 public final class NativeRegExpExecResult extends ScriptObject {
  45     /** index property */
  46     @Property
  47     public Object index;
  48 
  49     /** input property */
  50     @Property
  51     public Object input;
  52 
  53     // initialized by nasgen
  54     private static PropertyMap $nasgenmap$;
  55 
  56     static PropertyMap getInitialMap() {
  57         return $nasgenmap$;
  58     }
  59 
  60     NativeRegExpExecResult(final RegExpResult result, final Global global) {
  61         super(global.getArrayPrototype(), getInitialMap());
  62         setIsArray();
  63         this.setArray(ArrayData.allocate(result.getGroups().clone()));
  64         this.index = result.getIndex();
  65         this.input = result.getInput();
  66     }
  67 
  68     @Override
  69     public String getClassName() {
  70         return "Array";
  71     }
  72 
  73     /**
  74      * Length getter
  75      * @param self self reference
  76      * @return length property value
  77      */
  78     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
  79     public static Object length(final Object self) {
  80         if (self instanceof ScriptObject) {
  81             return ((ScriptObject)self).getArray().length() & JSType.MAX_UINT;


  36 import jdk.nashorn.internal.runtime.ScriptObject;
  37 import jdk.nashorn.internal.runtime.arrays.ArrayData;
  38 
  39 /**
  40  * Objects of this class are used to represent return values from
  41  * RegExp.prototype.exec method.
  42  */
  43 @ScriptClass("RegExpExecResult")
  44 public final class NativeRegExpExecResult extends ScriptObject {
  45     /** index property */
  46     @Property
  47     public Object index;
  48 
  49     /** input property */
  50     @Property
  51     public Object input;
  52 
  53     // initialized by nasgen
  54     private static PropertyMap $nasgenmap$;
  55 




  56     NativeRegExpExecResult(final RegExpResult result, final Global global) {
  57         super(global.getArrayPrototype(), $nasgenmap$);
  58         setIsArray();
  59         this.setArray(ArrayData.allocate(result.getGroups().clone()));
  60         this.index = result.getIndex();
  61         this.input = result.getInput();
  62     }
  63 
  64     @Override
  65     public String getClassName() {
  66         return "Array";
  67     }
  68 
  69     /**
  70      * Length getter
  71      * @param self self reference
  72      * @return length property value
  73      */
  74     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
  75     public static Object length(final Object self) {
  76         if (self instanceof ScriptObject) {
  77             return ((ScriptObject)self).getArray().length() & JSType.MAX_UINT;