| 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 library codegen.protocol; | 5 library codegen.protocol; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'api.dart'; | 9 import 'api.dart'; |
| 10 import 'codegen_tools.dart'; | 10 import 'codegen_tools.dart'; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 })); | 232 })); |
| 233 writeln('class $className implements HasToJson {'); | 233 writeln('class $className implements HasToJson {'); |
| 234 indent(() { | 234 indent(() { |
| 235 for (TypeObjectField field in type.fields) { | 235 for (TypeObjectField field in type.fields) { |
| 236 if (field.value != null) { | 236 if (field.value != null) { |
| 237 continue; | 237 continue; |
| 238 } | 238 } |
| 239 docComment(toHtmlVisitor.collectHtml(() { | 239 docComment(toHtmlVisitor.collectHtml(() { |
| 240 toHtmlVisitor.translateHtml(field.html); | 240 toHtmlVisitor.translateHtml(field.html); |
| 241 })); | 241 })); |
| 242 writeln('final ${dartType(field.type)} ${field.name};'); | 242 writeln('${dartType(field.type)} ${field.name};'); |
| 243 writeln(); | 243 writeln(); |
| 244 } | 244 } |
| 245 emitObjectConstructor(type, className); | 245 emitObjectConstructor(type, className); |
| 246 writeln(); | 246 writeln(); |
| 247 emitObjectFromJsonConstructor(className, type, impliedType); | 247 emitObjectFromJsonConstructor(className, type, impliedType); |
| 248 writeln(); | 248 writeln(); |
| 249 if (emitConvenienceConstructor(className, impliedType)) { | 249 if (emitConvenienceConstructor(className, impliedType)) { |
| 250 writeln(); | 250 writeln(); |
| 251 } | 251 } |
| 252 emitToJsonMember(type); | 252 emitToJsonMember(type); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); | 828 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); |
| 829 return visitor.collectCode(visitor.visitApi); | 829 return visitor.collectCode(visitor.visitApi); |
| 830 }); | 830 }); |
| 831 | 831 |
| 832 /** | 832 /** |
| 833 * Translate spec_input.html into protocol_matchers.dart. | 833 * Translate spec_input.html into protocol_matchers.dart. |
| 834 */ | 834 */ |
| 835 main() { | 835 main() { |
| 836 target.generate(); | 836 target.generate(); |
| 837 } | 837 } |
| OLD | NEW |