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.generated.resolver; | 5 library analyzer.src.generated.resolver; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 7525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7536 return null; | 7536 return null; |
7537 } | 7537 } |
7538 | 7538 |
7539 if (fnType.typeFormals.length != typeParameters.length) { | 7539 if (fnType.typeFormals.length != typeParameters.length) { |
7540 // A subtype cannot have different number of type formals. | 7540 // A subtype cannot have different number of type formals. |
7541 return null; | 7541 return null; |
7542 } | 7542 } |
7543 | 7543 |
7544 // Same number of type formals. Instantiate the function type so its | 7544 // Same number of type formals. Instantiate the function type so its |
7545 // parameter and return type are in terms of the surrounding context. | 7545 // parameter and return type are in terms of the surrounding context. |
7546 return fnType.instantiate( | 7546 return fnType.instantiate(typeParameters |
7547 typeParameters.map((t) => t.name.staticElement.type).toList()); | 7547 .map((TypeParameter t) => |
| 7548 (t.name.staticElement as TypeParameterElement).type) |
| 7549 .toList()); |
7548 } | 7550 } |
7549 | 7551 |
7550 /** | 7552 /** |
7551 * If it is appropriate to do so, override the current type of the static and
propagated elements | 7553 * If it is appropriate to do so, override the current type of the static and
propagated elements |
7552 * associated with the given expression with the given type. Generally speakin
g, it is appropriate | 7554 * associated with the given expression with the given type. Generally speakin
g, it is appropriate |
7553 * if the given type is more specific than the current type. | 7555 * if the given type is more specific than the current type. |
7554 * | 7556 * |
7555 * @param expression the expression used to access the static and propagated e
lements whose types | 7557 * @param expression the expression used to access the static and propagated e
lements whose types |
7556 * might be overridden | 7558 * might be overridden |
7557 * @param potentialType the potential type of the elements | 7559 * @param potentialType the potential type of the elements |
(...skipping 5415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12973 nonFields.add(node); | 12975 nonFields.add(node); |
12974 return null; | 12976 return null; |
12975 } | 12977 } |
12976 | 12978 |
12977 @override | 12979 @override |
12978 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 12980 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
12979 | 12981 |
12980 @override | 12982 @override |
12981 Object visitWithClause(WithClause node) => null; | 12983 Object visitWithClause(WithClause node) => null; |
12982 } | 12984 } |
OLD | NEW |