| 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.dart; | |
| 6 | |
| 7 import 'api.dart'; | 5 import 'api.dart'; |
| 8 | 6 |
| 9 /** | 7 /** |
| 10 * Visitor specialized for generating Dart code. | 8 * Visitor specialized for generating Dart code. |
| 11 */ | 9 */ |
| 12 class DartCodegenVisitor extends HierarchicalApiVisitor { | 10 class DartCodegenVisitor extends HierarchicalApiVisitor { |
| 13 /** | 11 /** |
| 14 * Type references in the spec that are named something else in Dart. | 12 * Type references in the spec that are named something else in Dart. |
| 15 */ | 13 */ |
| 16 static const Map<String, String> _typeRenames = const { | 14 static const Map<String, String> _typeRenames = const { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 42 return 'List<${dartType(type.itemType)}>'; | 40 return 'List<${dartType(type.itemType)}>'; |
| 43 } else if (type is TypeMap) { | 41 } else if (type is TypeMap) { |
| 44 return 'Map<${dartType(type.keyType)}, ${dartType(type.valueType)}>'; | 42 return 'Map<${dartType(type.keyType)}, ${dartType(type.valueType)}>'; |
| 45 } else if (type is TypeUnion) { | 43 } else if (type is TypeUnion) { |
| 46 return 'dynamic'; | 44 return 'dynamic'; |
| 47 } else { | 45 } else { |
| 48 throw new Exception("Can't convert to a dart type"); | 46 throw new Exception("Can't convert to a dart type"); |
| 49 } | 47 } |
| 50 } | 48 } |
| 51 } | 49 } |
| OLD | NEW |