| 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 "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'; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 }); | 153 }); |
| 154 writeln('}'); | 154 writeln('}'); |
| 155 }); | 155 }); |
| 156 writeln('}'); | 156 writeln('}'); |
| 157 } | 157 } |
| 158 | 158 |
| 159 @override | 159 @override |
| 160 visitNotification(Notification notification) { | 160 visitNotification(Notification notification) { |
| 161 String streamName = | 161 String streamName = |
| 162 camelJoin(['on', notification.domainName, notification.event]); | 162 camelJoin(['on', notification.domainName, notification.event]); |
| 163 String className = camelJoin([ | 163 String className = camelJoin( |
| 164 notification.domainName, | 164 [notification.domainName, notification.event, 'params'], |
| 165 notification.event, | 165 doCapitalize: true); |
| 166 'params' | |
| 167 ], doCapitalize: true); | |
| 168 writeln(); | 166 writeln(); |
| 169 docComment(toHtmlVisitor.collectHtml(() { | 167 docComment(toHtmlVisitor.collectHtml(() { |
| 170 toHtmlVisitor.translateHtml(notification.html); | 168 toHtmlVisitor.translateHtml(notification.html); |
| 171 toHtmlVisitor.describePayload(notification.params, 'Parameters'); | 169 toHtmlVisitor.describePayload(notification.params, 'Parameters'); |
| 172 })); | 170 })); |
| 173 writeln('Stream<$className> $streamName;'); | 171 writeln('Stream<$className> $streamName;'); |
| 174 writeln(); | 172 writeln(); |
| 175 docComment(toHtmlVisitor.collectHtml(() { | 173 docComment(toHtmlVisitor.collectHtml(() { |
| 176 toHtmlVisitor.write('Stream controller for [$streamName].'); | 174 toHtmlVisitor.write('Stream controller for [$streamName].'); |
| 177 })); | 175 })); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (request.result == null) { | 225 if (request.result == null) { |
| 228 futureClass = 'Future'; | 226 futureClass = 'Future'; |
| 229 } else { | 227 } else { |
| 230 resultClass = camelJoin([request.domainName, request.method, 'result'], | 228 resultClass = camelJoin([request.domainName, request.method, 'result'], |
| 231 doCapitalize: true); | 229 doCapitalize: true); |
| 232 futureClass = 'Future<$resultClass>'; | 230 futureClass = 'Future<$resultClass>'; |
| 233 } | 231 } |
| 234 writeln('$futureClass $methodName(${args.join(', ')}) {'); | 232 writeln('$futureClass $methodName(${args.join(', ')}) {'); |
| 235 indent(() { | 233 indent(() { |
| 236 String requestClass = camelJoin( | 234 String requestClass = camelJoin( |
| 237 [request.domainName, request.method, 'params'], doCapitalize: true); | 235 [request.domainName, request.method, 'params'], |
| 236 doCapitalize: true); |
| 238 String paramsVar = 'null'; | 237 String paramsVar = 'null'; |
| 239 if (request.params != null) { | 238 if (request.params != null) { |
| 240 paramsVar = 'params'; | 239 paramsVar = 'params'; |
| 241 List<String> args = <String>[]; | 240 List<String> args = <String>[]; |
| 242 List<String> optionalArgs = <String>[]; | 241 List<String> optionalArgs = <String>[]; |
| 243 for (TypeObjectField field in request.params.fields) { | 242 for (TypeObjectField field in request.params.fields) { |
| 244 if (field.optional) { | 243 if (field.optional) { |
| 245 optionalArgs.add('${field.name}: ${field.name}'); | 244 optionalArgs.add('${field.name}: ${field.name}'); |
| 246 } else { | 245 } else { |
| 247 args.add(field.name); | 246 args.add(field.name); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 265 } else { | 264 } else { |
| 266 writeln('expect(result, isNull);'); | 265 writeln('expect(result, isNull);'); |
| 267 writeln('return null;'); | 266 writeln('return null;'); |
| 268 } | 267 } |
| 269 }); | 268 }); |
| 270 writeln('});'); | 269 writeln('});'); |
| 271 }); | 270 }); |
| 272 writeln('}'); | 271 writeln('}'); |
| 273 } | 272 } |
| 274 } | 273 } |
| OLD | NEW |