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: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 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
8 import 'type_mask_test_helper.dart'; | 8 import 'type_mask_test_helper.dart'; |
9 | 9 |
10 const String TEST = """ | 10 const String TEST = """ |
(...skipping 25 matching lines...) Expand all Loading... |
36 checkReturn(String name, type) { | 36 checkReturn(String name, type) { |
37 var element = findElement(compiler, name); | 37 var element = findElement(compiler, name); |
38 Expect.equals( | 38 Expect.equals( |
39 type, | 39 type, |
40 simplify( | 40 simplify( |
41 typesInferrer.getReturnTypeOfElement(element), closedWorld), | 41 typesInferrer.getReturnTypeOfElement(element), closedWorld), |
42 name); | 42 name); |
43 } | 43 } |
44 | 44 |
45 checkReturnInClass(String className, String methodName, type) { | 45 checkReturnInClass(String className, String methodName, type) { |
46 var cls = findElement(compiler, className); | 46 dynamic cls = findElement(compiler, className); |
47 var element = cls.lookupLocalMember(methodName); | 47 var element = cls.lookupLocalMember(methodName); |
48 Expect.equals( | 48 Expect.equals( |
49 type, | 49 type, |
50 simplify( | 50 simplify( |
51 typesInferrer.getReturnTypeOfElement(element), closedWorld)); | 51 typesInferrer.getReturnTypeOfElement(element), closedWorld)); |
52 } | 52 } |
53 | 53 |
54 checkReturn('bar', commonMasks.uint31Type); | 54 checkReturn('bar', commonMasks.uint31Type); |
55 checkReturn('baz', commonMasks.functionType); | 55 checkReturn('baz', commonMasks.functionType); |
56 | 56 |
57 checkReturnInClass('A', 'foo', commonMasks.uint31Type); | 57 checkReturnInClass('A', 'foo', commonMasks.uint31Type); |
58 checkReturnInClass('B', 'foo', commonMasks.functionType); | 58 checkReturnInClass('B', 'foo', commonMasks.functionType); |
59 })); | 59 })); |
60 } | 60 } |
OLD | NEW |