| 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_dart.dart'; | 10 import 'codegen_dart.dart'; |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 */ | 713 */ |
| 714 void emitEnumClass(String className, TypeEnum type, ImpliedType impliedType) { | 714 void emitEnumClass(String className, TypeEnum type, ImpliedType impliedType) { |
| 715 docComment(toHtmlVisitor.collectHtml(() { | 715 docComment(toHtmlVisitor.collectHtml(() { |
| 716 toHtmlVisitor.p(() { | 716 toHtmlVisitor.p(() { |
| 717 toHtmlVisitor.write(impliedType.humanReadableName); | 717 toHtmlVisitor.write(impliedType.humanReadableName); |
| 718 }); | 718 }); |
| 719 if (impliedType.type != null) { | 719 if (impliedType.type != null) { |
| 720 toHtmlVisitor.showType(null, impliedType.type); | 720 toHtmlVisitor.showType(null, impliedType.type); |
| 721 } | 721 } |
| 722 })); | 722 })); |
| 723 writeln('class $className {'); | 723 writeln('class $className implements Enum {'); |
| 724 indent(() { | 724 indent(() { |
| 725 if (emitSpecialStaticMembers(className)) { | 725 if (emitSpecialStaticMembers(className)) { |
| 726 writeln(); | 726 writeln(); |
| 727 } | 727 } |
| 728 for (TypeEnumValue value in type.values) { | 728 for (TypeEnumValue value in type.values) { |
| 729 docComment(toHtmlVisitor.collectHtml(() { | 729 docComment(toHtmlVisitor.collectHtml(() { |
| 730 toHtmlVisitor.translateHtml(value.html); | 730 toHtmlVisitor.translateHtml(value.html); |
| 731 })); | 731 })); |
| 732 String valueString = literalString(value.value); | 732 String valueString = literalString(value.value); |
| 733 writeln( | 733 writeln( |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); | 1173 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); |
| 1174 return visitor.collectCode(visitor.visitApi); | 1174 return visitor.collectCode(visitor.visitApi); |
| 1175 }); | 1175 }); |
| 1176 | 1176 |
| 1177 /** | 1177 /** |
| 1178 * Translate spec_input.html into protocol_matchers.dart. | 1178 * Translate spec_input.html into protocol_matchers.dart. |
| 1179 */ | 1179 */ |
| 1180 main() { | 1180 main() { |
| 1181 target.generate(); | 1181 target.generate(); |
| 1182 } | 1182 } |
| OLD | NEW |