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

Unified Diff: pkg/analysis_server/tool/spec/codegen_dart_protocol.dart

Issue 483613006: Allow null as a synonym for {} when decoding JSON objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « pkg/analysis_server/test/domain_analysis_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
diff --git a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
index cf0388cfe1a5c777fa80feab6b69c88f40fb18b1..bf2cbb3878ca811c3be8266e5231fab577ee7112 100644
--- a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
@@ -538,6 +538,11 @@ class CodegenProtocolVisitor extends HierarchicalApiVisitor with CodeGenerator {
'factory $className.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {'
);
indent(() {
+ writeln('if (json == null) {');
+ indent(() {
+ writeln('json = {};');
+ });
+ writeln('}');
writeln('if (json is Map) {');
indent(() {
List<String> args = <String>[];
« no previous file with comments | « pkg/analysis_server/test/domain_analysis_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698