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

Side by Side Diff: pkg/intl/lib/date_format_field.dart

Issue 10917006: More uses of the new try-catch syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « pkg/fixnum/test/int_64_vm_test.dart ('k') | pkg/unittest/core_matchers.dart » ('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 /** 5 /**
6 * This is a private class internal to DateFormat which is used for formatting 6 * This is a private class internal to DateFormat which is used for formatting
7 * particular fields in a template. e.g. if the format is hh:mm:ss then the 7 * particular fields in a template. e.g. if the format is hh:mm:ss then the
8 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows 8 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows
9 * how to format that portion of a date. 9 * how to format that portion of a date.
10 */ 10 */
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 case 'm': handleNumericField(input, builder.setMinute); break; // minutes 138 case 'm': handleNumericField(input, builder.setMinute); break; // minutes
139 case 'Q': break; // quarter 139 case 'Q': break; // quarter
140 case 'S': handleNumericField(input, builder.setFractionalSecond); break; 140 case 'S': handleNumericField(input, builder.setFractionalSecond); break;
141 case 's': handleNumericField(input, builder.setSecond); break; 141 case 's': handleNumericField(input, builder.setSecond); break;
142 case 'v': break; // time zone id 142 case 'v': break; // time zone id
143 case 'y': handleNumericField(input, builder.setYear); break; 143 case 'y': handleNumericField(input, builder.setYear); break;
144 case 'z': break; // time zone 144 case 'z': break; // time zone
145 case 'Z': break; // time zone RFC 145 case 'Z': break; // time zone RFC
146 default: return; 146 default: return;
147 } 147 }
148 } catch (var e) { throwFormatException(input); } 148 } catch (e) { throwFormatException(input); }
149 } 149 }
150 150
151 /** Formatting logic if we are of type FIELD */ 151 /** Formatting logic if we are of type FIELD */
152 String formatField(Date date) { 152 String formatField(Date date) {
153 switch (pattern[0]) { 153 switch (pattern[0]) {
154 case 'a': return formatAmPm(date); 154 case 'a': return formatAmPm(date);
155 case 'c': return formatStandaloneDay(date); 155 case 'c': return formatStandaloneDay(date);
156 case 'd': return formatDayOfMonth(date); 156 case 'd': return formatDayOfMonth(date);
157 case 'E': return formatDayOfWeek(date); 157 case 'E': return formatDayOfWeek(date);
158 case 'G': return formatEra(date); 158 case 'G': return formatEra(date);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 var basicString = toBePrinted.toString(); 394 var basicString = toBePrinted.toString();
395 if (basicString.length >= width) return basicString; 395 if (basicString.length >= width) return basicString;
396 var buffer = new StringBuffer(); 396 var buffer = new StringBuffer();
397 for (var i = 0; i < width - basicString.length; i++) { 397 for (var i = 0; i < width - basicString.length; i++) {
398 buffer.add('0'); 398 buffer.add('0');
399 } 399 }
400 buffer.add(basicString); 400 buffer.add(basicString);
401 return buffer.toString(); 401 return buffer.toString();
402 } 402 }
403 } 403 }
OLDNEW
« no previous file with comments | « pkg/fixnum/test/int_64_vm_test.dart ('k') | pkg/unittest/core_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698