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 'package:analyzer/src/codegen/tools.dart'; | 5 import 'package:analyzer/src/codegen/tools.dart'; |
6 import 'package:path/path.dart' as path; | 6 import 'package:path/path.dart' as path; |
7 | 7 |
8 import 'api.dart'; | 8 import 'api.dart'; |
9 import 'codegen_dart_protocol.dart'; | 9 import 'codegen_dart_protocol.dart'; |
10 import 'from_html.dart'; | 10 import 'from_html.dart'; |
11 import 'implied_types.dart'; | 11 import 'implied_types.dart'; |
12 | 12 |
13 GeneratedFile target(bool responseRequiresRequestTime) => | 13 GeneratedFile target(bool responseRequiresRequestTime) => |
14 new GeneratedFile('lib/protocol/protocol_common.dart', (String pkgPath) { | 14 new GeneratedFile('lib/protocol/protocol_common.dart', |
| 15 (String pkgPath) async { |
15 CodegenCommonVisitor visitor = new CodegenCommonVisitor( | 16 CodegenCommonVisitor visitor = new CodegenCommonVisitor( |
16 path.basename(pkgPath), | 17 path.basename(pkgPath), |
17 responseRequiresRequestTime, | 18 responseRequiresRequestTime, |
18 readApi(pkgPath)); | 19 readApi(pkgPath)); |
19 return visitor.collectCode(visitor.visitApi); | 20 return visitor.collectCode(visitor.visitApi); |
20 }); | 21 }); |
21 | 22 |
22 /** | 23 /** |
23 * A visitor that produces Dart code defining the common types associated with | 24 * A visitor that produces Dart code defining the common types associated with |
24 * the API. | 25 * the API. |
(...skipping 22 matching lines...) Expand all Loading... |
47 List<ImpliedType> getClassesToEmit() { | 48 List<ImpliedType> getClassesToEmit() { |
48 List<ImpliedType> types = impliedTypes.values.where((ImpliedType type) { | 49 List<ImpliedType> types = impliedTypes.values.where((ImpliedType type) { |
49 ApiNode node = type.apiNode; | 50 ApiNode node = type.apiNode; |
50 return node is TypeDefinition && node.isExternal; | 51 return node is TypeDefinition && node.isExternal; |
51 }).toList(); | 52 }).toList(); |
52 types.sort((first, second) => | 53 types.sort((first, second) => |
53 capitalize(first.camelName).compareTo(capitalize(second.camelName))); | 54 capitalize(first.camelName).compareTo(capitalize(second.camelName))); |
54 return types; | 55 return types; |
55 } | 56 } |
56 } | 57 } |
OLD | NEW |