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

Side by Side Diff: pkg/compiler/lib/src/common/resolution.dart

Issue 1856713002: Test ResolutionImpact equivalence. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 4 years, 8 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 | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/compiler.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 1
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 library dart2js.common.resolution; 6 library dart2js.common.resolution;
7 7
8 import '../common.dart'; 8 import '../common.dart';
9 import '../compiler.dart' show 9 import '../compiler.dart' show
10 Compiler; 10 Compiler;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 bool operator ==(other) { 140 bool operator ==(other) {
141 if (identical(this, other)) return true; 141 if (identical(this, other)) return true;
142 if (other is! MapLiteralUse) return false; 142 if (other is! MapLiteralUse) return false;
143 return 143 return
144 type == other.type && 144 type == other.type &&
145 isConstant == other.isConstant && 145 isConstant == other.isConstant &&
146 isEmpty == other.isEmpty; 146 isEmpty == other.isEmpty;
147 } 147 }
148
149 String toString() {
150 return 'MapLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)';
151 }
148 } 152 }
149 153
150 /// A use of a list literal seen during resolution. 154 /// A use of a list literal seen during resolution.
151 class ListLiteralUse { 155 class ListLiteralUse {
152 final InterfaceType type; 156 final InterfaceType type;
153 final bool isConstant; 157 final bool isConstant;
154 final bool isEmpty; 158 final bool isEmpty;
155 159
156 ListLiteralUse(this.type, {this.isConstant: false, this.isEmpty: false}); 160 ListLiteralUse(this.type, {this.isConstant: false, this.isEmpty: false});
157 161
158 int get hashCode { 162 int get hashCode {
159 return 163 return
160 type.hashCode * 13 + 164 type.hashCode * 13 +
161 isConstant.hashCode * 17 + 165 isConstant.hashCode * 17 +
162 isEmpty.hashCode * 19; 166 isEmpty.hashCode * 19;
163 } 167 }
164 168
165 bool operator ==(other) { 169 bool operator ==(other) {
166 if (identical(this, other)) return true; 170 if (identical(this, other)) return true;
167 if (other is! ListLiteralUse) return false; 171 if (other is! ListLiteralUse) return false;
168 return 172 return
169 type == other.type && 173 type == other.type &&
170 isConstant == other.isConstant && 174 isConstant == other.isConstant &&
171 isEmpty == other.isEmpty; 175 isEmpty == other.isEmpty;
172 } 176 }
177
178 String toString() {
179 return 'ListLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)';
180 }
173 } 181 }
174 182
175 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. 183 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`.
176 abstract class Resolution { 184 abstract class Resolution {
177 Parsing get parsing; 185 Parsing get parsing;
178 DiagnosticReporter get reporter; 186 DiagnosticReporter get reporter;
179 CoreTypes get coreTypes; 187 CoreTypes get coreTypes;
180 188
189 bool retainCaches;
190
181 void resolveTypedef(TypedefElement typdef); 191 void resolveTypedef(TypedefElement typdef);
182 void resolveClass(ClassElement cls); 192 void resolveClass(ClassElement cls);
183 void registerClass(ClassElement cls); 193 void registerClass(ClassElement cls);
184 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation); 194 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation);
185 FunctionSignature resolveSignature(FunctionElement function); 195 FunctionSignature resolveSignature(FunctionElement function);
186 DartType resolveTypeAnnotation(Element element, TypeAnnotation node); 196 DartType resolveTypeAnnotation(Element element, TypeAnnotation node);
187 197
188 bool hasBeenResolved(Element element); 198 bool hasBeenResolved(Element element);
189 199
190 ResolutionWorkItem createWorkItem( 200 ResolutionWorkItem createWorkItem(
191 Element element, ItemCompilationContext compilationContext); 201 Element element, ItemCompilationContext compilationContext);
192 202
203 /// Returns `true` if the [ResolutionImpact] for [element] is cached.
204 bool hasResolutionImpact(Element element);
205
193 /// Returns the precomputed [ResolutionImpact] for [element]. 206 /// Returns the precomputed [ResolutionImpact] for [element].
194 ResolutionImpact getResolutionImpact(Element element); 207 ResolutionImpact getResolutionImpact(Element element);
195 208
196 /// Returns the precomputed [WorldImpact] for [element]. 209 /// Returns the precomputed [WorldImpact] for [element].
197 WorldImpact getWorldImpact(Element element); 210 WorldImpact getWorldImpact(Element element);
198 211
199 /// Computes the [WorldImpact] for [element]. 212 /// Computes the [WorldImpact] for [element].
200 WorldImpact computeWorldImpact(Element element); 213 WorldImpact computeWorldImpact(Element element);
201 214
202 /// Removes the [WorldImpact] for [element] from the resolution cache. Later 215 /// Removes the [WorldImpact] for [element] from the resolution cache. Later
203 /// calls to [getWorldImpact] or [computeWorldImpact] returns an empty impact. 216 /// calls to [getWorldImpact] or [computeWorldImpact] returns an empty impact.
204 void uncacheWorldImpact(Element element); 217 void uncacheWorldImpact(Element element);
205 218
206 /// Removes the [WorldImpact]s for all [Element]s in the resolution cache. , 219 /// Removes the [WorldImpact]s for all [Element]s in the resolution cache. ,
207 /// Later calls to [getWorldImpact] or [computeWorldImpact] returns an empty 220 /// Later calls to [getWorldImpact] or [computeWorldImpact] returns an empty
208 /// impact. 221 /// impact.
209 void emptyCache(); 222 void emptyCache();
210 } 223 }
211 224
212 // TODO(johnniwinther): Rename to `Parser` or `ParsingContext`. 225 // TODO(johnniwinther): Rename to `Parser` or `ParsingContext`.
213 abstract class Parsing { 226 abstract class Parsing {
214 DiagnosticReporter get reporter; 227 DiagnosticReporter get reporter;
215 void parsePatchClass(ClassElement cls); 228 void parsePatchClass(ClassElement cls);
216 measure(f()); 229 measure(f());
217 ScannerOptions getScannerOptionsFor(Element element); 230 ScannerOptions getScannerOptionsFor(Element element);
218 } 231 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698