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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 3006983002: Fix for using enums as InterfaceType(s) when resynthesize 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return true; 765 return true;
766 } 766 }
767 } 767 }
768 return false; 768 return false;
769 } 769 }
770 770
771 @override 771 @override
772 List<InterfaceType> get interfaces { 772 List<InterfaceType> get interfaces {
773 if (_interfaces == null) { 773 if (_interfaces == null) {
774 if (_kernel != null) { 774 if (_kernel != null) {
775 _interfaces = _kernel.implementedTypes 775 var context = enclosingUnit._kernelContext;
776 .map((k) => enclosingUnit._kernelContext.getInterfaceType(this, k)) 776 _interfaces = context.getInterfaceTypes(this, _kernel.implementedTypes);
777 .toList(growable: false);
778 } 777 }
779 if (_unlinkedClass != null) { 778 if (_unlinkedClass != null) {
780 ResynthesizerContext context = enclosingUnit.resynthesizerContext; 779 ResynthesizerContext context = enclosingUnit.resynthesizerContext;
781 _interfaces = _unlinkedClass.interfaces 780 _interfaces = _unlinkedClass.interfaces
782 .map((EntityRef t) => context.resolveTypeRef(this, t)) 781 .map((EntityRef t) => context.resolveTypeRef(this, t))
783 .where(_isClassInterfaceType) 782 .where(_isClassInterfaceType)
784 .toList(growable: false); 783 .toList(growable: false);
785 } 784 }
786 } 785 }
787 return _interfaces ?? const <InterfaceType>[]; 786 return _interfaces ?? const <InterfaceType>[];
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 _assertNotResynthesized(_unlinkedClass); 901 _assertNotResynthesized(_unlinkedClass);
903 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication); 902 setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication);
904 } 903 }
905 904
906 @override 905 @override
907 List<InterfaceType> get mixins { 906 List<InterfaceType> get mixins {
908 if (_mixins == null) { 907 if (_mixins == null) {
909 if (_kernel != null) { 908 if (_kernel != null) {
910 _initializeKernelMixins(); 909 _initializeKernelMixins();
911 var context = enclosingUnit._kernelContext; 910 var context = enclosingUnit._kernelContext;
912 _mixins = _kernelMixins.map((k) { 911 _mixins = context.getInterfaceTypes(this, _kernelMixins);
913 return context.getInterfaceType(this, k);
914 }).toList(growable: false);
915 } 912 }
916 if (_unlinkedClass != null) { 913 if (_unlinkedClass != null) {
917 ResynthesizerContext context = enclosingUnit.resynthesizerContext; 914 ResynthesizerContext context = enclosingUnit.resynthesizerContext;
918 _mixins = _unlinkedClass.mixins 915 _mixins = _unlinkedClass.mixins
919 .map((EntityRef t) => context.resolveTypeRef(this, t)) 916 .map((EntityRef t) => context.resolveTypeRef(this, t))
920 .where(_isClassInterfaceType) 917 .where(_isClassInterfaceType)
921 .toList(growable: false); 918 .toList(growable: false);
922 } 919 }
923 } 920 }
924 return _mixins ?? const <InterfaceType>[]; 921 return _mixins ?? const <InterfaceType>[];
(...skipping 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after
6190 List<List<kernel.VariableDeclaration>> getFunctionTypeParameters( 6187 List<List<kernel.VariableDeclaration>> getFunctionTypeParameters(
6191 kernel.FunctionType functionType); 6188 kernel.FunctionType functionType);
6192 6189
6193 /** 6190 /**
6194 * Return the [InterfaceType] for the given Kernel [type], or `null` if the 6191 * Return the [InterfaceType] for the given Kernel [type], or `null` if the
6195 * [type] does not correspond to an [InterfaceType]. 6192 * [type] does not correspond to an [InterfaceType].
6196 */ 6193 */
6197 InterfaceType getInterfaceType(ElementImpl context, kernel.Supertype type); 6194 InterfaceType getInterfaceType(ElementImpl context, kernel.Supertype type);
6198 6195
6199 /** 6196 /**
6197 * Return the [InterfaceType]s for the given Kernel [types], skipping
6198 * the elements that don't correspond to an [InterfaceType].
6199 */
6200 List<InterfaceType> getInterfaceTypes(
6201 ElementImpl context, List<kernel.Supertype> types);
6202
6203 /**
6200 * Return the [ConstructorElementImpl] to which the given [kernelConstructor] 6204 * Return the [ConstructorElementImpl] to which the given [kernelConstructor]
6201 * or [kernelFactory] redirects. 6205 * or [kernelFactory] redirects.
6202 */ 6206 */
6203 ConstructorElementImpl getRedirectedConstructor( 6207 ConstructorElementImpl getRedirectedConstructor(
6204 kernel.Constructor kernelConstructor, kernel.Procedure kernelFactory); 6208 kernel.Constructor kernelConstructor, kernel.Procedure kernelFactory);
6205 6209
6206 /** 6210 /**
6207 * Return the [DartType] for the given Kernel [type], or `null` if the [type] 6211 * Return the [DartType] for the given Kernel [type], or `null` if the [type]
6208 * does not correspond to a [DartType]. 6212 * does not correspond to a [DartType].
6209 */ 6213 */
(...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after
10015 10019
10016 @override 10020 @override
10017 DartObject computeConstantValue() => null; 10021 DartObject computeConstantValue() => null;
10018 10022
10019 @override 10023 @override
10020 void visitChildren(ElementVisitor visitor) { 10024 void visitChildren(ElementVisitor visitor) {
10021 super.visitChildren(visitor); 10025 super.visitChildren(visitor);
10022 _initializer?.accept(visitor); 10026 _initializer?.accept(visitor);
10023 } 10027 }
10024 } 10028 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/kernel/resynthesize.dart » ('j') | pkg/analyzer/lib/src/kernel/resynthesize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698