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 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:analyzer/src/codegen/tools.dart'; | 10 import 'package:analyzer/src/codegen/tools.dart'; |
11 import 'package:path/path.dart' as path; | 11 import 'package:path/path.dart' as path; |
12 | 12 |
13 import 'api.dart'; | 13 import 'api.dart'; |
14 import 'codegen_dart.dart'; | 14 import 'codegen_dart.dart'; |
15 import 'from_html.dart'; | 15 import 'from_html.dart'; |
16 import 'to_html.dart'; | 16 import 'to_html.dart'; |
17 | 17 |
18 final GeneratedFile target = new GeneratedFile( | 18 final GeneratedFile target = |
19 'test/integration/support/integration_test_methods.dart', (String pkgPath) { | 19 new GeneratedFile('test/integration/support/integration_test_methods.dart', |
| 20 (String pkgPath) async { |
20 CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( | 21 CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( |
21 path.basename(pkgPath), readApi(pkgPath)); | 22 path.basename(pkgPath), readApi(pkgPath)); |
22 return visitor.collectCode(visitor.visitApi); | 23 return visitor.collectCode(visitor.visitApi); |
23 }); | 24 }); |
24 | 25 |
25 /** | 26 /** |
26 * Visitor that generates the code for integration_test_methods.dart | 27 * Visitor that generates the code for integration_test_methods.dart |
27 */ | 28 */ |
28 class CodegenInttestMethodsVisitor extends DartCodegenVisitor | 29 class CodegenInttestMethodsVisitor extends DartCodegenVisitor |
29 with CodeGenerator { | 30 with CodeGenerator { |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 writeln('ResponseDecoder decoder = new ResponseDecoder($kind);'); | 265 writeln('ResponseDecoder decoder = new ResponseDecoder($kind);'); |
265 writeln("return new $resultClass.fromJson(decoder, 'result', result);"); | 266 writeln("return new $resultClass.fromJson(decoder, 'result', result);"); |
266 } else { | 267 } else { |
267 writeln('outOfTestExpect(result, isNull);'); | 268 writeln('outOfTestExpect(result, isNull);'); |
268 writeln('return null;'); | 269 writeln('return null;'); |
269 } | 270 } |
270 }); | 271 }); |
271 writeln('}'); | 272 writeln('}'); |
272 } | 273 } |
273 } | 274 } |
OLD | NEW |