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 'package:async_helper/async_helper.dart'; | 5 import 'package:async_helper/async_helper.dart'; |
6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.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 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 Uri uri = new Uri(scheme: 'source'); | 31 Uri uri = new Uri(scheme: 'source'); |
32 var compiler = compilerFor(TEST, uri); | 32 var compiler = compilerFor(TEST, uri); |
33 asyncTest(() => compiler.run(uri).then((_) { | 33 asyncTest(() => compiler.run(uri).then((_) { |
34 var typesInferrer = compiler.globalInference.typesInferrerInternal; | 34 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
35 var closedWorld = typesInferrer.closedWorld; | 35 var closedWorld = typesInferrer.closedWorld; |
36 | 36 |
37 checkFieldTypeInClass(String className, String fieldName, type) { | 37 checkFieldTypeInClass(String className, String fieldName, type) { |
38 dynamic cls = findElement(compiler, className); | 38 dynamic cls = findElement(compiler, className); |
39 var element = cls.lookupLocalMember(fieldName); | 39 var element = cls.lookupLocalMember(fieldName); |
40 Expect.equals(type, | 40 Expect.equals(type, |
41 simplify(typesInferrer.getTypeOfElement(element), closedWorld)); | 41 simplify(typesInferrer.getTypeOfMember(element), closedWorld)); |
42 } | 42 } |
43 | 43 |
44 checkFieldTypeInClass( | 44 checkFieldTypeInClass( |
45 'A', 'intField', closedWorld.commonMasks.uint31Type); | 45 'A', 'intField', closedWorld.commonMasks.uint31Type); |
46 checkFieldTypeInClass( | 46 checkFieldTypeInClass( |
47 'A', 'giveUpField1', closedWorld.commonMasks.interceptorType); | 47 'A', 'giveUpField1', closedWorld.commonMasks.interceptorType); |
48 checkFieldTypeInClass('A', 'giveUpField2', | 48 checkFieldTypeInClass('A', 'giveUpField2', |
49 closedWorld.commonMasks.dynamicType.nonNullable()); | 49 closedWorld.commonMasks.dynamicType.nonNullable()); |
50 checkFieldTypeInClass( | 50 checkFieldTypeInClass( |
51 'A', 'fieldParameter', closedWorld.commonMasks.uint31Type); | 51 'A', 'fieldParameter', closedWorld.commonMasks.uint31Type); |
52 })); | 52 })); |
53 } | 53 } |
OLD | NEW |