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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_ast.dart

Issue 1954203002: Keep all type arguments in summaries - dynamic or not. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 serialization.summarize_ast; 5 library serialization.summarize_ast;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/dart/element/type.dart' show DartType; 10 import 'package:analyzer/dart/element/type.dart' show DartType;
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } else if (identifier is PrefixedIdentifier) { 786 } else if (identifier is PrefixedIdentifier) {
787 int prefixIndex = prefixIndices.putIfAbsent(identifier.prefix.name, 787 int prefixIndex = prefixIndices.putIfAbsent(identifier.prefix.name,
788 () => serializeSimpleReference(identifier.prefix.name)); 788 () => serializeSimpleReference(identifier.prefix.name));
789 b.reference = 789 b.reference =
790 serializeReference(prefixIndex, identifier.identifier.name); 790 serializeReference(prefixIndex, identifier.identifier.name);
791 } else { 791 } else {
792 throw new StateError( 792 throw new StateError(
793 'Unexpected identifier type: ${identifier.runtimeType}'); 793 'Unexpected identifier type: ${identifier.runtimeType}');
794 } 794 }
795 if (typeArguments != null) { 795 if (typeArguments != null) {
796 // Trailing type arguments of type 'dynamic' should be omitted. 796 b.typeArguments =
797 NodeList<TypeName> args = typeArguments.arguments; 797 typeArguments.arguments.map(serializeTypeName).toList();
798 int numArgsToSerialize = args.length;
799 while (
800 numArgsToSerialize > 0 && isDynamic(args[numArgsToSerialize - 1])) {
801 --numArgsToSerialize;
802 }
803 if (numArgsToSerialize > 0) {
804 List<EntityRefBuilder> serializedArguments = <EntityRefBuilder>[];
805 for (int i = 0; i < numArgsToSerialize; i++) {
806 serializedArguments.add(serializeTypeName(args[i]));
807 }
808 b.typeArguments = serializedArguments;
809 }
810 } 798 }
811 return b; 799 return b;
812 } 800 }
813 } 801 }
814 802
815 /** 803 /**
816 * Serialize a type name (which might be defined in a nested scope, at top 804 * Serialize a type name (which might be defined in a nested scope, at top
817 * level within this library, or at top level within an imported library) to 805 * level within this library, or at top level within an imported library) to
818 * a [EntityRef]. Note that this method does the right thing if the 806 * a [EntityRef]. Note that this method does the right thing if the
819 * name doesn't refer to an entity other than a type (e.g. a class member). 807 * name doesn't refer to an entity other than a type (e.g. a class member).
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 /** 1268 /**
1281 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. 1269 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s.
1282 */ 1270 */
1283 class _TypeParameterScope extends _Scope { 1271 class _TypeParameterScope extends _Scope {
1284 /** 1272 /**
1285 * Get the number of [_ScopedTypeParameter]s defined in this 1273 * Get the number of [_ScopedTypeParameter]s defined in this
1286 * [_TypeParameterScope]. 1274 * [_TypeParameterScope].
1287 */ 1275 */
1288 int get length => _definedNames.length; 1276 int get length => _definedNames.length;
1289 } 1277 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698