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

Unified Diff: runtime/lib/date_patch.dart

Issue 1284873002: VM: Use const instead of final for constants in runtime libraries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | runtime/lib/double.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/date_patch.dart
diff --git a/runtime/lib/date_patch.dart b/runtime/lib/date_patch.dart
index 0d6065d9d60aa24b583a017cf0892aa786899db2..6c5c0c242ddc94184576bb3a6ad8f433922220c0 100644
--- a/runtime/lib/date_patch.dart
+++ b/runtime/lib/date_patch.dart
@@ -67,13 +67,13 @@ patch class DateTime {
const [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]];
static List _computeUpperPart(int localMs) {
- final int DAYS_IN_4_YEARS = 4 * 365 + 1;
- final int DAYS_IN_100_YEARS = 25 * DAYS_IN_4_YEARS - 1;
- final int DAYS_IN_400_YEARS = 4 * DAYS_IN_100_YEARS + 1;
- final int DAYS_1970_TO_2000 = 30 * 365 + 7;
- final int DAYS_OFFSET = 1000 * DAYS_IN_400_YEARS + 5 * DAYS_IN_400_YEARS -
+ const int DAYS_IN_4_YEARS = 4 * 365 + 1;
+ const int DAYS_IN_100_YEARS = 25 * DAYS_IN_4_YEARS - 1;
+ const int DAYS_IN_400_YEARS = 4 * DAYS_IN_100_YEARS + 1;
+ const int DAYS_1970_TO_2000 = 30 * 365 + 7;
+ const int DAYS_OFFSET = 1000 * DAYS_IN_400_YEARS + 5 * DAYS_IN_400_YEARS -
DAYS_1970_TO_2000;
- final int YEARS_OFFSET = 400000;
+ const int YEARS_OFFSET = 400000;
int resultYear = 0;
int resultMonth = 0;
@@ -295,9 +295,9 @@ patch class DateTime {
* Code is adapted from V8.
*/
static int _yearsFromSecondsSinceEpoch(int secondsSinceEpoch) {
- final int DAYS_IN_4_YEARS = 4 * 365 + 1;
- final int DAYS_IN_100_YEARS = 25 * DAYS_IN_4_YEARS - 1;
- final int DAYS_YEAR_2098 = DAYS_IN_100_YEARS + 6 * DAYS_IN_4_YEARS;
+ const int DAYS_IN_4_YEARS = 4 * 365 + 1;
+ const int DAYS_IN_100_YEARS = 25 * DAYS_IN_4_YEARS - 1;
+ const int DAYS_YEAR_2098 = DAYS_IN_100_YEARS + 6 * DAYS_IN_4_YEARS;
int days = secondsSinceEpoch ~/ Duration.SECONDS_PER_DAY;
if (days > 0 && days < DAYS_YEAR_2098) {
@@ -319,7 +319,7 @@ patch class DateTime {
* * The week day of [this] is the same as the one for the returned date.
*/
static int _equivalentSeconds(int millisecondsSinceEpoch) {
- final int CUT_OFF_SECONDS = 2100000000;
+ const int CUT_OFF_SECONDS = 2100000000;
int secondsSinceEpoch = _flooredDivision(millisecondsSinceEpoch,
Duration.MILLISECONDS_PER_SECOND);
« no previous file with comments | « no previous file | runtime/lib/double.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698