mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Re-land "Clean up the use of deprecated API in the analyzer_plugin package".
int.tryParse is now available to internal Google users, so it is safe to land this change now. This reverts commit115850ca1d
. Original commit86ba29265a
. Change-Id: I92c3d19533d3108c06910f21070266953c3a065b Reviewed-on: https://dart-review.googlesource.com/53244 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
607f4f5769
commit
73abd61304
|
@ -277,9 +277,11 @@ abstract class JsonDecoder {
|
|||
if (json is int) {
|
||||
return json;
|
||||
} else if (json is String) {
|
||||
return int.parse(json, onError: (String value) {
|
||||
int value = int.tryParse(json);
|
||||
if (value == null) {
|
||||
throw mismatch(jsonPath, 'int', json);
|
||||
});
|
||||
}
|
||||
return value;
|
||||
}
|
||||
throw mismatch(jsonPath, 'int', json);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue