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

Side by Side Diff: lib/src/intl/number_format.dart

Issue 878603009: Tighten up a couple method signatures to specify that int is required. (Closed) Base URL: git@github.com:dart-lang/intl.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « lib/src/intl/date_format_helpers.dart ('k') | pubspec.yaml » ('j') | 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 part of intl; 5 part of intl;
6 /** 6 /**
7 * Provides the ability to format a number in a locale-specific way. The 7 * Provides the ability to format a number in a locale-specific way. The
8 * format is specified as a pattern using a subset of the ICU formatting 8 * format is specified as a pattern using a subset of the ICU formatting
9 * patterns. 9 * patterns.
10 * 10 *
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 if (digit != null) { 703 if (digit != null) {
704 _normalized.writeCharCode(_zero + digit); 704 _normalized.writeCharCode(_zero + digit);
705 input.next(); 705 input.next();
706 } else { 706 } else {
707 processNonDigit(); 707 processNonDigit();
708 } 708 }
709 checkSuffixes(); 709 checkSuffixes();
710 } 710 }
711 711
712 var normalizedText = _normalized.toString(); 712 var normalizedText = _normalized.toString();
713 var parsed = int.parse(normalizedText, onError: (message) => null); 713 num parsed = int.parse(normalizedText, onError: (message) => null);
Alan Knight 2015/01/27 21:10:18 It's minor but I don't love this. Especially when
714 if (parsed == null) parsed = double.parse(normalizedText); 714 if (parsed == null) parsed = double.parse(normalizedText);
715 return parsed / scale; 715 return parsed / scale;
716 } 716 }
717 } 717 }
718 718
719 /** 719 /**
720 * Private class that parses the numeric formatting pattern and sets the 720 * Private class that parses the numeric formatting pattern and sets the
721 * variables in [format] to appropriate values. Instances of this are 721 * variables in [format] to appropriate values. Instances of this are
722 * transient and store parsing state in instance variables, so can only be used 722 * transient and store parsing state in instance variables, so can only be used
723 * to parse a single pattern. 723 * to parse a single pattern.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 String get peek => nextIndex >= input.length ? null : input[nextIndex]; 1061 String get peek => nextIndex >= input.length ? null : input[nextIndex];
1062 1062
1063 Iterator<String> get iterator => this; 1063 Iterator<String> get iterator => this;
1064 1064
1065 static String _validate(input) { 1065 static String _validate(input) {
1066 if (input is! String) throw new ArgumentError(input); 1066 if (input is! String) throw new ArgumentError(input);
1067 return input; 1067 return input;
1068 } 1068 }
1069 1069
1070 } 1070 }
OLDNEW
« no previous file with comments | « lib/src/intl/date_format_helpers.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698