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 'dart:convert'; | 5 import 'dart:convert'; |
6 | 6 |
7 import 'package:analyzer/src/codegen/tools.dart'; | 7 import 'package:analyzer/src/codegen/tools.dart'; |
8 import 'package:html/dom.dart' as dom; | 8 import 'package:html/dom.dart' as dom; |
9 | 9 |
10 import 'api.dart'; | 10 import 'api.dart'; |
11 import 'codegen_dart.dart'; | 11 import 'codegen_dart.dart'; |
12 import 'from_html.dart'; | 12 import 'from_html.dart'; |
13 import 'implied_types.dart'; | 13 import 'implied_types.dart'; |
14 import 'to_html.dart'; | 14 import 'to_html.dart'; |
15 | 15 |
16 /** | 16 /** |
17 * Special flags that need to be inserted into the declaration of the Element | 17 * Special flags that need to be inserted into the declaration of the Element |
18 * class. | 18 * class. |
19 */ | 19 */ |
20 const Map<String, String> specialElementFlags = const { | 20 const Map<String, String> specialElementFlags = const { |
21 'abstract': '0x01', | 21 'abstract': '0x01', |
22 'const': '0x02', | 22 'const': '0x02', |
23 'final': '0x04', | 23 'final': '0x04', |
24 'static': '0x08', | 24 'static': '0x08', |
25 'private': '0x10', | 25 'private': '0x10', |
26 'deprecated': '0x20' | 26 'deprecated': '0x20' |
27 }; | 27 }; |
28 | 28 |
29 final GeneratedFile target = | 29 final GeneratedFile target = |
30 new GeneratedFile('lib/protocol/generated_protocol.dart', (String pkgPath) { | 30 new GeneratedFile('lib/protocol/protocol_generated.dart', (String pkgPath) { |
31 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi(pkgPath)); | 31 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi(pkgPath)); |
32 return visitor.collectCode(visitor.visitApi); | 32 return visitor.collectCode(visitor.visitApi); |
33 }); | 33 }); |
34 | 34 |
35 /** | 35 /** |
36 * Callback type used to represent arbitrary code generation. | 36 * Callback type used to represent arbitrary code generation. |
37 */ | 37 */ |
38 typedef void CodegenCallback(); | 38 typedef void CodegenCallback(); |
39 | 39 |
40 typedef String FromJsonSnippetCallback(String jsonPath, String json); | 40 typedef String FromJsonSnippetCallback(String jsonPath, String json); |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 | 1273 |
1274 @override | 1274 @override |
1275 String get asClosure => '($type value) => ${callback('value')}'; | 1275 String get asClosure => '($type value) => ${callback('value')}'; |
1276 | 1276 |
1277 @override | 1277 @override |
1278 bool get isIdentity => false; | 1278 bool get isIdentity => false; |
1279 | 1279 |
1280 @override | 1280 @override |
1281 String asSnippet(String value) => callback(value); | 1281 String asSnippet(String value) => callback(value); |
1282 } | 1282 } |
OLD | NEW |