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

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

Issue 1695033002: Ignore enclosing class type parameters in resynthesizing static class members. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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_test.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) 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 summary_resynthesizer; 5 library summary_resynthesizer;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 in serializedClass.executables) { 843 in serializedClass.executables) {
844 switch (serializedExecutable.kind) { 844 switch (serializedExecutable.kind) {
845 case UnlinkedExecutableKind.constructor: 845 case UnlinkedExecutableKind.constructor:
846 constructorFound = true; 846 constructorFound = true;
847 buildConstructor( 847 buildConstructor(
848 serializedExecutable, memberHolder, correspondingType); 848 serializedExecutable, memberHolder, correspondingType);
849 break; 849 break;
850 case UnlinkedExecutableKind.functionOrMethod: 850 case UnlinkedExecutableKind.functionOrMethod:
851 case UnlinkedExecutableKind.getter: 851 case UnlinkedExecutableKind.getter:
852 case UnlinkedExecutableKind.setter: 852 case UnlinkedExecutableKind.setter:
853 if (serializedExecutable.isStatic) {
854 currentTypeParameters.removeLast();
855 }
853 buildExecutable(serializedExecutable, memberHolder); 856 buildExecutable(serializedExecutable, memberHolder);
857 if (serializedExecutable.isStatic) {
858 currentTypeParameters.add(classElement.typeParameters);
859 }
854 break; 860 break;
855 } 861 }
856 } 862 }
857 if (!serializedClass.isMixinApplication) { 863 if (!serializedClass.isMixinApplication) {
858 if (!constructorFound) { 864 if (!constructorFound) {
859 // Synthesize implicit constructors. 865 // Synthesize implicit constructors.
860 ConstructorElementImpl constructor = new ConstructorElementImpl('', -1); 866 ConstructorElementImpl constructor = new ConstructorElementImpl('', -1);
861 constructor.synthetic = true; 867 constructor.synthetic = true;
862 constructor.returnType = correspondingType; 868 constructor.returnType = correspondingType;
863 constructor.type = new FunctionTypeImpl.elementWithNameAndArgs( 869 constructor.type = new FunctionTypeImpl.elementWithNameAndArgs(
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 UnlinkedTypeParam serializedTypeParameter) { 1646 UnlinkedTypeParam serializedTypeParameter) {
1641 TypeParameterElementImpl typeParameterElement = 1647 TypeParameterElementImpl typeParameterElement =
1642 new TypeParameterElementImpl( 1648 new TypeParameterElementImpl(
1643 serializedTypeParameter.name, serializedTypeParameter.nameOffset); 1649 serializedTypeParameter.name, serializedTypeParameter.nameOffset);
1644 typeParameterElement.type = new TypeParameterTypeImpl(typeParameterElement); 1650 typeParameterElement.type = new TypeParameterTypeImpl(typeParameterElement);
1645 buildAnnotations(typeParameterElement, serializedTypeParameter.annotations); 1651 buildAnnotations(typeParameterElement, serializedTypeParameter.annotations);
1646 return typeParameterElement; 1652 return typeParameterElement;
1647 } 1653 }
1648 1654
1649 /** 1655 /**
1650 * Build [TypeParameterElements] corresponding to the type parameters in 1656 * Build [TypeParameterElement]s corresponding to the type parameters in
1651 * [serializedTypeParameters] and store them in [currentTypeParameters]. 1657 * [serializedTypeParameters] and store them in [currentTypeParameters].
1652 * Also return them. 1658 * Also return them.
1653 */ 1659 */
1654 List<TypeParameterElement> buildTypeParameters( 1660 List<TypeParameterElement> buildTypeParameters(
1655 List<UnlinkedTypeParam> serializedTypeParameters) { 1661 List<UnlinkedTypeParam> serializedTypeParameters) {
1656 List<TypeParameterElement> typeParameters = 1662 List<TypeParameterElement> typeParameters =
1657 serializedTypeParameters.map(buildTypeParameter).toList(); 1663 serializedTypeParameters.map(buildTypeParameter).toList();
1658 currentTypeParameters.add(typeParameters); 1664 currentTypeParameters.add(typeParameters);
1659 for (int i = 0; i < serializedTypeParameters.length; i++) { 1665 for (int i = 0; i < serializedTypeParameters.length; i++) {
1660 finishTypeParameter(serializedTypeParameters[i], typeParameters[i]); 1666 finishTypeParameter(serializedTypeParameters[i], typeParameters[i]);
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 } 2182 }
2177 : () => this.element; 2183 : () => this.element;
2178 // TODO(paulberry): Is it a bug that we have to pass `false` for 2184 // TODO(paulberry): Is it a bug that we have to pass `false` for
2179 // isInstantiated? 2185 // isInstantiated?
2180 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false); 2186 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false);
2181 } else { 2187 } else {
2182 return null; 2188 return null;
2183 } 2189 }
2184 } 2190 }
2185 } 2191 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698