Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: lib/isolate/frog/isolateimpl.dart

Issue 10539104: Give static functions that have a getter a name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/namer.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/isolate/frog/isolateimpl.dart
diff --git a/lib/isolate/frog/isolateimpl.dart b/lib/isolate/frog/isolateimpl.dart
index c3a261f39a3159666b632d626352be30a728fafc..b66c5e299de547759645a0bded1de8afd2190536 100644
--- a/lib/isolate/frog/isolateimpl.dart
+++ b/lib/isolate/frog/isolateimpl.dart
@@ -523,28 +523,7 @@ class _IsolateNatives {
* but you should probably not count on this.
*/
static String _getJSFunctionName(Function f)
- // Comments on the code, outside of the string so they won't bulk up
- // the native output:
- //
- // Are we in a browser that implements the non-standard but
- // oh-so-convenient function .name property? If not, parse the name
- // out of toString().
- //
- // When there is a match, our capture is element 1 of the results list.
- // If there is no match, match() returns null; we || this to a list
- // whose element 1 is null so everything lines up without error.
- //
- // TODO(eub): remove the toString workaround by attaching names to
- // functions where they could be needed. For a simple
- // conservative approximation of "needed", see Siggi's option (c)
- // in discussion on the CL, 9416119.
- native @"""
- if (typeof(f.name) === 'undefined') {
- return (f.toString().match(/function (.+)\(/) || [, (void 0)])[1];
- } else {
- return f.name || (void 0);
- }
- """;
+ native @"return f.$name || (void 0);";
/** Create a new JavaScript object instance given its constructor. */
static Dynamic _allocate(var ctor) native "return new ctor();";
« no previous file with comments | « lib/compiler/implementation/namer.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698