More constant cleanup for intl/intl_translation (checked exhaustively this time)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192502790
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 82ec07e..1f733ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 0.15.6
+ * More upper case constant removal.
+
## 0.15.5
* Add type parameters on numberFormatSymbols for Dart 2 compatibility. Note
that it only adds them on the right-hand side because adding them to the
diff --git a/lib/src/intl/bidi_formatter.dart b/lib/src/intl/bidi_formatter.dart
index 87f955a..c40fd5e 100644
--- a/lib/src/intl/bidi_formatter.dart
+++ b/lib/src/intl/bidi_formatter.dart
@@ -54,7 +54,6 @@
/// then up to the caller to insert the return value in the output.
class BidiFormatter {
-
/// The direction of the surrounding text (the context).
TextDirection contextDirection;
@@ -97,7 +96,7 @@
{bool isHtml: false, bool resetDir: true, TextDirection direction}) {
if (direction == null) direction = estimateDirection(text, isHtml: isHtml);
var result;
- if (!isHtml) text = HTML_ESCAPE.convert(text);
+ if (!isHtml) text = const HtmlEscape().convert(text);
var directionChange = contextDirection.isDirectionChange(direction);
if (_alwaysSpan || directionChange) {
var spanDirection = '';
diff --git a/lib/src/intl/number_format.dart b/lib/src/intl/number_format.dart
index ffcad51..75c0a6c 100644
--- a/lib/src/intl/number_format.dart
+++ b/lib/src/intl/number_format.dart
@@ -80,6 +80,8 @@
int minimumExponentDigits = 0;
int _significantDigits = 0;
+ static final _ln10 = log(10);
+
/// How many significant digits should we print.
///
/// Note that if significantDigitsInUse is the default false, this
@@ -97,7 +99,7 @@
int get _multiplier => _internalMultiplier;
set _multiplier(int x) {
_internalMultiplier = x;
- _multiplierDigits = (log(_multiplier) / LN10).round();
+ _multiplierDigits = (log(_multiplier) / _ln10).round();
}
int _internalMultiplier = 1;
@@ -602,7 +604,7 @@
return;
}
- var exponent = (log(number) / LN10).floor();
+ var exponent = (log(number) / _ln10).floor();
var mantissa = number / pow(10.0, exponent);
if (maximumIntegerDigits > 1 &&
@@ -708,7 +710,7 @@
if (simpleNumber < 10000000000000000) return 16;
// We're past the point where being off by one on the number of digits
// will affect the pattern, so now we can use logs.
- return max(1, (log(simpleNumber) / LN10).ceil());
+ return max(1, (log(simpleNumber) / _ln10).ceil());
}
int _fractionDigitsAfter(int remainingSignificantDigits) =>
@@ -806,7 +808,7 @@
// so pad out the rest of it with zeros.
var paddingDigits = '';
if (integerPart is num && integerPart > _maxInt) {
- var howManyDigitsTooBig = (log(integerPart) / LN10).ceil() - _maxDigits;
+ var howManyDigitsTooBig = (log(integerPart) / _ln10).ceil() - _maxDigits;
num divisor = pow(10, howManyDigitsTooBig).round();
// pow() produces 0 if the result is too large for a 64-bit int.
// If that happens, use a floating point divisor instead.
@@ -1149,12 +1151,12 @@
/// Parse [text] and return the resulting number. Throws [FormatException]
/// if we can't parse it.
num parse() {
- if (text == symbols.NAN) return double.NAN;
+ if (text == symbols.NAN) return (0.0 / 0.0);
if (text == "$_positivePrefix${symbols.INFINITY}$_positiveSuffix") {
- return double.INFINITY;
+ return 1.0 / 0.0;
}
if (text == "$_negativePrefix${symbols.INFINITY}$_negativeSuffix") {
- return double.NEGATIVE_INFINITY;
+ return -1.0 / 0.0;
}
checkPrefixes();
diff --git a/pubspec.yaml b/pubspec.yaml
index 95c411c..c065a1a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: intl
-version: 0.15.5
+version: 0.15.6
author: Dart Team <misc@dartlang.org>
description: Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.
homepage: https://github.com/dart-lang/intl
diff --git a/test/number_format_test.dart b/test/number_format_test.dart
index 8c1d61f..1c1339d 100644
--- a/test/number_format_test.dart
+++ b/test/number_format_test.dart
@@ -8,7 +8,6 @@
import 'package:intl/number_symbols_data.dart';
import 'package:intl/intl.dart';
import 'number_test_data.dart';
-import 'dart:math';
/// Tests the Numeric formatting library in dart.
var testNumbersWeCanReadBack = {
@@ -29,14 +28,14 @@
"1,234": 1234.0,
"1.234": 1.234,
"1.23": 1.230,
- "NaN": double.NAN,
- "∞": double.INFINITY,
- "-∞": double.NEGATIVE_INFINITY,
+ "NaN": 0.0 / 0.0,
+ "∞": 1.0 / 0.0,
+ "-∞": -1.0 / 0.0,
};
/// Test numbers that we can't parse because we lose precision in formatting.
var testNumbersWeCannotReadBack = {
- "3.142": PI,
+ "3.142": 3.1415926535897932,
"-1.234": -1.2342,
"-1.235": -1.2348,
"1.234": 1.2342,
@@ -45,11 +44,8 @@
/// Test numbers that won't work in Javascript because they're too big.
var testNumbersOnlyForTheVM = {
- "9,000,000,000,000,000,000":
- 9000000000000000000,
- "9,223,372,036,854,775,807":
- 9223372036854775807
-
+ "9,000,000,000,000,000,000": 9000000000000000000,
+ "9,223,372,036,854,775,807": 9223372036854775807
};
get allTestNumbers => new Map.from(testNumbersWeCanReadBack)
diff --git a/test/timezone_test_core.dart b/test/timezone_test_core.dart
index 435f2a7..69dff06 100644
--- a/test/timezone_test_core.dart
+++ b/test/timezone_test_core.dart
@@ -40,8 +40,8 @@
environment['EXPECTED_TZ_OFFSET_FOR_TEST'] = '$expectedUtcOffset';
}
var result = await Process.run(dart, args,
- stdoutEncoding: UTF8,
- stderrEncoding: UTF8,
+ stdoutEncoding: new Utf8Codec(),
+ stderrEncoding: new Utf8Codec(),
includeParentEnvironment: true,
environment: environment);
// Because the actual tests are run in a spawned parocess their output isn't