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

Unified Diff: pkg/yaml/lib/composer.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 10 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 | « pkg/webdriver/lib/webdriver.dart ('k') | pkg/yaml/lib/model.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/yaml/lib/composer.dart
diff --git a/pkg/yaml/lib/composer.dart b/pkg/yaml/lib/composer.dart
index e9c187969aa9dbcb51e277c80c08e4a4d0fde813..e22159f34c30f73a06c4911a83ad63efda5ac56e 100644
--- a/pkg/yaml/lib/composer.dart
+++ b/pkg/yaml/lib/composer.dart
@@ -120,12 +120,7 @@ class _Composer extends _Visitor {
match = new RegExp("^0o([0-7]+)\$").firstMatch(content);
if (match != null) {
- // TODO(nweiz): clean this up when Dart can parse an octal string
- var n = 0;
- for (var c in match.group(1).charCodes) {
- n *= 8;
- n += c - 48;
- }
+ int n = int.parse(match.group(1), radix: 8);
return new _ScalarNode(_Tag.yaml("int"), value: n);
}
@@ -153,15 +148,13 @@ class _Composer extends _Visitor {
match = new RegExp("^([+-]?)\.(inf|Inf|INF)\$").firstMatch(content);
if (match != null) {
- var infinityStr = match.group(1) == "-" ? "-Infinity" : "Infinity";
- return new _ScalarNode(_Tag.yaml("float"),
- value: double.parse(infinityStr));
+ var value = match.group(1) == "-" ? -double.INFINITY : double.INFINITY;
+ return new _ScalarNode(_Tag.yaml("float"), value: value);
}
match = new RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content);
if (match != null) {
- return new _ScalarNode(_Tag.yaml("float"),
- value: double.parse("NaN"));
+ return new _ScalarNode(_Tag.yaml("float"), value: double.NAN);
}
return null;
« no previous file with comments | « pkg/webdriver/lib/webdriver.dart ('k') | pkg/yaml/lib/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698