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 // Test that we are analyzing field parameters correctly. | 5 // Test that we are analyzing field parameters correctly. |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
10 import 'parser_helper.dart'; | |
11 import 'type_mask_test_helper.dart'; | 10 import 'type_mask_test_helper.dart'; |
12 | 11 |
13 const String TEST = """ | 12 const String TEST = """ |
14 | 13 |
15 class A { | 14 class A { |
16 final dynamicField; | 15 final dynamicField; |
17 A() : dynamicField = 42; | 16 A() : dynamicField = 42; |
18 A.bar(this.dynamicField); | 17 A.bar(this.dynamicField); |
19 } | 18 } |
20 | 19 |
(...skipping 13 matching lines...) Expand all Loading... |
34 var cls = findElement(compiler, className); | 33 var cls = findElement(compiler, className); |
35 var element = cls.lookupLocalMember(fieldName); | 34 var element = cls.lookupLocalMember(fieldName); |
36 Expect.equals(type, | 35 Expect.equals(type, |
37 simplify(typesInferrer.getTypeOfElement(element), compiler)); | 36 simplify(typesInferrer.getTypeOfElement(element), compiler)); |
38 } | 37 } |
39 | 38 |
40 checkFieldTypeInClass('A', 'dynamicField', | 39 checkFieldTypeInClass('A', 'dynamicField', |
41 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass')); | 40 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass')); |
42 })); | 41 })); |
43 } | 42 } |
OLD | NEW |