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

Unified Diff: dart/sdk/lib/core/string_buffer.dart

Issue 11618037: Make StringBuffer and interpolation behave the same. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and addressed review comments Created 8 years 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 | « no previous file | dart/tests/language/string_interpolation_and_buffer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/core/string_buffer.dart
diff --git a/dart/sdk/lib/core/string_buffer.dart b/dart/sdk/lib/core/string_buffer.dart
index 3c517ea86be339d847b6ed71b7ec5ad17a60c50f..fda711180b87694cca9e8c48621ecef622115e4f 100644
--- a/dart/sdk/lib/core/string_buffer.dart
+++ b/dart/sdk/lib/core/string_buffer.dart
@@ -54,8 +54,13 @@ class _StringBufferImpl implements StringBuffer {
/// Adds [obj] to the buffer.
void add(Object obj) {
+ // TODO(srdjan): The following four lines could be replaced by
+ // '$obj', but apparently this is too slow on the Dart VM.
String str = obj.toString();
- if (str == null || str.isEmpty) return;
+ if (str is !String) {
+ throw new ArgumentError('toString() did not return a string');
+ }
+ if (str.isEmpty) return;
_buffer.add(str);
_length += str.length;
}
« no previous file with comments | « no previous file | dart/tests/language/string_interpolation_and_buffer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698