Thu, 07 Feb 2013 15:33:17 +0100
8007718: Make static RegExp properties fully compatible to other engines
Reviewed-by: lagergren, sundar
1.1 --- a/src/jdk/nashorn/internal/objects/Global.java Thu Feb 07 14:58:41 2013 +0100 1.2 +++ b/src/jdk/nashorn/internal/objects/Global.java Thu Feb 07 15:33:17 2013 +0100 1.3 @@ -48,6 +48,7 @@ 1.4 import jdk.nashorn.internal.runtime.NativeJavaPackage; 1.5 import jdk.nashorn.internal.runtime.OptionsObject; 1.6 import jdk.nashorn.internal.runtime.PropertyDescriptor; 1.7 +import jdk.nashorn.internal.runtime.RegExpMatch; 1.8 import jdk.nashorn.internal.runtime.Scope; 1.9 import jdk.nashorn.internal.runtime.ScriptFunction; 1.10 import jdk.nashorn.internal.runtime.ScriptObject; 1.11 @@ -337,6 +338,9 @@ 1.12 // class cache 1.13 private ClassCache classCache; 1.14 1.15 + // Used to store the last RegExp result to support deprecated RegExp constructor properties 1.16 + private RegExpMatch lastRegExpMatch; 1.17 + 1.18 private static final MethodHandle EVAL = findOwnMH("eval", Object.class, Object.class, Object.class); 1.19 private static final MethodHandle PRINT = findOwnMH("print", Object.class, Object.class, Object[].class); 1.20 private static final MethodHandle PRINTLN = findOwnMH("println", Object.class, Object.class, Object[].class); 1.21 @@ -1375,13 +1379,6 @@ 1.22 final ScriptObject regExpProto = getRegExpPrototype(); 1.23 regExpProto.addBoundProperties(DEFAULT_REGEXP); 1.24 1.25 - // add hook to support "deprecated" "static" properties of RegExp constructor object 1.26 - final ScriptFunction handler = ScriptFunctionImpl.makeFunction(NO_SUCH_METHOD_NAME, NativeRegExp.REGEXP_STATICS_HANDLER); 1.27 - builtinRegExp.addOwnProperty(NO_SUCH_PROPERTY_NAME, Attribute.NOT_ENUMERABLE, handler); 1.28 - 1.29 - // add initial undefined "last successful match" property RegExp 1.30 - builtinRegExp.addOwnProperty(NativeRegExp.LAST_REGEXP_MATCH, Attribute.NOT_ENUMERABLE, UNDEFINED); 1.31 - 1.32 // Error stuff 1.33 initErrorObjects(); 1.34 1.35 @@ -1703,4 +1700,13 @@ 1.36 private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { 1.37 return MH.findStatic(MethodHandles.publicLookup(), Global.class, name, MH.type(rtype, types)); 1.38 } 1.39 + 1.40 + RegExpMatch getLastRegExpMatch() { 1.41 + return lastRegExpMatch; 1.42 + } 1.43 + 1.44 + void setLastRegExpMatch(RegExpMatch regExpMatch) { 1.45 + this.lastRegExpMatch = regExpMatch; 1.46 + } 1.47 + 1.48 }
2.1 --- a/src/jdk/nashorn/internal/objects/NativeRegExp.java Thu Feb 07 14:58:41 2013 +0100 2.2 +++ b/src/jdk/nashorn/internal/objects/NativeRegExp.java Thu Feb 07 15:33:17 2013 +0100 2.3 @@ -27,10 +27,7 @@ 2.4 2.5 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; 2.6 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; 2.7 -import static jdk.nashorn.internal.runtime.linker.Lookup.MH; 2.8 2.9 -import java.lang.invoke.MethodHandle; 2.10 -import java.lang.invoke.MethodHandles; 2.11 import java.util.ArrayList; 2.12 import java.util.Arrays; 2.13 import java.util.List; 2.14 @@ -43,6 +40,7 @@ 2.15 import jdk.nashorn.internal.objects.annotations.Property; 2.16 import jdk.nashorn.internal.objects.annotations.ScriptClass; 2.17 import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; 2.18 +import jdk.nashorn.internal.objects.annotations.Where; 2.19 import jdk.nashorn.internal.parser.RegExp; 2.20 import jdk.nashorn.internal.runtime.BitVector; 2.21 import jdk.nashorn.internal.runtime.JSType; 2.22 @@ -57,8 +55,6 @@ 2.23 */ 2.24 @ScriptClass("RegExp") 2.25 public final class NativeRegExp extends ScriptObject { 2.26 - static final MethodHandle REGEXP_STATICS_HANDLER = findOwnMH("regExpStaticsHandler", Object.class, Object.class, Object.class); 2.27 - 2.28 /** ECMA 15.10.7.5 lastIndex property */ 2.29 @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE) 2.30 public Object lastIndex; 2.31 @@ -80,8 +76,8 @@ 2.32 2.33 private BitVector groupsInNegativeLookahead; 2.34 2.35 - // RegExp constructor object. Needed to support RegExp "static" properties, 2.36 - private Object constructor; 2.37 + // Reference to global object needed to support static RegExp properties 2.38 + private Global globalObject; 2.39 2.40 /* 2.41 public NativeRegExp() { 2.42 @@ -329,7 +325,7 @@ 2.43 * @param self self reference 2.44 * @return the input string for the regexp 2.45 */ 2.46 - @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE | Attribute.NOT_WRITABLE) 2.47 + @Getter(attributes = Attribute.NON_ENUMERABLE_CONSTANT) 2.48 public static Object source(final Object self) { 2.49 return checkRegExp(self).input; 2.50 } 2.51 @@ -340,7 +336,7 @@ 2.52 * @param self self reference 2.53 * @return true if this regexp is flagged global, false otherwise 2.54 */ 2.55 - @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE | Attribute.NOT_WRITABLE) 2.56 + @Getter(attributes = Attribute.NON_ENUMERABLE_CONSTANT) 2.57 public static Object global(final Object self) { 2.58 return checkRegExp(self).global; 2.59 } 2.60 @@ -351,7 +347,7 @@ 2.61 * @param self self reference 2.62 * @return true if this regexp if flagged to ignore case, false otherwise 2.63 */ 2.64 - @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE | Attribute.NOT_WRITABLE) 2.65 + @Getter(attributes = Attribute.NON_ENUMERABLE_CONSTANT) 2.66 public static Object ignoreCase(final Object self) { 2.67 return checkRegExp(self).ignoreCase; 2.68 } 2.69 @@ -362,11 +358,175 @@ 2.70 * @param self self reference 2.71 * @return true if this regexp is flagged to be multiline, false otherwise 2.72 */ 2.73 - @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE | Attribute.NOT_WRITABLE) 2.74 + @Getter(attributes = Attribute.NON_ENUMERABLE_CONSTANT) 2.75 public static Object multiline(final Object self) { 2.76 return checkRegExp(self).multiline; 2.77 } 2.78 2.79 + /** 2.80 + * Getter for non-standard RegExp.input property. 2.81 + * @param self self object 2.82 + * @return last regexp input 2.83 + */ 2.84 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "input") 2.85 + public static Object getLastInput(Object self) { 2.86 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.87 + return match == null ? "" : match.getInput(); 2.88 + } 2.89 + 2.90 + /** 2.91 + * Getter for non-standard RegExp.multiline property. 2.92 + * @param self self object 2.93 + * @return last regexp input 2.94 + */ 2.95 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "multiline") 2.96 + public static Object getLastMultiline(Object self) { 2.97 + return false; // doesn't ever seem to become true and isn't documented anyhwere 2.98 + } 2.99 + 2.100 + /** 2.101 + * Getter for non-standard RegExp.lastMatch property. 2.102 + * @param self self object 2.103 + * @return last regexp input 2.104 + */ 2.105 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "lastMatch") 2.106 + public static Object getLastMatch(Object self) { 2.107 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.108 + return match == null ? "" : match.getGroup(0); 2.109 + } 2.110 + 2.111 + /** 2.112 + * Getter for non-standard RegExp.lastParen property. 2.113 + * @param self self object 2.114 + * @return last regexp input 2.115 + */ 2.116 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "lastParen") 2.117 + public static Object getLastParen(Object self) { 2.118 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.119 + return match == null ? "" : match.getLastParen(); 2.120 + } 2.121 + 2.122 + /** 2.123 + * Getter for non-standard RegExp.leftContext property. 2.124 + * @param self self object 2.125 + * @return last regexp input 2.126 + */ 2.127 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "leftContext") 2.128 + public static Object getLeftContext(Object self) { 2.129 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.130 + return match == null ? "" : match.getInput().substring(0, match.getIndex()); 2.131 + } 2.132 + 2.133 + /** 2.134 + * Getter for non-standard RegExp.rightContext property. 2.135 + * @param self self object 2.136 + * @return last regexp input 2.137 + */ 2.138 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "rightContext") 2.139 + public static Object getRightContext(Object self) { 2.140 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.141 + return match == null ? "" : match.getInput().substring(match.getIndex() + match.length()); 2.142 + } 2.143 + 2.144 + /** 2.145 + * Getter for non-standard RegExp.$1 property. 2.146 + * @param self self object 2.147 + * @return last regexp input 2.148 + */ 2.149 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$1") 2.150 + public static Object getGroup1(Object self) { 2.151 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.152 + return match == null ? "" : match.getGroup(1); 2.153 + } 2.154 + 2.155 + /** 2.156 + * Getter for non-standard RegExp.$2 property. 2.157 + * @param self self object 2.158 + * @return last regexp input 2.159 + */ 2.160 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$2") 2.161 + public static Object getGroup2(Object self) { 2.162 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.163 + return match == null ? "" : match.getGroup(2); 2.164 + } 2.165 + 2.166 + /** 2.167 + * Getter for non-standard RegExp.$3 property. 2.168 + * @param self self object 2.169 + * @return last regexp input 2.170 + */ 2.171 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$3") 2.172 + public static Object getGroup3(Object self) { 2.173 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.174 + return match == null ? "" : match.getGroup(3); 2.175 + } 2.176 + 2.177 + /** 2.178 + * Getter for non-standard RegExp.$4 property. 2.179 + * @param self self object 2.180 + * @return last regexp input 2.181 + */ 2.182 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$4") 2.183 + public static Object getGroup4(Object self) { 2.184 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.185 + return match == null ? "" : match.getGroup(4); 2.186 + } 2.187 + 2.188 + /** 2.189 + * Getter for non-standard RegExp.$5 property. 2.190 + * @param self self object 2.191 + * @return last regexp input 2.192 + */ 2.193 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$5") 2.194 + public static Object getGroup5(Object self) { 2.195 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.196 + return match == null ? "" : match.getGroup(5); 2.197 + } 2.198 + 2.199 + /** 2.200 + * Getter for non-standard RegExp.$6 property. 2.201 + * @param self self object 2.202 + * @return last regexp input 2.203 + */ 2.204 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$6") 2.205 + public static Object getGroup6(Object self) { 2.206 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.207 + return match == null ? "" : match.getGroup(6); 2.208 + } 2.209 + 2.210 + /** 2.211 + * Getter for non-standard RegExp.$7 property. 2.212 + * @param self self object 2.213 + * @return last regexp input 2.214 + */ 2.215 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$7") 2.216 + public static Object getGroup7(Object self) { 2.217 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.218 + return match == null ? "" : match.getGroup(7); 2.219 + } 2.220 + 2.221 + /** 2.222 + * Getter for non-standard RegExp.$8 property. 2.223 + * @param self self object 2.224 + * @return last regexp input 2.225 + */ 2.226 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$8") 2.227 + public static Object getGroup8(Object self) { 2.228 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.229 + return match == null ? "" : match.getGroup(8); 2.230 + } 2.231 + 2.232 + /** 2.233 + * Getter for non-standard RegExp.$9 property. 2.234 + * @param self self object 2.235 + * @return last regexp input 2.236 + */ 2.237 + @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$9") 2.238 + public static Object getGroup9(Object self) { 2.239 + final RegExpMatch match = Global.instance().getLastRegExpMatch(); 2.240 + return match == null ? "" : match.getGroup(9); 2.241 + } 2.242 + 2.243 private RegExpMatch execInner(final String string) { 2.244 if (this.pattern == null) { 2.245 return null; // never matches or similar, e.g. a[] 2.246 @@ -389,7 +549,9 @@ 2.247 setLastIndex(matcher.end()); 2.248 } 2.249 2.250 - return new RegExpMatch(string, matcher.start(), groups(matcher)); 2.251 + final RegExpMatch match = new RegExpMatch(string, matcher.start(), groups(matcher)); 2.252 + globalObject.setLastRegExpMatch(match); 2.253 + return match; 2.254 } 2.255 2.256 /** 2.257 @@ -425,84 +587,13 @@ 2.258 * @return NativeArray of matches, string or null. 2.259 */ 2.260 public Object exec(final String string) { 2.261 - final RegExpMatch m = execInner(string); 2.262 - // the input string 2.263 - if (m == null) { 2.264 - return setLastRegExpMatch(null); 2.265 + final RegExpMatch match = execInner(string); 2.266 + 2.267 + if (match == null) { 2.268 + return null; 2.269 } 2.270 2.271 - return setLastRegExpMatch(new NativeRegExpExecResult(m)); 2.272 - } 2.273 - 2.274 - // Name of the "last successful match" property of the RegExp constructor 2.275 - static final String LAST_REGEXP_MATCH = "__last_regexp_match__"; 2.276 - 2.277 - /** 2.278 - * Handles "static" properties of RegExp constructor. These are "deprecated" 2.279 - * properties of RegExp constructor. 2.280 - * 2.281 - * @param self self object passed to this method 2.282 - * @param name name of the property being searched 2.283 - * 2.284 - * @return value of the specified property or undefined if not found 2.285 - */ 2.286 - public static Object regExpStaticsHandler(final Object self, final Object name) { 2.287 - final String propName = JSType.toString(name); 2.288 - if (self instanceof ScriptObject) { 2.289 - final ScriptObject sobj = (ScriptObject)self; 2.290 - final Object value = sobj.get(LAST_REGEXP_MATCH); 2.291 - if (! (value instanceof NativeRegExpExecResult)) { 2.292 - return UNDEFINED; 2.293 - } 2.294 - 2.295 - // get the last match object 2.296 - final NativeRegExpExecResult lastMatch = (NativeRegExpExecResult)value; 2.297 - 2.298 - // look for $1... $9 2.299 - if (propName.length() > 0 && propName.charAt(0) == '$') { 2.300 - int index = 0; 2.301 - try { 2.302 - index = Integer.parseInt(propName.substring(1)); 2.303 - } catch (final Exception ignored) { 2.304 - return UNDEFINED; 2.305 - } 2.306 - 2.307 - // index out of range 2.308 - if (index < 1 && index > 9) { 2.309 - return UNDEFINED; 2.310 - } 2.311 - 2.312 - // retrieve indexed value from last match object. 2.313 - return lastMatch.get(index); 2.314 - } 2.315 - 2.316 - // misc. "static" properties supported 2.317 - switch (propName) { 2.318 - case "input": { 2.319 - return lastMatch.input; 2.320 - } 2.321 - 2.322 - case "lastMatch": { 2.323 - return lastMatch.get(0); 2.324 - } 2.325 - 2.326 - case "lastParen": { 2.327 - final int len = ((Number)NativeRegExpExecResult.length(lastMatch)).intValue(); 2.328 - return (len > 0)? lastMatch.get(len - 1) : UNDEFINED; 2.329 - } 2.330 - } 2.331 - } 2.332 - 2.333 - return UNDEFINED; 2.334 - } 2.335 - 2.336 - // Support for RegExp static properties. We set last successful match 2.337 - // to the RegExp constructor object. 2.338 - private Object setLastRegExpMatch(final Object match) { 2.339 - if (constructor instanceof ScriptObject) { 2.340 - ((ScriptObject)constructor).set(LAST_REGEXP_MATCH, match, isStrictContext()); 2.341 - } 2.342 - return match; 2.343 + return new NativeRegExpExecResult(match); 2.344 } 2.345 2.346 /** 2.347 @@ -744,15 +835,13 @@ 2.348 * @return Index of match. 2.349 */ 2.350 Object search(final String string) { 2.351 - final RegExpMatch m = execInner(string); 2.352 - // the input string 2.353 - if (m == null) { 2.354 - setLastRegExpMatch(null); 2.355 + final RegExpMatch match = execInner(string); 2.356 + 2.357 + if (match == null) { 2.358 return -1; 2.359 } 2.360 2.361 - setLastRegExpMatch(new NativeRegExpExecResult(m)); 2.362 - return m.getIndex(); 2.363 + return match.getIndex(); 2.364 } 2.365 2.366 /** 2.367 @@ -780,10 +869,9 @@ 2.368 } 2.369 2.370 private void init() { 2.371 - final ScriptObject proto = Global.instance().getRegExpPrototype(); 2.372 - this.setProto(proto); 2.373 - // retrieve constructor to support "static" properties of RegExp 2.374 - this.constructor = PrototypeObject.getConstructor(proto); 2.375 + // Keep reference to global object to support "static" properties of RegExp 2.376 + this.globalObject = Global.instance(); 2.377 + this.setProto(globalObject.getRegExpPrototype()); 2.378 } 2.379 2.380 private static NativeRegExp checkRegExp(final Object self) { 2.381 @@ -846,7 +934,4 @@ 2.382 this.groupsInNegativeLookahead = groupsInNegativeLookahead; 2.383 } 2.384 2.385 - private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { 2.386 - return MH.findStatic(MethodHandles.publicLookup(), NativeRegExp.class, name, MH.type(rtype, types)); 2.387 - } 2.388 }
3.1 --- a/src/jdk/nashorn/internal/runtime/RegExpMatch.java Thu Feb 07 14:58:41 2013 +0100 3.2 +++ b/src/jdk/nashorn/internal/runtime/RegExpMatch.java Thu Feb 07 15:33:17 2013 +0100 3.3 @@ -77,4 +77,22 @@ 3.4 public int length() { 3.5 return ((String)groups[0]).length(); 3.6 } 3.7 + 3.8 + /** 3.9 + * Get the group with the given index or the empty string if group index is not valid. 3.10 + * @param index the group index 3.11 + * @return the group or "" 3.12 + */ 3.13 + public Object getGroup(int index) { 3.14 + return index >= 0 && index < groups.length ? groups[index] : ""; 3.15 + } 3.16 + 3.17 + /** 3.18 + * Get the last parenthesis group, or the empty string if none exists. 3.19 + * @return the last group or "" 3.20 + */ 3.21 + public Object getLastParen() { 3.22 + return groups.length > 1 ? groups[groups.length - 1] : ""; 3.23 + } 3.24 + 3.25 }
4.1 --- a/src/jdk/nashorn/internal/runtime/ScriptObject.java Thu Feb 07 14:58:41 2013 +0100 4.2 +++ b/src/jdk/nashorn/internal/runtime/ScriptObject.java Thu Feb 07 15:33:17 2013 +0100 4.3 @@ -89,10 +89,10 @@ 4.4 public abstract class ScriptObject extends PropertyListenerManager implements PropertyAccess { 4.5 4.6 /** Search fall back routine name for "no such method" */ 4.7 - public static final String NO_SUCH_METHOD_NAME = "__noSuchMethod__"; 4.8 + static final String NO_SUCH_METHOD_NAME = "__noSuchMethod__"; 4.9 4.10 /** Search fall back routine name for "no such property" */ 4.11 - public static final String NO_SUCH_PROPERTY_NAME = "__noSuchProperty__"; 4.12 + static final String NO_SUCH_PROPERTY_NAME = "__noSuchProperty__"; 4.13 4.14 /** Per ScriptObject flag - is this a scope object? */ 4.15 public static final int IS_SCOPE = 0b0000_0001;
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/script/basic/JDK-8007718.js Thu Feb 07 15:33:17 2013 +0100 5.3 @@ -0,0 +1,55 @@ 5.4 +/* 5.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 + * 5.8 + * This code is free software; you can redistribute it and/or modify it 5.9 + * under the terms of the GNU General Public License version 2 only, as 5.10 + * published by the Free Software Foundation. 5.11 + * 5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 + * version 2 for more details (a copy is included in the LICENSE file that 5.16 + * accompanied this code). 5.17 + * 5.18 + * You should have received a copy of the GNU General Public License version 5.19 + * 2 along with this work; if not, write to the Free Software Foundation, 5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 + * 5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 + * or visit www.oracle.com if you need additional information or have any 5.24 + * questions. 5.25 + */ 5.26 + 5.27 +/** 5.28 + * JDK-8007718: Make static RegExp properties fully compatible to other engines 5.29 + * 5.30 + * @test 5.31 + * @run 5.32 + */ 5.33 + 5.34 +function dumpRegExpProperties() { 5.35 + for (var p in RegExp) { 5.36 + print(p, RegExp[p], typeof RegExp[p]); 5.37 + } 5.38 +} 5.39 + 5.40 +dumpRegExpProperties(); 5.41 + 5.42 +/abc/.exec("xyz"); 5.43 +dumpRegExpProperties(); 5.44 + 5.45 +/(b)(a)(r)/gmi.exec("FOOBARfoo"); 5.46 +dumpRegExpProperties(); 5.47 + 5.48 +"abcdefghijklmnopq".match(/(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)/); 5.49 +dumpRegExpProperties(); 5.50 + 5.51 +"abcabcabcABCabcABC".split(/(b)/i); 5.52 +dumpRegExpProperties(); 5.53 + 5.54 +"foobarfoo".search(/bar/); 5.55 +dumpRegExpProperties(); 5.56 + 5.57 +/abc/.exec("xyz"); 5.58 +dumpRegExpProperties();
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/script/basic/JDK-8007718.js.EXPECTED Thu Feb 07 15:33:17 2013 +0100 6.3 @@ -0,0 +1,105 @@ 6.4 +input string 6.5 +multiline false boolean 6.6 +lastMatch string 6.7 +lastParen string 6.8 +leftContext string 6.9 +rightContext string 6.10 +$1 string 6.11 +$2 string 6.12 +$3 string 6.13 +$4 string 6.14 +$5 string 6.15 +$6 string 6.16 +$7 string 6.17 +$8 string 6.18 +$9 string 6.19 +input string 6.20 +multiline false boolean 6.21 +lastMatch string 6.22 +lastParen string 6.23 +leftContext string 6.24 +rightContext string 6.25 +$1 string 6.26 +$2 string 6.27 +$3 string 6.28 +$4 string 6.29 +$5 string 6.30 +$6 string 6.31 +$7 string 6.32 +$8 string 6.33 +$9 string 6.34 +input FOOBARfoo string 6.35 +multiline false boolean 6.36 +lastMatch BAR string 6.37 +lastParen R string 6.38 +leftContext FOO string 6.39 +rightContext foo string 6.40 +$1 B string 6.41 +$2 A string 6.42 +$3 R string 6.43 +$4 string 6.44 +$5 string 6.45 +$6 string 6.46 +$7 string 6.47 +$8 string 6.48 +$9 string 6.49 +input abcdefghijklmnopq string 6.50 +multiline false boolean 6.51 +lastMatch abcdefghijk string 6.52 +lastParen k string 6.53 +leftContext string 6.54 +rightContext lmnopq string 6.55 +$1 a string 6.56 +$2 b string 6.57 +$3 c string 6.58 +$4 d string 6.59 +$5 e string 6.60 +$6 f string 6.61 +$7 g string 6.62 +$8 h string 6.63 +$9 i string 6.64 +input abcabcabcABCabcABC string 6.65 +multiline false boolean 6.66 +lastMatch B string 6.67 +lastParen B string 6.68 +leftContext abcabcabcABCabcA string 6.69 +rightContext C string 6.70 +$1 B string 6.71 +$2 string 6.72 +$3 string 6.73 +$4 string 6.74 +$5 string 6.75 +$6 string 6.76 +$7 string 6.77 +$8 string 6.78 +$9 string 6.79 +input foobarfoo string 6.80 +multiline false boolean 6.81 +lastMatch bar string 6.82 +lastParen string 6.83 +leftContext foo string 6.84 +rightContext foo string 6.85 +$1 string 6.86 +$2 string 6.87 +$3 string 6.88 +$4 string 6.89 +$5 string 6.90 +$6 string 6.91 +$7 string 6.92 +$8 string 6.93 +$9 string 6.94 +input foobarfoo string 6.95 +multiline false boolean 6.96 +lastMatch bar string 6.97 +lastParen string 6.98 +leftContext foo string 6.99 +rightContext foo string 6.100 +$1 string 6.101 +$2 string 6.102 +$3 string 6.103 +$4 string 6.104 +$5 string 6.105 +$6 string 6.106 +$7 string 6.107 +$8 string 6.108 +$9 string