nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java
changeset 16256 f2d9a0c49914
parent 16240 e1468b33e201
child 16258 0e25f785df4d
equal deleted inserted replaced
16255:cb52a2524ca8 16256:f2d9a0c49914
   222         if (regexp != UNDEFINED) {
   222         if (regexp != UNDEFINED) {
   223             if (regexp instanceof NativeRegExp) {
   223             if (regexp instanceof NativeRegExp) {
   224                 if (!flagsDefined) {
   224                 if (!flagsDefined) {
   225                     return (NativeRegExp)regexp; // 15.10.3.1 - undefined flags and regexp as
   225                     return (NativeRegExp)regexp; // 15.10.3.1 - undefined flags and regexp as
   226                 }
   226                 }
   227                 typeError("regex.cant.supply.flags");
   227                 throw typeError("regex.cant.supply.flags");
   228             }
   228             }
   229             patternString = JSType.toString(regexp);
   229             patternString = JSType.toString(regexp);
   230         }
   230         }
   231 
   231 
   232         return new NativeRegExp(patternString, flagString);
   232         return new NativeRegExp(patternString, flagString);
   878         if (self instanceof NativeRegExp) {
   878         if (self instanceof NativeRegExp) {
   879             return (NativeRegExp)self;
   879             return (NativeRegExp)self;
   880         } else if (self != null && self == Global.instance().getRegExpPrototype()) {
   880         } else if (self != null && self == Global.instance().getRegExpPrototype()) {
   881             return Global.instance().DEFAULT_REGEXP;
   881             return Global.instance().DEFAULT_REGEXP;
   882         } else {
   882         } else {
   883             typeError("not.a.regexp", ScriptRuntime.safeToString(self));
   883             throw typeError("not.a.regexp", ScriptRuntime.safeToString(self));
   884             return null;
       
   885         }
   884         }
   886     }
   885     }
   887 
   886 
   888     private String getInput() {
   887     private String getInput() {
   889         return input;
   888         return input;