From fc7d8c61ba0a7e7680f31adcc09a33fd5dcaf58c Mon Sep 17 00:00:00 2001 From: "fschneider@google.com" Date: Mon, 2 Jun 2014 11:10:06 +0000 Subject: [PATCH] Make compile-time constants in _IntegerImplementation.compareTo const. Review URL: https://codereview.chromium.org//298203002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36864 260f80e4-7a28-3924-810f-c04153c831b5 --- runtime/lib/integers.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart index 3ed280b29f3..02529604292 100644 --- a/runtime/lib/integers.dart +++ b/runtime/lib/integers.dart @@ -117,11 +117,10 @@ class _IntegerImplementation { } int compareTo(num other) { - final int EQUAL = 0, LESS = -1, GREATER = 1; + const int EQUAL = 0, LESS = -1, GREATER = 1; if (other is double) { - // TODO(floitsch): the following locals should be 'const'. - int MAX_EXACT_INT_TO_DOUBLE = 9007199254740992; // 2^53. - int MIN_EXACT_INT_TO_DOUBLE = -MAX_EXACT_INT_TO_DOUBLE; + const int MAX_EXACT_INT_TO_DOUBLE = 9007199254740992; // 2^53. + const int MIN_EXACT_INT_TO_DOUBLE = -MAX_EXACT_INT_TO_DOUBLE; double d = other; if (d.isInfinite) { return d == double.NEGATIVE_INFINITY ? GREATER : LESS;