OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
7 import 'package:compiler/src/null_compiler_output.dart'; | 7 import 'package:compiler/src/null_compiler_output.dart'; |
8 import 'memory_source_file_helper.dart'; | 8 import 'memory_source_file_helper.dart'; |
9 | 9 |
10 Future<Map<String, String>> generate(String code, | 10 Future<Map<String, String>> generate(String code, |
(...skipping 13 matching lines...) Expand all Loading... |
24 options, | 24 options, |
25 {}); | 25 {}); |
26 Uri uri = Uri.parse('memory:main.dart'); | 26 Uri uri = Uri.parse('memory:main.dart'); |
27 return compiler.run(uri).then((success) { | 27 return compiler.run(uri).then((success) { |
28 Expect.isTrue(success); | 28 Expect.isTrue(success); |
29 Map<String, String> result = new Map<String, String>(); | 29 Map<String, String> result = new Map<String, String>(); |
30 var backend = compiler.backend; | 30 var backend = compiler.backend; |
31 for (var element in backend.generatedCode.keys) { | 31 for (var element in backend.generatedCode.keys) { |
32 if (element.compilationUnit.script.readableUri != uri) continue; | 32 if (element.compilationUnit.script.readableUri != uri) continue; |
33 var name = element.name; | 33 var name = element.name; |
34 var code = backend.assembleCode(element); | 34 var code = backend.getGeneratedCode(element); |
35 result[name] = code; | 35 result[name] = code; |
36 } | 36 } |
37 return result; | 37 return result; |
38 }); | 38 }); |
39 } | 39 } |
OLD | NEW |