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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 case 'String': | 226 case 'String': |
227 case 'int': | 227 case 'int': |
228 case 'bool': | 228 case 'bool': |
229 // These types correspond exactly to Dart types | 229 // These types correspond exactly to Dart types |
230 return type.typeName; | 230 return type.typeName; |
231 case 'object': | 231 case 'object': |
232 return 'Map<String, dynamic>'; | 232 return 'Map<String, dynamic>'; |
233 default: | 233 default: |
234 throw new Exception(type.typeName); | 234 throw new Exception(type.typeName); |
235 } | 235 } |
| 236 } else if (type is TypeUnion) { |
| 237 return 'Object'; |
236 } else { | 238 } else { |
237 throw new Exception('Unexpected kind of TypeDecl'); | 239 throw new Exception('Unexpected kind of TypeDecl'); |
238 } | 240 } |
239 } | 241 } |
240 } | 242 } |
241 | 243 |
242 /** | 244 /** |
243 * Translate spec_input.html into protocol_matchers.dart. | 245 * Translate spec_input.html into protocol_matchers.dart. |
244 */ | 246 */ |
245 main() { | 247 main() { |
246 CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( | 248 CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( |
247 readApi()); | 249 readApi()); |
248 String code = visitor.collectCode(visitor.visitApi); | 250 String code = visitor.collectCode(visitor.visitApi); |
249 File outputFile = new File( | 251 File outputFile = new File( |
250 '../../test/integration/integration_test_methods.dart'); | 252 '../../test/integration/integration_test_methods.dart'); |
251 outputFile.writeAsStringSync(code); | 253 outputFile.writeAsStringSync(code); |
252 } | 254 } |
OLD | NEW |