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

Side by Side Diff: pkg/dart_messages/lib/shared_messages.dart

Issue 1711863005: Split the JSON output into multiple lines. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « pkg/dart_messages/lib/generated/shared_messages.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // An update to this file must be followed by regenerating the corresponding 5 // An update to this file must be followed by regenerating the corresponding
6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory. 6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory.
7 // 7 //
8 // Every message in this file must have an id. Use `message_id.dart` in the 8 // Every message in this file must have an id. Use `message_id.dart` in the
9 // bin directory to generate a fresh one. 9 // bin directory to generate a fresh one.
10 10
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 this.category, 131 this.category,
132 this.template, 132 this.template,
133 this.templateHoleOrder, 133 this.templateHoleOrder,
134 this.howToFix, 134 this.howToFix,
135 this.options, 135 this.options,
136 this.usedBy: const [], 136 this.usedBy: const [],
137 this.examples}); 137 this.examples});
138 } 138 }
139 139
140 String get messagesAsJson { 140 String get messagesAsJson {
141 var jsonified = {}; 141 var jsonifiedEntries = [];
142 MESSAGES.forEach((String name, Message message) { 142 MESSAGES.forEach((String name, Message message) {
143 jsonified[name] = { 143 jsonifiedEntries.add("'$name': " + JSON.encode({
Siggi Cherem (dart-lang) 2016/02/18 20:55:02 or use `const JsonEncoder.withIndent(' ').encode(
floitsch 2016/02/18 21:00:48 Even better. Dart really has great libraries ;)
144 'id': message.id, 144 'id': message.id,
145 'subId': message.subId, 145 'subId': message.subId,
146 'category': message.category.name, 146 'category': message.category.name,
147 'template': message.template, 147 'template': message.template,
148 'templateHoleOrder': message.templateHoleOrder, 148 'templateHoleOrder': message.templateHoleOrder,
149 'howToFix': message.howToFix, 149 'howToFix': message.howToFix,
150 'options': message.options, 150 'options': message.options,
151 'usedBy': message.usedBy.map((platform) => platform.toString()).toList(), 151 'usedBy': message.usedBy.map((platform) => platform.toString()).toList(),
152 'examples': message.examples, 152 'examples': message.examples,
153 }; 153 }));
154 }); 154 });
155 return JSON.encode(jsonified); 155 return """
156 {
157 ${jsonifiedEntries.join(",\n")}
158 }""";
156 } 159 }
157 160
158 final Map<String, Message> MESSAGES = { 161 final Map<String, Message> MESSAGES = {
159 'exampleMessage': new Message( 162 'exampleMessage': new Message(
160 id: 'use an Id generated by bin/message_id.dart', 163 id: 'use an Id generated by bin/message_id.dart',
161 category: Category.analysisOptionsError, 164 category: Category.analysisOptionsError,
162 template: "#use #named #arguments", 165 template: "#use #named #arguments",
163 templateHoleOrder: ["arguments", "named", "use"], 166 templateHoleOrder: ["arguments", "named", "use"],
164 howToFix: "an explanation on how to fix things", 167 howToFix: "an explanation on how to fix things",
165 examples: [ 168 examples: [
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 """ 480 """
478 foo() async* { return 0; } 481 foo() async* { return 0; }
479 main() => foo(); 482 main() => foo();
480 """, 483 """,
481 """ 484 """
482 foo() sync* { return 0; } 485 foo() sync* { return 0; }
483 main() => foo(); 486 main() => foo();
484 """ 487 """
485 ]), 488 ]),
486 }; 489 };
OLDNEW
« no previous file with comments | « pkg/dart_messages/lib/generated/shared_messages.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698