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

Side by Side Diff: pkg/compiler/lib/src/universe/selector.dart

Issue 2609063002: Further reduce use of Element in codegen. (Closed)
Patch Set: Created 3 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 dart2js.selector; 5 library dart2js.selector;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Names; 8 import '../common/names.dart' show Names;
9 import '../elements/elements.dart' 9 import '../elements/elements.dart'
10 show 10 show
11 Element, 11 Element,
12 Elements, 12 Elements,
13 FunctionElement, 13 FunctionElement,
14 FunctionSignature, 14 FunctionSignature,
15 MemberElement,
15 Name, 16 Name,
16 LibraryElement, 17 LibraryElement,
17 PublicName; 18 PublicName;
18 import '../util/util.dart' show Hashing; 19 import '../util/util.dart' show Hashing;
19 import '../common/resolution.dart' show Target; 20 import '../common/resolution.dart' show Target;
20 import 'call_structure.dart' show CallStructure; 21 import 'call_structure.dart' show CallStructure;
21 22
22 class SelectorKind { 23 class SelectorKind {
23 final String name; 24 final String name;
24 final int hashCode; 25 final int hashCode;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (isGetter) return true; 241 if (isGetter) return true;
241 if (isSetter) return false; 242 if (isSetter) return false;
242 return signatureApplies(element); 243 return signatureApplies(element);
243 } 244 }
244 245
245 bool signatureApplies(FunctionElement function) { 246 bool signatureApplies(FunctionElement function) {
246 if (Elements.isUnresolved(function)) return false; 247 if (Elements.isUnresolved(function)) return false;
247 return callStructure.signatureApplies(function.functionSignature); 248 return callStructure.signatureApplies(function.functionSignature);
248 } 249 }
249 250
250 bool applies(Element element) { 251 bool applies(MemberElement element) {
251 if (name != element.name) return false; 252 if (name != element.name) return false;
252 return appliesUnnamed(element); 253 return appliesUnnamed(element);
253 } 254 }
254 255
255 bool match(SelectorKind kind, Name memberName, CallStructure callStructure) { 256 bool match(SelectorKind kind, Name memberName, CallStructure callStructure) {
256 return this.kind == kind && 257 return this.kind == kind &&
257 this.memberName == memberName && 258 this.memberName == memberName &&
258 this.callStructure.match(callStructure); 259 this.callStructure.match(callStructure);
259 } 260 }
260 261
261 static int computeHashCode( 262 static int computeHashCode(
262 SelectorKind kind, Name name, CallStructure callStructure) { 263 SelectorKind kind, Name name, CallStructure callStructure) {
263 // Add bits from name and kind. 264 // Add bits from name and kind.
264 int hash = Hashing.mixHashCodeBits(name.hashCode, kind.hashCode); 265 int hash = Hashing.mixHashCodeBits(name.hashCode, kind.hashCode);
265 // Add bits from the call structure. 266 // Add bits from the call structure.
266 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); 267 return Hashing.mixHashCodeBits(hash, callStructure.hashCode);
267 } 268 }
268 269
269 String toString() { 270 String toString() {
270 return 'Selector($kind, $name, ${callStructure.structureToString()})'; 271 return 'Selector($kind, $name, ${callStructure.structureToString()})';
271 } 272 }
272 273
273 Selector toCallSelector() => new Selector.callClosureFrom(this); 274 Selector toCallSelector() => new Selector.callClosureFrom(this);
274 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698