OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/compiler_new.dart' show CompilerOptions; | 7 import 'package:compiler/src/options.dart' show CompilerOptions; |
8 import 'package:compiler/src/null_compiler_output.dart'; | 8 import 'package:compiler/src/null_compiler_output.dart'; |
9 import 'memory_source_file_helper.dart'; | 9 import 'memory_source_file_helper.dart'; |
10 | 10 |
11 Future<Map<String, String>> generate(String code, | 11 Future<Map<String, String>> generate(String code, |
12 [List<String> options = const []]) { | 12 [List<String> options = const []]) { |
13 Uri script = currentDirectory.resolveUri(Platform.script); | 13 Uri script = currentDirectory.resolveUri(Platform.script); |
14 Uri libraryRoot = script.resolve('../../../sdk/'); | 14 Uri libraryRoot = script.resolve('../../../sdk/'); |
15 Uri packageRoot = script.resolve('./packages/'); | 15 Uri packageRoot = script.resolve('./packages/'); |
16 | 16 |
17 var provider = new MemorySourceFileProvider({ 'main.dart': code }); | 17 var provider = new MemorySourceFileProvider({ 'main.dart': code }); |
(...skipping 14 matching lines...) Expand all Loading... |
32 var backend = compiler.backend; | 32 var backend = compiler.backend; |
33 for (var element in backend.generatedCode.keys) { | 33 for (var element in backend.generatedCode.keys) { |
34 if (element.compilationUnit.script.readableUri != uri) continue; | 34 if (element.compilationUnit.script.readableUri != uri) continue; |
35 var name = element.name; | 35 var name = element.name; |
36 var code = backend.getGeneratedCode(element); | 36 var code = backend.getGeneratedCode(element); |
37 result[name] = code; | 37 result[name] = code; |
38 } | 38 } |
39 return result; | 39 return result; |
40 }); | 40 }); |
41 } | 41 } |
OLD | NEW |