| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 library old_servicec.plugins.shared; | |
| 6 | |
| 7 import 'package:servicec/util.dart' as strings; | |
| 8 | |
| 9 import '../parser.dart'; | |
| 10 export '../parser.dart'; | |
| 11 | |
| 12 abstract class CodeGenerationVisitor extends Visitor { | |
| 13 final String path; | |
| 14 final StringBuffer buffer = new StringBuffer(); | |
| 15 CodeGenerationVisitor(this.path); | |
| 16 | |
| 17 void write(String s) => buffer.write(s); | |
| 18 void writeln([String s = '']) => buffer.writeln(s); | |
| 19 | |
| 20 String camelize(String name) { | |
| 21 return strings.camelize(strings.underscore(name)); | |
| 22 } | |
| 23 | |
| 24 visit(Node node) => node.accept(this); | |
| 25 | |
| 26 visitStruct(Struct node) { | |
| 27 // TODO(kasper): Stop ignoring this. | |
| 28 } | |
| 29 | |
| 30 visitUnion(Union node) { | |
| 31 // TODO(kasper): Stop ignoring this. | |
| 32 } | |
| 33 | |
| 34 visitNodes(List<Node> nodes, String separatedBy(bool first)) { | |
| 35 bool first = true; | |
| 36 for (int i = 0; i < nodes.length; i++) { | |
| 37 write(separatedBy(first)); | |
| 38 if (first) first = false; | |
| 39 visit(nodes[i]); | |
| 40 } | |
| 41 } | |
| 42 } | |
| OLD | NEW |