OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Calls via Function.apply. | 37 // Calls via Function.apply. |
38 Function.apply(foo5, []); | 38 Function.apply(foo5, []); |
39 Function.apply(foo6, []); | 39 Function.apply(foo6, []); |
40 } | 40 } |
41 """; | 41 """; |
42 | 42 |
43 | 43 |
44 void main() { | 44 void main() { |
45 Uri uri = new Uri(scheme: 'source'); | 45 Uri uri = new Uri(scheme: 'source'); |
46 var compiler = compilerFor(TEST, uri); | 46 var compiler = compilerFor(TEST, uri); |
47 asyncTest(() => compiler.runCompiler(uri).then((_) { | 47 asyncTest(() => compiler.run(uri).then((_) { |
48 var typesInferrer = compiler.typesTask.typesInferrer; | 48 var typesInferrer = compiler.typesTask.typesInferrer; |
49 | 49 |
50 checkArgument(String functionName, type) { | 50 checkArgument(String functionName, type) { |
51 var functionElement = findElement(compiler, functionName); | 51 var functionElement = findElement(compiler, functionName); |
52 var signature = functionElement.functionSignature; | 52 var signature = functionElement.functionSignature; |
53 var element = signature.requiredParameterCount > 0 | 53 var element = signature.requiredParameterCount > 0 |
54 ? signature.requiredParameters.first | 54 ? signature.requiredParameters.first |
55 : signature.optionalParameters.first; | 55 : signature.optionalParameters.first; |
56 Expect.equals(type, | 56 Expect.equals(type, |
57 simplify(typesInferrer.getTypeOfElement(element), compiler), | 57 simplify(typesInferrer.getTypeOfElement(element), compiler), |
(...skipping 17 matching lines...) Expand all Loading... |
75 checkArgument('foo6', compiler.typesTask.dynamicType); /// 06: ok | 75 checkArgument('foo6', compiler.typesTask.dynamicType); /// 06: ok |
76 | 76 |
77 checkArgument('defaultFn1', compiler.typesTask.uint31Type); /// 07: ok | 77 checkArgument('defaultFn1', compiler.typesTask.uint31Type); /// 07: ok |
78 checkArgument('defaultFn2', compiler.typesTask.uint31Type); /// 08: ok | 78 checkArgument('defaultFn2', compiler.typesTask.uint31Type); /// 08: ok |
79 checkArgument('defaultFn3', compiler.typesTask.uint31Type); /// 09: ok | 79 checkArgument('defaultFn3', compiler.typesTask.uint31Type); /// 09: ok |
80 checkArgument('defaultFn4', compiler.typesTask.uint31Type); /// 10: ok | 80 checkArgument('defaultFn4', compiler.typesTask.uint31Type); /// 10: ok |
81 checkArgument('defaultFn5', compiler.typesTask.uint31Type); /// 11: ok | 81 checkArgument('defaultFn5', compiler.typesTask.uint31Type); /// 11: ok |
82 checkArgument('defaultFn6', compiler.typesTask.uint31Type); /// 12: ok | 82 checkArgument('defaultFn6', compiler.typesTask.uint31Type); /// 12: ok |
83 })); | 83 })); |
84 } | 84 } |
OLD | NEW |