| 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 "integration_test_methods.dart". | 6 * Code generation for the file "integration_test_methods.dart". |
| 7 */ | 7 */ |
| 8 library codegenInttestMethods; | 8 library codegenInttestMethods; |
| 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 /** | 17 /** |
| 19 * Visitor that generates the code for integration_test_methods.dart | 18 * Visitor that generates the code for integration_test_methods.dart |
| 20 */ | 19 */ |
| 21 class CodegenInttestMethodsVisitor extends HierarchicalApiVisitor with | 20 class CodegenInttestMethodsVisitor extends HierarchicalApiVisitor with |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 }); | 92 }); |
| 94 writeln('}'); | 93 writeln('}'); |
| 95 }); | 94 }); |
| 96 writeln('}'); | 95 writeln('}'); |
| 97 }); | 96 }); |
| 98 writeln('}'); | 97 writeln('}'); |
| 99 } | 98 } |
| 100 | 99 |
| 101 @override | 100 @override |
| 102 visitNotification(Notification notification) { | 101 visitNotification(Notification notification) { |
| 103 String streamName = camelJoin(['on', notification.domainName, notification.e
vent]); | 102 String streamName = camelJoin(['on', notification.domainName, |
| 103 notification.event]); |
| 104 writeln(); | 104 writeln(); |
| 105 docComment(toHtmlVisitor.collectHtml(() { | 105 docComment(toHtmlVisitor.collectHtml(() { |
| 106 toHtmlVisitor.translateHtml(notification.html); | 106 toHtmlVisitor.translateHtml(notification.html); |
| 107 toHtmlVisitor.describePayload(notification.params, 'Parameters'); | 107 toHtmlVisitor.describePayload(notification.params, 'Parameters'); |
| 108 })); | 108 })); |
| 109 writeln('Stream $streamName;'); | 109 writeln('Stream $streamName;'); |
| 110 writeln(); | 110 writeln(); |
| 111 docComment(toHtmlVisitor.collectHtml(() { | 111 docComment(toHtmlVisitor.collectHtml(() { |
| 112 toHtmlVisitor.write('Stream controller for [$streamName].'); | 112 toHtmlVisitor.write('Stream controller for [$streamName].'); |
| 113 })); | 113 })); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 return 'Map<String, dynamic>'; | 232 return 'Map<String, dynamic>'; |
| 233 default: | 233 default: |
| 234 throw new Exception(type.typeName); | 234 throw new Exception(type.typeName); |
| 235 } | 235 } |
| 236 } else { | 236 } else { |
| 237 throw new Exception('Unexpected kind of TypeDecl'); | 237 throw new Exception('Unexpected kind of TypeDecl'); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 final GeneratedFile target = new GeneratedFile( |
| 243 '../../test/integration/integration_test_methods.dart', () { |
| 244 CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( |
| 245 readApi()); |
| 246 return visitor.collectCode(visitor.visitApi); |
| 247 }); |
| 248 |
| 242 /** | 249 /** |
| 243 * Translate spec_input.html into protocol_matchers.dart. | 250 * Translate spec_input.html into protocol_matchers.dart. |
| 244 */ | 251 */ |
| 245 main() { | 252 main() { |
| 246 CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( | 253 target.generate(); |
| 247 readApi()); | |
| 248 String code = visitor.collectCode(visitor.visitApi); | |
| 249 File outputFile = new File( | |
| 250 '../../test/integration/integration_test_methods.dart'); | |
| 251 outputFile.writeAsStringSync(code); | |
| 252 } | 254 } |
| OLD | NEW |