Chromium Code Reviews| 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.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 8123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8134 * be `dynamic`, but sometimes it will be the bound of the ith type parameter. | 8134 * be `dynamic`, but sometimes it will be the bound of the ith type parameter. |
| 8135 */ | 8135 */ |
| 8136 DartType computeDefaultTypeArgument(int i) { | 8136 DartType computeDefaultTypeArgument(int i) { |
| 8137 // If strong mode is off, or we can tell quickly from the summary that there | 8137 // If strong mode is off, or we can tell quickly from the summary that there |
| 8138 // is no bound, then the default type argument is `dynamic`; we don't have | 8138 // is no bound, then the default type argument is `dynamic`; we don't have |
| 8139 // to call `typeParameters` to find that out. | 8139 // to call `typeParameters` to find that out. |
| 8140 if (!context.analysisOptions.strongMode || | 8140 if (!context.analysisOptions.strongMode || |
| 8141 (unlinkedTypeParams != null && unlinkedTypeParams[i].bound == null)) { | 8141 (unlinkedTypeParams != null && unlinkedTypeParams[i].bound == null)) { |
| 8142 return DynamicTypeImpl.instance; | 8142 return DynamicTypeImpl.instance; |
| 8143 } | 8143 } |
| 8144 return typeParameters[i].bound ?? DynamicTypeImpl.instance; | 8144 DartType bound = typeParameters[i].bound ?? DynamicTypeImpl.instance; |
| 8145 return context.typeSystem.instantiateToDynamic(bound); | |
|
Leaf
2016/09/30 23:44:52
I don't think this is really right for strong mode
| |
| 8145 } | 8146 } |
| 8146 | 8147 |
| 8147 /** | 8148 /** |
| 8148 * Convert the given [index] into a type parameter type. | 8149 * Convert the given [index] into a type parameter type. |
| 8149 */ | 8150 */ |
| 8150 TypeParameterType getTypeParameterType(int index) { | 8151 TypeParameterType getTypeParameterType(int index) { |
| 8151 List<TypeParameterType> types = typeParameterTypes; | 8152 List<TypeParameterType> types = typeParameterTypes; |
| 8152 if (index <= types.length) { | 8153 if (index <= types.length) { |
| 8153 return types[types.length - index]; | 8154 return types[types.length - index]; |
| 8154 } else if (enclosingTypeParameterContext != null) { | 8155 } else if (enclosingTypeParameterContext != null) { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8445 | 8446 |
| 8446 @override | 8447 @override |
| 8447 void visitElement(Element element) { | 8448 void visitElement(Element element) { |
| 8448 int offset = element.nameOffset; | 8449 int offset = element.nameOffset; |
| 8449 if (offset != -1) { | 8450 if (offset != -1) { |
| 8450 map[offset] = element; | 8451 map[offset] = element; |
| 8451 } | 8452 } |
| 8452 super.visitElement(element); | 8453 super.visitElement(element); |
| 8453 } | 8454 } |
| 8454 } | 8455 } |
| OLD | NEW |