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

Side by Side Diff: pkg/front_end/tool/_fasta/generate_messages.dart

Issue 2980273002: Random improvements in error reporting. (Closed)
Patch Set: rebased Created 3 years, 5 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/front_end/test/kernel_generator_test.dart ('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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 8
9 import 'package:yaml/yaml.dart' show loadYaml; 9 import 'package:yaml/yaml.dart' show loadYaml;
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 .writeAsString(dartfmtedText, flush: true); 48 .writeAsString(dartfmtedText, flush: true);
49 port.close(); 49 port.close();
50 } 50 }
51 51
52 final RegExp placeholderPattern = new RegExp("#[a-zA-Z0-9_]+"); 52 final RegExp placeholderPattern = new RegExp("#[a-zA-Z0-9_]+");
53 53
54 String compileTemplate(String name, String template, String tip, 54 String compileTemplate(String name, String template, String tip,
55 String analyzerCode, String dart2jsCode) { 55 String analyzerCode, String dart2jsCode) {
56 if (template == null) { 56 if (template == null) {
57 print('Error: missing template for message: $name'); 57 print('Error: missing template for message: $name');
58 exit(1); 58 exitCode = 1;
59 return ''; 59 return '';
60 } 60 }
61 var parameters = new Set<String>(); 61 var parameters = new Set<String>();
62 var conversions = new Set<String>(); 62 var conversions = new Set<String>();
63 var arguments = new Set<String>(); 63 var arguments = new Set<String>();
64 for (Match match in placeholderPattern.allMatches("$template${tip ?? ''}")) { 64 for (Match match in placeholderPattern.allMatches("$template${tip ?? ''}")) {
65 switch (match[0]) { 65 switch (match[0]) {
66 case "#character": 66 case "#character":
67 parameters.add("String character"); 67 parameters.add("String character");
68 arguments.add("'character': character"); 68 arguments.add("'character': character");
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. 191 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
192 Message _withArguments$name(${parameters.join(', ')}) { 192 Message _withArguments$name(${parameters.join(', ')}) {
193 ${conversions.join('\n ')} 193 ${conversions.join('\n ')}
194 return new Message( 194 return new Message(
195 code$name, 195 code$name,
196 ${messageArguments.join(', ')}); 196 ${messageArguments.join(', ')});
197 } 197 }
198 """; 198 """;
199 } 199 }
OLDNEW
« no previous file with comments | « pkg/front_end/test/kernel_generator_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698