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

Side by Side Diff: pkg/analysis_server/tool/spec/codegen_analysis_server.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 "AnalysisServer.java". 6 * Code generation for the file "AnalysisServer.java".
7 */ 7 */
8 library java.generator.server; 8 library java.generator.server;
9 9
10 import 'package:analyzer/src/codegen/tools.dart';
11
10 import 'api.dart'; 12 import 'api.dart';
11 import 'codegen_java.dart'; 13 import 'codegen_java.dart';
12 import 'codegen_tools.dart';
13 14
14 final GeneratedFile target = javaGeneratedFile( 15 final GeneratedFile target = javaGeneratedFile(
15 'generated/java/AnalysisServer.java', 16 'tool/spec/generated/java/AnalysisServer.java',
16 (Api api) => new CodegenAnalysisServer(api)); 17 (Api api) => new CodegenAnalysisServer(api));
17 18
18 /**
19 * Translate spec_input.html into AnalysisServer.java.
20 */
21 main() {
22 target.generate();
23 }
24
25 class CodegenAnalysisServer extends CodegenJavaVisitor { 19 class CodegenAnalysisServer extends CodegenJavaVisitor {
26 CodegenAnalysisServer(Api api) : super(api); 20 CodegenAnalysisServer(Api api) : super(api);
27 21
28 /** 22 /**
29 * Get the name of the consumer class for responses to this request. 23 * Get the name of the consumer class for responses to this request.
30 */ 24 */
31 String consumerName(Request request) { 25 String consumerName(Request request) {
32 return camelJoin([request.method, 'consumer'], doCapitalize: true); 26 return camelJoin([request.method, 'consumer'], doCapitalize: true);
33 } 27 }
34 28
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 126 }
133 } 127 }
134 if (request.result != null) { 128 if (request.result != null) {
135 arguments.add('${consumerName(request)} consumer'); 129 arguments.add('${consumerName(request)} consumer');
136 } 130 }
137 write(arguments.join(', ')); 131 write(arguments.join(', '));
138 writeln(');'); 132 writeln(');');
139 }); 133 });
140 } 134 }
141 } 135 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/check_all_test.dart ('k') | pkg/analysis_server/tool/spec/codegen_dart_protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698