OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 * This file contains code to generate serialization/deserialization logic for | 6 * This file contains code to generate serialization/deserialization logic for |
7 * summaries based on an "IDL" description of the summary format (written in | 7 * summaries based on an "IDL" description of the summary format (written in |
8 * stylized Dart). | 8 * stylized Dart). |
9 * | 9 * |
10 * For each class in the "IDL" input, two corresponding classes are generated: | 10 * For each class in the "IDL" input, two corresponding classes are generated: |
11 * - A class with the same name which represents deserialized summary data in | 11 * - A class with the same name which represents deserialized summary data in |
12 * memory. This class has read-only semantics. | 12 * memory. This class has read-only semantics. |
13 * - A "builder" class which can be used to generate serialized summary data. | 13 * - A "builder" class which can be used to generate serialized summary data. |
14 * This class has write-only semantics. | 14 * This class has write-only semantics. |
15 * | 15 * |
16 * Each of the "builder" classes has a single `finish` method which writes | 16 * Each of the "builder" classes has a single `finish` method which writes |
17 * the entity being built into the given FlatBuffer and returns the `Offset` | 17 * the entity being built into the given FlatBuffer and returns the `Offset` |
18 * reference to it. | 18 * reference to it. |
19 */ | 19 */ |
20 library analyzer.tool.summary.generate; | 20 library analyzer.tool.summary.generate; |
21 | 21 |
22 import 'dart:convert'; | 22 import 'dart:convert'; |
23 import 'dart:io'; | 23 import 'dart:io'; |
24 | 24 |
25 import 'package:front_end/src/codegen/tools.dart'; | 25 import 'package:front_end/src/codegen/tools.dart'; |
26 import 'package:front_end/src/fasta/scanner/string_scanner.dart'; | 26 import 'package:front_end/src/fasta/scanner/string_scanner.dart'; |
27 import 'package:front_end/src/fasta/scanner/token.dart'; | 27 import 'package:front_end/src/scanner/token.dart' show Token; |
28 import 'package:path/path.dart'; | 28 import 'package:path/path.dart'; |
29 | 29 |
30 import 'idl_model.dart' as idlModel; | 30 import 'idl_model.dart' as idlModel; |
31 import 'mini_ast.dart'; | 31 import 'mini_ast.dart'; |
32 | 32 |
33 main() { | 33 main() { |
34 String script = Platform.script.toFilePath(windows: Platform.isWindows); | 34 String script = Platform.script.toFilePath(windows: Platform.isWindows); |
35 String pkgPath = normalize(join(dirname(script), '..', '..')); | 35 String pkgPath = normalize(join(dirname(script), '..', '..')); |
36 GeneratedContent.generateAll(pkgPath, allTargets); | 36 GeneratedContent.generateAll(pkgPath, allTargets); |
37 } | 37 } |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 Token token = comment.tokens.first; | 1007 Token token = comment.tokens.first; |
1008 return token.lexeme.split('\n').map((String line) { | 1008 return token.lexeme.split('\n').map((String line) { |
1009 line = line.trimLeft(); | 1009 line = line.trimLeft(); |
1010 if (line.startsWith('*')) line = ' ' + line; | 1010 if (line.startsWith('*')) line = ' ' + line; |
1011 return line; | 1011 return line; |
1012 }).join('\n'); | 1012 }).join('\n'); |
1013 } | 1013 } |
1014 return null; | 1014 return null; |
1015 } | 1015 } |
1016 } | 1016 } |
OLD | NEW |