| commit | 219d6d630dd3b462b7ed6ce3560e5f660dbc6e0e | [log] [tgz] |
|---|---|---|
| author | Goktug Gokdogan <goktug@google.com> | Wed May 21 18:13:11 2014 -0700 |
| committer | Goktug Gokdogan <goktug@google.com> | Thu May 22 01:31:14 2014 +0000 |
| tree | e21d6dae738208bc2ecc1da08416d462253bfee3 | |
| parent | cfb137bde7b69486ab78ff9739563a25f63fac84 [diff] |
Gets rid of RegExp. from StacktraceCreator to make Jscompiler happy Change-Id: I7ee944b1e876b4cf9eced5c1c86b6ab7b9698f37
diff --git a/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java b/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java index 91fba43..2087943 100644 --- a/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java +++ b/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java
@@ -454,7 +454,8 @@ static native String extractFunctionName(String fnName) /*-{ var fnRE = /function(?:\s+([\w$]+))?\s*\(/; - return (fnRE.test(fnName) && RegExp.$1) || @StackTraceCreator::ANONYMOUS; + var match = fnRE.exec(fnName); + return (match && match[1]) || @StackTraceCreator::ANONYMOUS; }-*/; private static native <T> T splice(T arr, int length) /*-{
diff --git a/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java b/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java index ef00a61..c912264 100644 --- a/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java +++ b/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java
@@ -42,6 +42,8 @@ assertEquals("foo", extractFunctionName("function foo(){}")); assertEquals("foo", extractFunctionName("function foo (){}")); assertEquals("foo", extractFunctionName(" function foo (){}")); + // In an unlikely case if somebody overrides fn.toString + assertEquals("anonymous", extractFunctionName("abc")); } public void testChromeExtractName() {