| 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 library compiler.src.inferrer.type_graph_nodes; | 5 library compiler.src.inferrer.type_graph_nodes; |
| 6 | 6 |
| 7 import 'dart:collection' show IterableBase; | 7 import 'dart:collection' show IterableBase; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 633 } |
| 634 if (declaration.isInstanceMember && | 634 if (declaration.isInstanceMember && |
| 635 (declaration.name == Identifiers.noSuchMethod_ || | 635 (declaration.name == Identifiers.noSuchMethod_ || |
| 636 (declaration.name == Identifiers.call && | 636 (declaration.name == Identifiers.call && |
| 637 disableInferenceForClosures))) { | 637 disableInferenceForClosures))) { |
| 638 // Do not infer types for parameters of [noSuchMethod] and | 638 // Do not infer types for parameters of [noSuchMethod] and |
| 639 // [call] instance methods. | 639 // [call] instance methods. |
| 640 giveUp(inferrer); | 640 giveUp(inferrer); |
| 641 return safeType(inferrer); | 641 return safeType(inferrer); |
| 642 } | 642 } |
| 643 if (inferrer.compiler.inferenceWorld | 643 if (inferrer.closedWorldRefiner |
| 644 .getCurrentlyKnownMightBePassedToApply(declaration)) { | 644 .getCurrentlyKnownMightBePassedToApply(declaration)) { |
| 645 giveUp(inferrer); | 645 giveUp(inferrer); |
| 646 return safeType(inferrer); | 646 return safeType(inferrer); |
| 647 } | 647 } |
| 648 if (declaration == inferrer.mainElement) { | 648 if (declaration == inferrer.mainElement) { |
| 649 // The implicit call to main is not seen by the inferrer, | 649 // The implicit call to main is not seen by the inferrer, |
| 650 // therefore we explicitly set the type of its parameters as | 650 // therefore we explicitly set the type of its parameters as |
| 651 // dynamic. | 651 // dynamic. |
| 652 // TODO(14566): synthesize a call instead to get the exact | 652 // TODO(14566): synthesize a call instead to get the exact |
| 653 // types. | 653 // types. |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 } else if (annotation.isVoid) { | 1738 } else if (annotation.isVoid) { |
| 1739 otherType = closedWorld.commonMasks.nullType; | 1739 otherType = closedWorld.commonMasks.nullType; |
| 1740 } else { | 1740 } else { |
| 1741 assert(annotation.isInterfaceType); | 1741 assert(annotation.isInterfaceType); |
| 1742 otherType = new TypeMask.nonNullSubtype(annotation.element, closedWorld); | 1742 otherType = new TypeMask.nonNullSubtype(annotation.element, closedWorld); |
| 1743 } | 1743 } |
| 1744 if (isNullable) otherType = otherType.nullable(); | 1744 if (isNullable) otherType = otherType.nullable(); |
| 1745 if (type == null) return otherType; | 1745 if (type == null) return otherType; |
| 1746 return type.intersection(otherType, closedWorld); | 1746 return type.intersection(otherType, closedWorld); |
| 1747 } | 1747 } |
| OLD | NEW |