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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 returnNum1(); | 111 returnNum1(); |
112 returnIntOrNull(); | 112 returnIntOrNull(); |
113 new A().foo(); | 113 new A().foo(); |
114 } | 114 } |
115 """; | 115 """; |
116 | 116 |
117 | 117 |
118 void main() { | 118 void main() { |
119 Uri uri = new Uri(scheme: 'source'); | 119 Uri uri = new Uri(scheme: 'source'); |
120 var compiler = compilerFor(TEST, uri); | 120 var compiler = compilerFor(TEST, uri); |
121 asyncTest(() => compiler.runCompiler(uri).then((_) { | 121 asyncTest(() => compiler.run(uri).then((_) { |
122 var typesInferrer = compiler.typesTask.typesInferrer; | 122 var typesInferrer = compiler.typesTask.typesInferrer; |
123 | 123 |
124 checkReturn(String name, type) { | 124 checkReturn(String name, type) { |
125 var element = findElement(compiler, name); | 125 var element = findElement(compiler, name); |
126 Expect.equals(type, | 126 Expect.equals(type, |
127 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), | 127 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), |
128 name); | 128 name); |
129 } | 129 } |
130 | 130 |
131 checkReturn('returnInt1', compiler.typesTask.uint31Type); | 131 checkReturn('returnInt1', compiler.typesTask.uint31Type); |
(...skipping 11 matching lines...) Expand all Loading... |
143 var cls = findElement(compiler, className); | 143 var cls = findElement(compiler, className); |
144 var element = cls.lookupLocalMember(methodName); | 144 var element = cls.lookupLocalMember(methodName); |
145 Expect.equals(type, | 145 Expect.equals(type, |
146 simplify(typesInferrer.getReturnTypeOfElement(element), compiler)); | 146 simplify(typesInferrer.getReturnTypeOfElement(element), compiler)); |
147 } | 147 } |
148 var cls = findElement(compiler, 'A'); | 148 var cls = findElement(compiler, 'A'); |
149 checkReturnInClass('A', 'foo', new TypeMask.nonNullExact(cls, | 149 checkReturnInClass('A', 'foo', new TypeMask.nonNullExact(cls, |
150 compiler.world)); | 150 compiler.world)); |
151 })); | 151 })); |
152 } | 152 } |
OLD | NEW |