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

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

Issue 2034473002: Delay 'supertype' for ClassElementImpl and EnumElementImpl. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /** 73 /**
74 * A list containing all of the methods contained in this class. 74 * A list containing all of the methods contained in this class.
75 */ 75 */
76 List<MethodElement> _methods = MethodElement.EMPTY_LIST; 76 List<MethodElement> _methods = MethodElement.EMPTY_LIST;
77 77
78 /** 78 /**
79 * The superclass of the class, or `null` if the class does not have an 79 * The superclass of the class, or `null` if the class does not have an
80 * explicit superclass. 80 * explicit superclass.
81 */ 81 */
82 @override 82 @override
83 InterfaceType supertype; 83 InterfaceType _supertype;
84 84
85 /** 85 /**
86 * The type defined by the class. 86 * The type defined by the class.
87 */ 87 */
88 @override 88 @override
89 InterfaceType type; 89 InterfaceType type;
90 90
91 /** 91 /**
92 * A list containing all of the type parameters defined for this class. 92 * A list containing all of the type parameters defined for this class.
93 */ 93 */
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 1131
1132 @override 1132 @override
1133 int get nameOffset { 1133 int get nameOffset {
1134 if (_unlinkedClass != null) { 1134 if (_unlinkedClass != null) {
1135 return _unlinkedClass.nameOffset; 1135 return _unlinkedClass.nameOffset;
1136 } 1136 }
1137 return super.nameOffset; 1137 return super.nameOffset;
1138 } 1138 }
1139 1139
1140 @override 1140 @override
1141 InterfaceType get supertype {
1142 if (_unlinkedClass != null && _supertype == null) {
1143 if (_unlinkedClass.supertype != null) {
1144 _supertype = enclosingUnit.resynthesizerContext
1145 .resolveTypeRef(_unlinkedClass.supertype, this);
1146 } else if (_unlinkedClass.hasNoSupertype) {
1147 return null;
1148 } else {
1149 _supertype = context.typeProvider.objectType;
1150 }
1151 }
1152 return _supertype;
1153 }
1154
1155 void set supertype(InterfaceType supertype) {
1156 assert(_unlinkedClass == null);
1157 _supertype = supertype;
1158 }
1159
1160 @override
1141 List<TypeParameterElement> get typeParameters { 1161 List<TypeParameterElement> get typeParameters {
1142 if (_unlinkedClass != null) { 1162 if (_unlinkedClass != null) {
1143 return resynthesizedTypeParameters; 1163 return resynthesizedTypeParameters;
1144 } 1164 }
1145 return super.typeParameters; 1165 return super.typeParameters;
1146 } 1166 }
1147 1167
1148 /** 1168 /**
1149 * Set the type parameters defined for this class to the given 1169 * Set the type parameters defined for this class to the given
1150 * [typeParameters]. 1170 * [typeParameters].
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 3069
3050 @override 3070 @override
3051 int get nameOffset { 3071 int get nameOffset {
3052 if (_unlinkedEnum != null) { 3072 if (_unlinkedEnum != null) {
3053 return _unlinkedEnum.nameOffset; 3073 return _unlinkedEnum.nameOffset;
3054 } 3074 }
3055 return super.nameOffset; 3075 return super.nameOffset;
3056 } 3076 }
3057 3077
3058 @override 3078 @override
3079 InterfaceType get supertype => context.typeProvider.objectType;
3080
3081 @override
3059 List<TypeParameterElement> get typeParameters => 3082 List<TypeParameterElement> get typeParameters =>
3060 const <TypeParameterElement>[]; 3083 const <TypeParameterElement>[];
3061 3084
3062 /** 3085 /**
3063 * Set the type parameters defined for this class to the given 3086 * Set the type parameters defined for this class to the given
3064 * [typeParameters]. 3087 * [typeParameters].
3065 */ 3088 */
3066 void set typeParameters(List<TypeParameterElement> typeParameters) { 3089 void set typeParameters(List<TypeParameterElement> typeParameters) {
3067 assert(false); 3090 assert(false);
3068 } 3091 }
(...skipping 4859 matching lines...) Expand 10 before | Expand all | Expand 10 after
7928 7951
7929 @override 7952 @override
7930 void visitElement(Element element) { 7953 void visitElement(Element element) {
7931 int offset = element.nameOffset; 7954 int offset = element.nameOffset;
7932 if (offset != -1) { 7955 if (offset != -1) {
7933 map[offset] = element; 7956 map[offset] = element;
7934 } 7957 }
7935 super.visitElement(element); 7958 super.visitElement(element);
7936 } 7959 }
7937 } 7960 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698