| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |