| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 | 7 |
| 8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 9 import 'type_mask_test_helper.dart'; | 9 import 'type_mask_test_helper.dart'; |
| 10 import 'package:compiler/src/types/types.dart'; | 10 import 'package:compiler/src/types/types.dart'; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void main() { | 60 void main() { |
| 61 Uri uri = new Uri(scheme: 'source'); | 61 Uri uri = new Uri(scheme: 'source'); |
| 62 var compiler = compilerFor(TEST, uri); | 62 var compiler = compilerFor(TEST, uri); |
| 63 asyncTest(() => compiler.run(uri).then((_) { | 63 asyncTest(() => compiler.run(uri).then((_) { |
| 64 var typesInferrer = compiler.globalInference.typesInferrerInternal; | 64 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
| 65 var closedWorld = typesInferrer.closedWorld; | 65 var closedWorld = typesInferrer.closedWorld; |
| 66 var commonMasks = closedWorld.commonMasks; | 66 var commonMasks = closedWorld.commonMasks; |
| 67 | 67 |
| 68 typeOf(String name) { | 68 typeOf(String name) { |
| 69 return typesInferrer | 69 return typesInferrer |
| 70 .getReturnTypeOfElement(findElement(compiler, name)); | 70 .getReturnTypeOfMember(findElement(compiler, name)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 checkType(String name, type) { | 73 checkType(String name, type) { |
| 74 var mask = typeOf(name); | 74 var mask = typeOf(name); |
| 75 Expect.equals(type.nullable(), simplify(mask, closedWorld), name); | 75 Expect.equals(type.nullable(), simplify(mask, closedWorld), name); |
| 76 } | 76 } |
| 77 | 77 |
| 78 checkContainer(String name, bool value) { | 78 checkContainer(String name, bool value) { |
| 79 var mask = typeOf(name); | 79 var mask = typeOf(name); |
| 80 Expect.equals( | 80 Expect.equals( |
| 81 value, isContainer(mask), '$name is container (mask: $mask)'); | 81 value, isContainer(mask), '$name is container (mask: $mask)'); |
| 82 } | 82 } |
| 83 | 83 |
| 84 checkContainer('probe1methods', true); | 84 checkContainer('probe1methods', true); |
| 85 checkType('probe1res', commonMasks.uint31Type); | 85 checkType('probe1res', commonMasks.uint31Type); |
| 86 checkType('probe1sum', commonMasks.positiveIntType); | 86 checkType('probe1sum', commonMasks.positiveIntType); |
| 87 | 87 |
| 88 checkContainer('probe2methods', false); | 88 checkContainer('probe2methods', false); |
| 89 checkType('probe2res', commonMasks.dynamicType); | 89 checkType('probe2res', commonMasks.dynamicType); |
| 90 })); | 90 })); |
| 91 } | 91 } |
| OLD | NEW |