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

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: 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
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..89b0d212e70511730b09bdd81e3c53da0ea78f2b 100644
--- a/dart/sdk/lib/core/string_buffer.dart
+++ b/dart/sdk/lib/core/string_buffer.dart
@@ -54,8 +54,8 @@ class _StringBufferImpl implements StringBuffer {
/// Adds [obj] to the buffer.
void add(Object obj) {
- String str = obj.toString();
- if (str == null || str.isEmpty) return;
+ String str = '$obj';
srdjan 2012/12/20 16:40:29 For the VM, string interpolation is slower than ca
Ivan Posva 2012/12/20 16:42:41 I do not see the purpose of this change. Please ex
ahe 2012/12/20 17:10:37 The purpose of this change is to get sane semantic
sra1 2012/12/20 19:07:41 obj.toString() should almost never be called expli
ahe 2012/12/21 11:23:38 I have changed the code to use an explicit check a
+ if (str.isEmpty) return;
_buffer.add(str);
_length += str.length;
}

Powered by Google App Engine
This is Rietveld 408576698