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 library analyzer.src.dart.element.type; | 5 library analyzer.src.dart.element.type; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 return TypeParameterElement.EMPTY_LIST; | 595 return TypeParameterElement.EMPTY_LIST; |
596 } | 596 } |
597 List<TypeParameterElement> baseTypeFormals = element.typeParameters; | 597 List<TypeParameterElement> baseTypeFormals = element.typeParameters; |
598 int formalCount = baseTypeFormals.length; | 598 int formalCount = baseTypeFormals.length; |
599 if (formalCount == 0) { | 599 if (formalCount == 0) { |
600 return TypeParameterElement.EMPTY_LIST; | 600 return TypeParameterElement.EMPTY_LIST; |
601 } | 601 } |
602 | 602 |
603 // Create type formals with specialized bounds. | 603 // Create type formals with specialized bounds. |
604 // For example `<U extends T>` where T comes from an outer scope. | 604 // For example `<U extends T>` where T comes from an outer scope. |
605 List<TypeParameterElement> result = | 605 return TypeParameterMember.from(baseTypeFormals, this); |
606 new List<TypeParameterElement>(formalCount); | |
607 | |
608 for (int i = 0; i < formalCount; i++) { | |
609 result[i] = TypeParameterMember.from(baseTypeFormals[i], this); | |
610 } | |
611 return result; | |
612 } | 606 } |
613 | 607 |
614 @override | 608 @override |
615 List<TypeParameterElement> get typeParameters { | 609 List<TypeParameterElement> get typeParameters { |
616 if (_typeParameters == null) { | 610 if (_typeParameters == null) { |
617 // Combine the generic type variables from all enclosing contexts, except | 611 // Combine the generic type variables from all enclosing contexts, except |
618 // for this generic function's type variables. Those variables are | 612 // for this generic function's type variables. Those variables are |
619 // tracked in [boundTypeParameters]. | 613 // tracked in [boundTypeParameters]. |
620 _typeParameters = <TypeParameterElement>[]; | 614 _typeParameters = <TypeParameterElement>[]; |
621 | 615 |
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2797 | 2791 |
2798 @override | 2792 @override |
2799 TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this; | 2793 TypeImpl pruned(List<FunctionTypeAliasElement> prune) => this; |
2800 | 2794 |
2801 @override | 2795 @override |
2802 VoidTypeImpl substitute2( | 2796 VoidTypeImpl substitute2( |
2803 List<DartType> argumentTypes, List<DartType> parameterTypes, | 2797 List<DartType> argumentTypes, List<DartType> parameterTypes, |
2804 [List<FunctionTypeAliasElement> prune]) => | 2798 [List<FunctionTypeAliasElement> prune]) => |
2805 this; | 2799 this; |
2806 } | 2800 } |
OLD | NEW |