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

Unified Diff: runtime/bin/http_utils.dart

Issue 10914093: Cleanup in http_utils.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mark declaration type as const as well. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http_utils.dart
diff --git a/runtime/bin/http_utils.dart b/runtime/bin/http_utils.dart
index f283128dfe11b52307c78470c2f2779baf5b63d0..490c7b396702cd93133b7ce40835766f944e05bb 100644
--- a/runtime/bin/http_utils.dart
+++ b/runtime/bin/http_utils.dart
@@ -94,9 +94,9 @@ class _HttpUtils {
// Format as RFC 1123 date.
static String formatDate(Date date) {
- List wkday = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
- List month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+ const List wkday = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
+ const List month = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
Date d = date.toUtc();
StringBuffer sb = new StringBuffer();
@@ -119,16 +119,19 @@ class _HttpUtils {
static Date parseDate(String date) {
final int SP = 32;
- List wkdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
- List weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday", "Sunday"];
- List months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
- List wkdaysLowerCase = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
- List weekdaysLowerCase = ["monday", "tuesday", "wednesday", "thursday",
- "friday", "saturday", "sunday"];
- List monthsLowerCase = ["jan", "feb", "mar", "apr", "may", "jun",
- "jul", "aug", "sep", "oct", "nov", "dec"];
+ const List wkdays = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
+ const List weekdays = const ["Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday", "Sunday"];
+ const List months = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+ const List wkdaysLowerCase =
+ const ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
+ const List weekdaysLowerCase = const ["monday", "tuesday", "wednesday",
+ "thursday", "friday", "saturday",
+ "sunday"];
+ const List monthsLowerCase = const ["jan", "feb", "mar", "apr", "may",
+ "jun", "jul", "aug", "sep", "oct",
+ "nov", "dec"];
final int formatRfc1123 = 0;
final int formatRfc850 = 1;
@@ -244,8 +247,9 @@ class _HttpUtils {
}
static Date parseCookieDate(String date) {
- List monthsLowerCase = ["jan", "feb", "mar", "apr", "may", "jun",
- "jul", "aug", "sep", "oct", "nov", "dec"];
+ const List monthsLowerCase = const ["jan", "feb", "mar", "apr", "may",
+ "jun", "jul", "aug", "sep", "oct",
+ "nov", "dec"];
int position = 0;
@@ -326,7 +330,9 @@ class _HttpUtils {
}
if (timeStr === null || dayOfMonthStr === null ||
- monthStr === null || yearStr === null) error();
+ monthStr === null || yearStr === null) {
+ error();
+ }
int year = toInt(yearStr);
if (year >= 70 && year <= 99) year += 1900;
« 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