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 * Tools for Java code generation. | 6 * Tools for Java code generation. |
7 */ | 7 */ |
8 library CodegenJava; | 8 library CodegenJava; |
9 | 9 |
| 10 import 'package:analyzer/src/codegen/tools.dart'; |
10 import 'package:html/dom.dart' as dom; | 11 import 'package:html/dom.dart' as dom; |
11 | 12 |
12 import 'api.dart'; | 13 import 'api.dart'; |
13 import 'codegen_tools.dart'; | |
14 import 'from_html.dart'; | 14 import 'from_html.dart'; |
15 import 'to_html.dart'; | 15 import 'to_html.dart'; |
16 | 16 |
17 /** | 17 /** |
18 * Create a [GeneratedFile] that creates Java code and outputs it to [path]. | 18 * Create a [GeneratedFile] that creates Java code and outputs it to [path]. |
19 * [path] uses Posix-style path separators regardless of the OS. | 19 * [path] uses Posix-style path separators regardless of the OS. |
20 */ | 20 */ |
21 GeneratedFile javaGeneratedFile( | 21 GeneratedFile javaGeneratedFile( |
22 String path, CodegenJavaVisitor createVisitor(Api api)) { | 22 String path, CodegenJavaVisitor createVisitor(Api api)) { |
23 return new GeneratedFile(path, () { | 23 return new GeneratedFile(path, (String pkgPath) { |
24 CodegenJavaVisitor visitor = createVisitor(readApi()); | 24 CodegenJavaVisitor visitor = createVisitor(readApi(pkgPath)); |
25 return visitor.collectCode(visitor.visitApi); | 25 return visitor.collectCode(visitor.visitApi); |
26 }); | 26 }); |
27 } | 27 } |
28 | 28 |
29 /** | 29 /** |
30 * Iterate through the values in [map] in the order of increasing keys. | 30 * Iterate through the values in [map] in the order of increasing keys. |
31 */ | 31 */ |
32 Iterable<String> _valuesSortedByKey(Map<String, String> map) { | 32 Iterable<String> _valuesSortedByKey(Map<String, String> map) { |
33 List<String> keys = map.keys.toList(); | 33 List<String> keys = map.keys.toList(); |
34 keys.sort(); | 34 keys.sort(); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 /** | 293 /** |
294 * Temporary storage for private fields. | 294 * Temporary storage for private fields. |
295 */ | 295 */ |
296 Map<String, String> privateFields = <String, String>{}; | 296 Map<String, String> privateFields = <String, String>{}; |
297 | 297 |
298 /** | 298 /** |
299 * Temporary storage for constructors. | 299 * Temporary storage for constructors. |
300 */ | 300 */ |
301 Map<String, String> constructors = <String, String>{}; | 301 Map<String, String> constructors = <String, String>{}; |
302 } | 302 } |
OLD | NEW |