OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of resolution; | 5 part of resolution; |
6 | 6 |
7 abstract class TreeElements { | 7 abstract class TreeElements { |
8 Element get currentElement; | 8 Element get currentElement; |
9 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
10 | 10 |
(...skipping 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3761 if (typeNode.bound != null) { | 3761 if (typeNode.bound != null) { |
3762 DartType boundType = typeResolver.resolveTypeAnnotation( | 3762 DartType boundType = typeResolver.resolveTypeAnnotation( |
3763 this, typeNode.bound); | 3763 this, typeNode.bound); |
3764 variableElement.boundCache = boundType; | 3764 variableElement.boundCache = boundType; |
3765 | 3765 |
3766 void checkTypeVariableBound() { | 3766 void checkTypeVariableBound() { |
3767 Link<TypeVariableElement> seenTypeVariables = | 3767 Link<TypeVariableElement> seenTypeVariables = |
3768 const Link<TypeVariableElement>(); | 3768 const Link<TypeVariableElement>(); |
3769 seenTypeVariables = seenTypeVariables.prepend(variableElement); | 3769 seenTypeVariables = seenTypeVariables.prepend(variableElement); |
3770 DartType bound = boundType; | 3770 DartType bound = boundType; |
3771 while (bound.element.isTypeVariable()) { | 3771 while (bound.kind == TypeKind.TYPE_VARIABLE) { |
3772 TypeVariableElement element = bound.element; | 3772 TypeVariableElement element = bound.element; |
3773 if (seenTypeVariables.contains(element)) { | 3773 if (seenTypeVariables.contains(element)) { |
3774 if (identical(element, variableElement)) { | 3774 if (identical(element, variableElement)) { |
3775 // Only report an error on the checked type variable to avoid | 3775 // Only report an error on the checked type variable to avoid |
3776 // generating multiple errors for the same cyclicity. | 3776 // generating multiple errors for the same cyclicity. |
3777 warning(typeNode.name, MessageKind.CYCLIC_TYPE_VARIABLE, | 3777 warning(typeNode.name, MessageKind.CYCLIC_TYPE_VARIABLE, |
3778 {'typeVariableName': variableElement.name}); | 3778 {'typeVariableName': variableElement.name}); |
3779 } | 3779 } |
3780 break; | 3780 break; |
3781 } | 3781 } |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4668 TreeElements _treeElements; | 4668 TreeElements _treeElements; |
4669 | 4669 |
4670 bool get hasTreeElements => _treeElements != null; | 4670 bool get hasTreeElements => _treeElements != null; |
4671 | 4671 |
4672 TreeElements get treeElements { | 4672 TreeElements get treeElements { |
4673 assert(invariant(this, _treeElements !=null, | 4673 assert(invariant(this, _treeElements !=null, |
4674 message: "TreeElements have not been computed for $this.")); | 4674 message: "TreeElements have not been computed for $this.")); |
4675 return _treeElements; | 4675 return _treeElements; |
4676 } | 4676 } |
4677 } | 4677 } |
OLD | NEW |