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

Side by Side Diff: runtime/lib/string_patch.dart

Issue 920793002: Change _interpolateSingle to use the same value in errors as _interpolate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 const int _maxAscii = 0x7f; 5 const int _maxAscii = 0x7f;
6 const int _maxLatin1 = 0xff; 6 const int _maxLatin1 = 0xff;
7 const int _maxUtf16 = 0xffff; 7 const int _maxUtf16 = 0xffff;
8 const int _maxUnicode = 0x10ffff; 8 const int _maxUnicode = 0x10ffff;
9 9
10 patch class String { 10 patch class String {
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 startIndex = match.end; 792 startIndex = match.end;
793 } 793 }
794 buffer.write(onNonMatch(this.substring(startIndex))); 794 buffer.write(onNonMatch(this.substring(startIndex)));
795 return buffer.toString(); 795 return buffer.toString();
796 } 796 }
797 797
798 // Convert single object to string. 798 // Convert single object to string.
799 static String _interpolateSingle(Object o) { 799 static String _interpolateSingle(Object o) {
800 final s = o.toString(); 800 final s = o.toString();
801 if (s is! String) { 801 if (s is! String) {
802 throw new ArgumentError(o); 802 throw new ArgumentError(s);
Lasse Reichstein Nielsen 2015/02/12 13:11:09 Using "o", which we already know has a faulty toSt
Ivan Posva 2015/02/20 06:43:48 Since you know s is not a String, you could also u
sra1 2015/02/24 16:57:02 It seems a bad idea to report the wrong irritant l
803 } 803 }
804 return s; 804 return s;
805 } 805 }
806 806
807 /** 807 /**
808 * Convert all objects in [values] to strings and concat them 808 * Convert all objects in [values] to strings and concat them
809 * into a result string. 809 * into a result string.
810 * Modifies the input list if it contains non-`String` values. 810 * Modifies the input list if it contains non-`String` values.
811 */ 811 */
812 static String _interpolate(final List values) { 812 static String _interpolate(final List values) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 for (int g in groups) { 1293 for (int g in groups) {
1294 result.add(group(g)); 1294 result.add(group(g));
1295 } 1295 }
1296 return result; 1296 return result;
1297 } 1297 }
1298 1298
1299 final int start; 1299 final int start;
1300 final String input; 1300 final String input;
1301 final String pattern; 1301 final String pattern;
1302 } 1302 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698