OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 // BSD-style license that can be found in the LICENSE file. | 22 // BSD-style license that can be found in the LICENSE file. |
23 | 23 |
24 // NOTE: THIS FILE IS GENERATED. DO NOT EDIT. | 24 // NOTE: THIS FILE IS GENERATED. DO NOT EDIT. |
25 // | 25 // |
26 // Instead modify 'pkg/front_end/messages.yaml' and run | 26 // Instead modify 'pkg/front_end/messages.yaml' and run |
27 // 'pkg/front_end/tool/_fasta/generate_messages.dart' to update. | 27 // 'pkg/front_end/tool/_fasta/generate_messages.dart' to update. |
28 | 28 |
29 part of fasta.codes; | 29 part of fasta.codes; |
30 """); | 30 """); |
31 | 31 |
32 yaml.forEach((String name, description) { | 32 List<String> keys = yaml.keys.toList()..sort(); |
| 33 for (String name in keys) { |
| 34 var description = yaml[name]; |
33 while (description is String) { | 35 while (description is String) { |
34 description = yaml[description]; | 36 description = yaml[description]; |
35 } | 37 } |
36 Map map = description; | 38 Map map = description; |
37 sb.writeln(compileTemplate(name, map['template'], map['tip'], | 39 sb.writeln(compileTemplate(name, map['template'], map['tip'], |
38 map['analyzerCode'], map['dart2jsCode'])); | 40 map['analyzerCode'], map['dart2jsCode'])); |
39 }); | 41 } |
40 | 42 |
41 String dartfmtedText = new DartFormatter().format("$sb"); | 43 String dartfmtedText = new DartFormatter().format("$sb"); |
42 | 44 |
43 Uri problemsFile = await Isolate.resolvePackageUri( | 45 Uri problemsFile = await Isolate.resolvePackageUri( |
44 Uri.parse('package:front_end/src/fasta/fasta_codes_generated.dart')); | 46 Uri.parse('package:front_end/src/fasta/fasta_codes_generated.dart')); |
45 await new File.fromUri(problemsFile) | 47 await new File.fromUri(problemsFile) |
46 .writeAsString(dartfmtedText, flush: true); | 48 .writeAsString(dartfmtedText, flush: true); |
47 port.close(); | 49 port.close(); |
48 } | 50 } |
49 | 51 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 174 |
173 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. | 175 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. |
174 Message _withArguments$name(${parameters.join(', ')}) { | 176 Message _withArguments$name(${parameters.join(', ')}) { |
175 ${conversions.join('\n ')} | 177 ${conversions.join('\n ')} |
176 return new Message( | 178 return new Message( |
177 code$name, | 179 code$name, |
178 ${messageArguments.join(', ')}); | 180 ${messageArguments.join(', ')}); |
179 } | 181 } |
180 """; | 182 """; |
181 } | 183 } |
OLD | NEW |