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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
7 import 'memory_compiler.dart'; | 7 import 'memory_compiler.dart'; |
8 import 'compiler_helper.dart' show findElement; | 8 import 'compiler_helper.dart' show findElement; |
9 | 9 |
10 var SOURCES = const { | 10 var SOURCES = const { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 compileAndTest(source, checker, {createCode: false}) async { | 136 compileAndTest(source, checker, {createCode: false}) async { |
137 CompilationResult result = await runCompiler( | 137 CompilationResult result = await runCompiler( |
138 entryPoint: Uri.parse('memory:' + source), | 138 entryPoint: Uri.parse('memory:' + source), |
139 memorySourceFiles: SOURCES, | 139 memorySourceFiles: SOURCES, |
140 beforeRun: (compiler) { | 140 beforeRun: (compiler) { |
141 compiler.stopAfterTypeInference = !createCode; | 141 compiler.stopAfterTypeInference = !createCode; |
142 }); | 142 }); |
143 var compiler = result.compiler; | 143 var compiler = result.compiler; |
144 var commonMasks = compiler.commonMasks; | 144 var commonMasks = compiler.closedWorld.commonMasks; |
145 var typesInferrer = compiler.globalInference.typesInferrer; | 145 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
146 getType(String name) { | 146 getType(String name) { |
147 var element = findElement(compiler, name); | 147 var element = findElement(compiler, name); |
148 return typesInferrer.getTypeOfElement(element); | 148 return typesInferrer.getTypeOfElement(element); |
149 } | 149 } |
150 | 150 |
151 if (!createCode) { | 151 if (!createCode) { |
152 checker(commonMasks, getType, compiler); | 152 checker(commonMasks, getType, compiler); |
153 } else { | 153 } else { |
154 var element = compiler.mainFunction; | 154 var element = compiler.mainFunction; |
155 var code = compiler.backend.getGeneratedCode(element); | 155 var code = compiler.backend.getGeneratedCode(element); |
156 checker(code); | 156 checker(code); |
157 } | 157 } |
158 } | 158 } |
OLD | NEW |