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 'package:compiler/src/types/types.dart' show ContainerTypeMask, TypeMask; | 7 import 'package:compiler/src/types/types.dart' show ContainerTypeMask, TypeMask; |
8 import 'package:compiler/src/compiler.dart'; | 8 import 'package:compiler/src/compiler.dart'; |
9 | 9 |
10 import 'memory_compiler.dart'; | 10 import 'memory_compiler.dart'; |
(...skipping 11 matching lines...) Expand all Loading... |
22 var a = new Float32List(9); | 22 var a = new Float32List(9); |
23 return myList[0] + myOtherList[0]; | 23 return myList[0] + myOtherList[0]; |
24 } | 24 } |
25 ''' | 25 ''' |
26 }; | 26 }; |
27 | 27 |
28 void main() { | 28 void main() { |
29 asyncTest(() async { | 29 asyncTest(() async { |
30 CompilationResult result = await runCompiler(memorySourceFiles: TEST); | 30 CompilationResult result = await runCompiler(memorySourceFiles: TEST); |
31 Compiler compiler = result.compiler; | 31 Compiler compiler = result.compiler; |
32 var typesInferrer = compiler.globalInference.typesInferrer; | 32 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
33 | 33 |
34 checkType(String name, type, length) { | 34 checkType(String name, type, length) { |
35 var element = findElement(compiler, name); | 35 var element = findElement(compiler, name); |
36 TypeMask mask = typesInferrer.getTypeOfElement(element); | 36 TypeMask mask = typesInferrer.getTypeOfElement(element); |
37 Expect.isTrue(mask.isContainer); | 37 Expect.isTrue(mask.isContainer); |
38 ContainerTypeMask container = mask; | 38 ContainerTypeMask container = mask; |
39 Expect.equals(type, simplify(container.elementType, compiler), name); | 39 Expect.equals(type, simplify(container.elementType, compiler), name); |
40 Expect.equals(container.length, length); | 40 Expect.equals(container.length, length); |
41 } | 41 } |
42 | 42 |
43 checkType('myList', compiler.commonMasks.numType, 42); | 43 checkType('myList', compiler.closedWorld.commonMasks.numType, 42); |
44 checkType('myOtherList', compiler.commonMasks.uint31Type, 32); | 44 checkType('myOtherList', compiler.closedWorld.commonMasks.uint31Type, 32); |
45 }); | 45 }); |
46 } | 46 } |
OLD | NEW |