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

Unified Diff: pkg/docgen/lib/docgen.dart

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 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
Index: pkg/docgen/lib/docgen.dart
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index 6faca3f5132222521866d6d47e00f048f54e1b37..13f83af9b8da2533d4593f6d0258ebfc1521d50d 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -15,8 +15,8 @@
*/
library docgen;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json';
import 'dart:async';
import 'package:logging/logging.dart';
@@ -253,7 +253,8 @@ void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false,
if (!docsDir.contains('docs/library_list.json')) {
throw new StateError('No library_list.json');
}
- libraryMap = parse(new File('docs/library_list.json').readAsStringSync());
+ libraryMap =
+ JSON.decode(new File('docs/library_list.json').readAsStringSync());
libraryMap['libraries'].addAll(filteredEntities
.where((e) => e is Library)
.map((e) => e.previewMap));
@@ -277,7 +278,7 @@ void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false,
'filetype' : outputToYaml ? 'yaml' : 'json'
};
}
- _writeToFile(stringify(libraryMap), 'library_list.json');
+ _writeToFile(JSON.encode(libraryMap), 'library_list.json');
// Output libraries and classes to file after all information is generated.
filteredEntities.where((e) => e is Class || e is Library).forEach((output) {
_writeIndexableToFile(output, outputToYaml);
@@ -303,7 +304,7 @@ void _writeIndexableToFile(Indexable result, bool outputToYaml) {
if (outputToYaml) {
_writeToFile(getYamlString(result.toMap()), '${result.qualifiedName}.yaml');
} else {
- _writeToFile(stringify(result.toMap()), '${result.qualifiedName}.json');
+ _writeToFile(JSON.encode(result.toMap()), '${result.qualifiedName}.json');
}
}
@@ -399,7 +400,7 @@ void _mdnComment(Indexable item) {
// Reading in MDN related json file.
var mdnDir = path.join(path.dirname(path.dirname(path.dirname(path.dirname(
path.absolute(new Options().script))))), 'utils', 'apidoc', 'mdn');
- _mdn = parse(new File(path.join(mdnDir, 'database.json'))
+ _mdn = JSON.decode(new File(path.join(mdnDir, 'database.json'))
.readAsStringSync());
}
if (item.comment.isNotEmpty) return;

Powered by Google App Engine
This is Rietveld 408576698