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

Unified Diff: dart/frog/leg/emitter.dart

Issue 9419009: Use shared implementation of Stopwatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: address review comments Created 8 years, 10 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 | « dart/frog/leg/elements/elements.dart ('k') | dart/frog/leg/lib/clock.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/emitter.dart
diff --git a/dart/frog/leg/emitter.dart b/dart/frog/leg/emitter.dart
index 72978c3ba56c52ee7eee034138013b934fe5eb7e..efa4e405be2a5630a96c5cb5e2ddf7ab427df6cd 100644
--- a/dart/frog/leg/emitter.dart
+++ b/dart/frog/leg/emitter.dart
@@ -238,6 +238,17 @@ function(child, parent) {
for (Type ifc in classElement.interfaces) {
buffer.add('$prototype.${namer.operatorIs(ifc.element)} = true;\n');
}
+ if (superclass === null) {
+ // JS "toString" wrapper. This gives better exceptions.
+ buffer.add('$prototype.toString = function() {\n');
+ buffer.add(' try {');
+ buffer.add(' return ${namer.CURRENT_ISOLATE}');
+ buffer.add('.builtin\$toString\$0\$1(this);');
+ buffer.add(' } catch (ex) {');
+ buffer.add(' return "uncaught exception in toString";');
+ buffer.add(' }');
+ buffer.add('};\n');
+ }
}
void emitClasses(StringBuffer buffer) {
« no previous file with comments | « dart/frog/leg/elements/elements.dart ('k') | dart/frog/leg/lib/clock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698