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

Side by Side Diff: pkg/analysis_server/tool/spec/codegen_inttest_methods.dart

Issue 1431683002: Refactor analysis server code generation to re-use logic from analyzer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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) 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 * Code generation for the file "integration_test_methods.dart". 6 * Code generation for the file "integration_test_methods.dart".
7 */ 7 */
8 library codegenInttestMethods; 8 library codegenInttestMethods;
9 9
10 import 'dart:convert'; 10 import 'dart:convert';
11 11
12 import 'package:analyzer/src/codegen/tools.dart';
13
12 import 'api.dart'; 14 import 'api.dart';
13 import 'codegen_dart.dart'; 15 import 'codegen_dart.dart';
14 import 'codegen_tools.dart';
15 import 'from_html.dart'; 16 import 'from_html.dart';
16 import 'to_html.dart'; 17 import 'to_html.dart';
17 18
18 final GeneratedFile target = new GeneratedFile( 19 final GeneratedFile target = new GeneratedFile(
19 '../../test/integration/integration_test_methods.dart', () { 20 'test/integration/integration_test_methods.dart', (String pkgPath) {
20 CodegenInttestMethodsVisitor visitor = 21 CodegenInttestMethodsVisitor visitor =
21 new CodegenInttestMethodsVisitor(readApi()); 22 new CodegenInttestMethodsVisitor(readApi(pkgPath));
22 return visitor.collectCode(visitor.visitApi); 23 return visitor.collectCode(visitor.visitApi);
23 }); 24 });
24 25
25 /** 26 /**
26 * Translate spec_input.html into protocol_matchers.dart.
27 */
28 main() {
29 target.generate();
30 }
31
32 /**
33 * Visitor that generates the code for integration_test_methods.dart 27 * Visitor that generates the code for integration_test_methods.dart
34 */ 28 */
35 class CodegenInttestMethodsVisitor extends DartCodegenVisitor 29 class CodegenInttestMethodsVisitor extends DartCodegenVisitor
36 with CodeGenerator { 30 with CodeGenerator {
37 /** 31 /**
38 * Visitor used to produce doc comments. 32 * Visitor used to produce doc comments.
39 */ 33 */
40 final ToHtmlVisitor toHtmlVisitor; 34 final ToHtmlVisitor toHtmlVisitor;
41 35
42 /** 36 /**
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 outputHeader(); 95 outputHeader();
102 writeln(); 96 writeln();
103 writeln('/**'); 97 writeln('/**');
104 writeln(' * Convenience methods for running integration tests'); 98 writeln(' * Convenience methods for running integration tests');
105 writeln(' */'); 99 writeln(' */');
106 writeln('library test.integration.methods;'); 100 writeln('library test.integration.methods;');
107 writeln(); 101 writeln();
108 writeln("import 'dart:async';"); 102 writeln("import 'dart:async';");
109 writeln(); 103 writeln();
110 writeln("import 'package:analysis_server/plugin/protocol/protocol.dart';"); 104 writeln("import 'package:analysis_server/plugin/protocol/protocol.dart';");
111 writeln("import 'package:analysis_server/src/protocol/protocol_internal.dart ';"); 105 writeln(
106 "import 'package:analysis_server/src/protocol/protocol_internal.dart';") ;
112 writeln("import 'package:unittest/unittest.dart';"); 107 writeln("import 'package:unittest/unittest.dart';");
113 writeln(); 108 writeln();
114 writeln("import 'integration_tests.dart';"); 109 writeln("import 'integration_tests.dart';");
115 writeln("import 'protocol_matchers.dart';"); 110 writeln("import 'protocol_matchers.dart';");
116 writeln(); 111 writeln();
117 writeln(); 112 writeln();
118 writeln('/**'); 113 writeln('/**');
119 writeln(' * Convenience methods for running integration tests'); 114 writeln(' * Convenience methods for running integration tests');
120 writeln(' */'); 115 writeln(' */');
121 writeln('abstract class IntegrationTestMixin {'); 116 writeln('abstract class IntegrationTestMixin {');
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } else { 260 } else {
266 writeln('expect(result, isNull);'); 261 writeln('expect(result, isNull);');
267 writeln('return null;'); 262 writeln('return null;');
268 } 263 }
269 }); 264 });
270 writeln('});'); 265 writeln('});');
271 }); 266 });
272 writeln('}'); 267 writeln('}');
273 } 268 }
274 } 269 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_dart_protocol.dart ('k') | pkg/analysis_server/tool/spec/codegen_java.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698