Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: pkg/analyzer/lib/src/kernel/resynthesize.dart

Issue 3009933002: Resynthesize references to type parameters in default expressions from Kernel. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 416 }
417 417
418 TypeAnnotation _buildType(DartType type) { 418 TypeAnnotation _buildType(DartType type) {
419 if (type is InterfaceType) { 419 if (type is InterfaceType) {
420 var name = AstTestFactory.identifier3(type.element.name) 420 var name = AstTestFactory.identifier3(type.element.name)
421 ..staticElement = type.element 421 ..staticElement = type.element
422 ..staticType = type; 422 ..staticType = type;
423 List<TypeAnnotation> arguments = _buildTypeArguments(type.typeArguments); 423 List<TypeAnnotation> arguments = _buildTypeArguments(type.typeArguments);
424 return AstTestFactory.typeName3(name, arguments)..type = type; 424 return AstTestFactory.typeName3(name, arguments)..type = type;
425 } 425 }
426 if (type is DynamicTypeImpl) { 426 if (type is DynamicTypeImpl || type is TypeParameterType) {
427 var identifier = AstTestFactory.identifier3('dynamic') 427 var identifier = AstTestFactory.identifier3(type.name)
428 ..staticElement = type.element 428 ..staticElement = type.element
429 ..staticType = type; 429 ..staticType = type;
430 return AstTestFactory.typeName3(identifier)..type = type; 430 return AstTestFactory.typeName3(identifier)..type = type;
431 } 431 }
432 // TODO(scheglov) Implement for other types. 432 // TODO(scheglov) Implement for other types.
433 throw new UnimplementedError('type: (${type.runtimeType}) $type'); 433 throw new UnimplementedError('type: (${type.runtimeType}) $type');
434 } 434 }
435 435
436 TypeArgumentList _buildTypeArgumentList(List<kernel.DartType> kernels) { 436 TypeArgumentList _buildTypeArgumentList(List<kernel.DartType> kernels) {
437 int length = kernels.length; 437 int length = kernels.length;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 for (var typeParameter in ctx.typeParameters) { 847 for (var typeParameter in ctx.typeParameters) {
848 if (typeParameter.name == name) { 848 if (typeParameter.name == name) {
849 return typeParameter; 849 return typeParameter;
850 } 850 }
851 } 851 }
852 } 852 }
853 } 853 }
854 throw new StateError('Not found $kernelTypeParameter in $context'); 854 throw new StateError('Not found $kernelTypeParameter in $context');
855 } 855 }
856 } 856 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698