| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** | 5 /** |
| 6 * Code generation for the file "matchers.dart". | 6 * Code generation for the file "matchers.dart". |
| 7 */ | 7 */ |
| 8 library codegen.matchers; | 8 library codegen.matchers; |
| 9 | 9 |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| 11 import 'dart:io'; | |
| 12 | 11 |
| 13 import 'api.dart'; | 12 import 'api.dart'; |
| 14 import 'codegen_tools.dart'; | 13 import 'codegen_tools.dart'; |
| 15 import 'from_html.dart'; | 14 import 'from_html.dart'; |
| 16 import 'to_html.dart'; | 15 import 'to_html.dart'; |
| 17 | 16 |
| 18 class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator { | 17 class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator { |
| 19 /** | 18 /** |
| 20 * Visitor used to produce doc comments. | 19 * Visitor used to produce doc comments. |
| 21 */ | 20 */ |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 }); | 181 }); |
| 183 write('}'); | 182 write('}'); |
| 184 } | 183 } |
| 185 | 184 |
| 186 @override | 185 @override |
| 187 void visitTypeReference(TypeReference typeReference) { | 186 void visitTypeReference(TypeReference typeReference) { |
| 188 write(camelJoin(['is', typeReference.typeName])); | 187 write(camelJoin(['is', typeReference.typeName])); |
| 189 } | 188 } |
| 190 } | 189 } |
| 191 | 190 |
| 191 final GeneratedFile target = new GeneratedFile( |
| 192 '../../test/integration/protocol_matchers.dart', () { |
| 193 CodegenMatchersVisitor visitor = new CodegenMatchersVisitor(readApi()); |
| 194 return visitor.collectCode(visitor.visitApi); |
| 195 }); |
| 196 |
| 192 /** | 197 /** |
| 193 * Translate spec_input.html into protocol_matchers.dart. | 198 * Translate spec_input.html into protocol_matchers.dart. |
| 194 */ | 199 */ |
| 195 main() { | 200 main() { |
| 196 CodegenMatchersVisitor visitor = new CodegenMatchersVisitor(readApi()); | 201 target.generate(); |
| 197 String code = visitor.collectCode(visitor.visitApi); | |
| 198 File outputFile = new File('../../test/integration/protocol_matchers.dart'); | |
| 199 outputFile.writeAsStringSync(code); | |
| 200 } | 202 } |
| OLD | NEW |