| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; | 6 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 7 import 'package:analyzer/dart/ast/token.dart'; | 7 import 'package:analyzer/dart/ast/token.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 List<TypeAnnotation> arguments = _buildTypeArguments(type.typeArguments); | 302 List<TypeAnnotation> arguments = _buildTypeArguments(type.typeArguments); |
| 303 return AstTestFactory.typeName3(name, arguments)..type = type; | 303 return AstTestFactory.typeName3(name, arguments)..type = type; |
| 304 } | 304 } |
| 305 if (type is DynamicTypeImpl) { | 305 if (type is DynamicTypeImpl) { |
| 306 var name = AstTestFactory.identifier3('dynamic') | 306 var name = AstTestFactory.identifier3('dynamic') |
| 307 ..staticElement = type.element | 307 ..staticElement = type.element |
| 308 ..staticType = type; | 308 ..staticType = type; |
| 309 return AstTestFactory.typeName3(name)..type = type; | 309 return AstTestFactory.typeName3(name)..type = type; |
| 310 } | 310 } |
| 311 // TODO(scheglov) Implement for other types. | 311 // TODO(scheglov) Implement for other types. |
| 312 throw new UnimplementedError('type: $type'); | 312 throw new UnimplementedError('type: (${type.runtimeType}) $type'); |
| 313 } | 313 } |
| 314 | 314 |
| 315 TypeArgumentList _buildTypeArgumentList(List<kernel.DartType> kernels) { | 315 TypeArgumentList _buildTypeArgumentList(List<kernel.DartType> kernels) { |
| 316 int length = kernels.length; | 316 int length = kernels.length; |
| 317 var types = new List<TypeAnnotation>(length); | 317 var types = new List<TypeAnnotation>(length); |
| 318 for (int i = 0; i < length; i++) { | 318 for (int i = 0; i < length; i++) { |
| 319 DartType type = _context.getType(null, kernels[i]); | 319 DartType type = _context.getType(null, kernels[i]); |
| 320 TypeAnnotation typeAnnotation = _buildType(type); | 320 TypeAnnotation typeAnnotation = _buildType(type); |
| 321 types[i] = typeAnnotation; | 321 types[i] = typeAnnotation; |
| 322 } | 322 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 for (var typeParameter in ctx.typeParameters) { | 718 for (var typeParameter in ctx.typeParameters) { |
| 719 if (typeParameter.name == name) { | 719 if (typeParameter.name == name) { |
| 720 return typeParameter; | 720 return typeParameter; |
| 721 } | 721 } |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 } | 724 } |
| 725 throw new StateError('Not found $kernelTypeParameter in $context'); | 725 throw new StateError('Not found $kernelTypeParameter in $context'); |
| 726 } | 726 } |
| 727 } | 727 } |
| OLD | NEW |