Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: pkg/analyzer/tool/summary/generate.dart

Issue 3002293003: Convert GeneratedContent to async and use AnalysisDriver for tasks graph. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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:
(...skipping 12 matching lines...) Expand all
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/scanner/token.dart' show Token; 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() async {
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 await GeneratedContent.generateAll(pkgPath, allTargets);
37 } 37 }
38 38
39 final List<GeneratedContent> allTargets = <GeneratedContent>[ 39 final List<GeneratedContent> allTargets = <GeneratedContent>[
40 formatTarget, 40 formatTarget,
41 schemaTarget 41 schemaTarget
42 ]; 42 ];
43 43
44 final GeneratedFile formatTarget = 44 final GeneratedFile formatTarget =
45 new GeneratedFile('lib/src/summary/format.dart', (String pkgPath) { 45 new GeneratedFile('lib/src/summary/format.dart', (String pkgPath) async {
46 _CodeGenerator codeGenerator = new _CodeGenerator(pkgPath); 46 _CodeGenerator codeGenerator = new _CodeGenerator(pkgPath);
47 codeGenerator.generateFormatCode(); 47 codeGenerator.generateFormatCode();
48 return codeGenerator._outBuffer.toString(); 48 return codeGenerator._outBuffer.toString();
49 }); 49 });
50 50
51 final GeneratedFile schemaTarget = 51 final GeneratedFile schemaTarget =
52 new GeneratedFile('lib/src/summary/format.fbs', (String pkgPath) { 52 new GeneratedFile('lib/src/summary/format.fbs', (String pkgPath) async {
53 _CodeGenerator codeGenerator = new _CodeGenerator(pkgPath); 53 _CodeGenerator codeGenerator = new _CodeGenerator(pkgPath);
54 codeGenerator.generateFlatBufferSchema(); 54 codeGenerator.generateFlatBufferSchema();
55 return codeGenerator._outBuffer.toString(); 55 return codeGenerator._outBuffer.toString();
56 }); 56 });
57 57
58 typedef String _StringToString(String s); 58 typedef String _StringToString(String s);
59 59
60 class _CodeGenerator { 60 class _CodeGenerator {
61 static const String _throwDeprecated = 61 static const String _throwDeprecated =
62 "throw new UnimplementedError('attempt to access deprecated field')"; 62 "throw new UnimplementedError('attempt to access deprecated field')";
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/tool/summary/check_test.dart ('k') | pkg/analyzer/tool/task_dependency_graph/check_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698