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

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

Issue 1597893003: Don't include implicit initializing formal types in summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/type.dart'; 9 import 'package:analyzer/src/dart/element/type.dart';
10 import 'package:analyzer/src/generated/resolver.dart'; 10 import 'package:analyzer/src/generated/resolver.dart';
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 break; 601 break;
602 case ParameterKind.POSITIONAL: 602 case ParameterKind.POSITIONAL:
603 b.kind = UnlinkedParamKind.positional; 603 b.kind = UnlinkedParamKind.positional;
604 break; 604 break;
605 case ParameterKind.NAMED: 605 case ParameterKind.NAMED:
606 b.kind = UnlinkedParamKind.named; 606 b.kind = UnlinkedParamKind.named;
607 break; 607 break;
608 } 608 }
609 b.isInitializingFormal = parameter.isInitializingFormal; 609 b.isInitializingFormal = parameter.isInitializingFormal;
610 DartType type = parameter.type; 610 DartType type = parameter.type;
611 if (type is FunctionType) { 611 if (parameter.isInitializingFormal && parameter.hasImplicitType) {
612 b.isFunctionTyped = true; 612 b.hasImplicitType = true;
613 if (!type.returnType.isVoid) { 613 // We don't store the type of initializing formals that have an implicit
614 b.type = serializeTypeRef(type.returnType, parameter); 614 // type, because the type is inherited from the field.
615 } else {
616 if (type is FunctionType) {
617 b.isFunctionTyped = true;
618 if (!type.returnType.isVoid) {
619 b.type = serializeTypeRef(type.returnType, parameter);
620 }
621 b.parameters = type.parameters
622 .map((parameter) => serializeParam(parameter, context))
623 .toList();
624 } else {
625 b.type = serializeTypeRef(type, context);
626 b.hasImplicitType = parameter.hasImplicitType;
615 } 627 }
616 b.parameters = type.parameters
617 .map((parameter) => serializeParam(parameter, context))
618 .toList();
619 } else {
620 b.type = serializeTypeRef(type, context);
621 b.hasImplicitType = parameter.hasImplicitType;
622 } 628 }
623 return b; 629 return b;
624 } 630 }
625 631
626 /** 632 /**
627 * Serialize the given [prefix] into an index into the references table. 633 * Serialize the given [prefix] into an index into the references table.
628 */ 634 */
629 int serializePrefix(PrefixElement element) { 635 int serializePrefix(PrefixElement element) {
630 return referenceMap.putIfAbsent(element, () { 636 return referenceMap.putIfAbsent(element, () {
631 assert(unlinkedReferences.length == linkedReferences.length); 637 assert(unlinkedReferences.length == linkedReferences.length);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 b.nameOffset = variable.nameOffset; 774 b.nameOffset = variable.nameOffset;
769 b.type = serializeTypeRef(variable.type, variable); 775 b.type = serializeTypeRef(variable.type, variable);
770 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; 776 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement;
771 b.isFinal = variable.isFinal; 777 b.isFinal = variable.isFinal;
772 b.isConst = variable.isConst; 778 b.isConst = variable.isConst;
773 b.hasImplicitType = variable.hasImplicitType; 779 b.hasImplicitType = variable.hasImplicitType;
774 b.documentationComment = serializeDocumentation(variable); 780 b.documentationComment = serializeDocumentation(variable);
775 return b; 781 return b;
776 } 782 }
777 } 783 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698