| 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 const String TEST = """ | 10 const String TEST = """ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 var closedWorld = typesInferrer.closedWorld; | 46 var closedWorld = typesInferrer.closedWorld; |
| 47 | 47 |
| 48 checkArgument(String functionName, type) { | 48 checkArgument(String functionName, type) { |
| 49 dynamic functionElement = findElement(compiler, functionName); | 49 dynamic functionElement = findElement(compiler, functionName); |
| 50 var signature = functionElement.functionSignature; | 50 var signature = functionElement.functionSignature; |
| 51 var element = signature.requiredParameterCount > 0 | 51 var element = signature.requiredParameterCount > 0 |
| 52 ? signature.requiredParameters.first | 52 ? signature.requiredParameters.first |
| 53 : signature.optionalParameters.first; | 53 : signature.optionalParameters.first; |
| 54 Expect.equals( | 54 Expect.equals( |
| 55 type, | 55 type, |
| 56 simplify(typesInferrer.getTypeOfElement(element), closedWorld), | 56 simplify(typesInferrer.getTypeOfParameter(element), closedWorld), |
| 57 functionName); | 57 functionName); |
| 58 } | 58 } |
| 59 | 59 |
| 60 checkArgument('foo1', closedWorld.commonMasks.functionType); | 60 checkArgument('foo1', closedWorld.commonMasks.functionType); |
| 61 | 61 |
| 62 /// 01: ok | 62 /// 01: ok |
| 63 checkArgument('foo2', closedWorld.commonMasks.functionType); | 63 checkArgument('foo2', closedWorld.commonMasks.functionType); |
| 64 | 64 |
| 65 /// 02: ok | 65 /// 02: ok |
| 66 checkArgument('foo3', closedWorld.commonMasks.functionType); | 66 checkArgument('foo3', closedWorld.commonMasks.functionType); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 89 | 89 |
| 90 /// 10: ok | 90 /// 10: ok |
| 91 checkArgument('defaultFn5', closedWorld.commonMasks.uint31Type); | 91 checkArgument('defaultFn5', closedWorld.commonMasks.uint31Type); |
| 92 | 92 |
| 93 /// 11: ok | 93 /// 11: ok |
| 94 checkArgument('defaultFn6', closedWorld.commonMasks.uint31Type); | 94 checkArgument('defaultFn6', closedWorld.commonMasks.uint31Type); |
| 95 | 95 |
| 96 /// 12: ok | 96 /// 12: ok |
| 97 })); | 97 })); |
| 98 } | 98 } |
| OLD | NEW |