| OLD | NEW |
| 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 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return isSetter | 236 return isSetter |
| 237 ? !element.isFinal && !element.isConst | 237 ? !element.isFinal && !element.isConst |
| 238 : isGetter || isCall; | 238 : isGetter || isCall; |
| 239 } | 239 } |
| 240 if (isGetter) return true; | 240 if (isGetter) return true; |
| 241 if (isSetter) return false; | 241 if (isSetter) return false; |
| 242 return signatureApplies(element); | 242 return signatureApplies(element); |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool signatureApplies(MethodElement function) { | 245 bool signatureApplies(MethodElement function) { |
| 246 if (Elements.isUnresolved(function)) return false; | 246 return callStructure.signatureApplies(function.parameterStructure); |
| 247 return callStructure.signatureApplies(function.type); | |
| 248 } | 247 } |
| 249 | 248 |
| 250 bool applies(MemberElement element) { | 249 bool applies(MemberElement element) { |
| 251 if (name != element.name) return false; | 250 if (name != element.name) return false; |
| 252 return appliesUnnamed(element); | 251 return appliesUnnamed(element); |
| 253 } | 252 } |
| 254 | 253 |
| 255 bool match(SelectorKind kind, Name memberName, CallStructure callStructure) { | 254 bool match(SelectorKind kind, Name memberName, CallStructure callStructure) { |
| 256 return this.kind == kind && | 255 return this.kind == kind && |
| 257 this.memberName == memberName && | 256 this.memberName == memberName && |
| 258 this.callStructure.match(callStructure); | 257 this.callStructure.match(callStructure); |
| 259 } | 258 } |
| 260 | 259 |
| 261 static int computeHashCode( | 260 static int computeHashCode( |
| 262 SelectorKind kind, Name name, CallStructure callStructure) { | 261 SelectorKind kind, Name name, CallStructure callStructure) { |
| 263 // Add bits from name and kind. | 262 // Add bits from name and kind. |
| 264 int hash = Hashing.mixHashCodeBits(name.hashCode, kind.hashCode); | 263 int hash = Hashing.mixHashCodeBits(name.hashCode, kind.hashCode); |
| 265 // Add bits from the call structure. | 264 // Add bits from the call structure. |
| 266 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); | 265 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); |
| 267 } | 266 } |
| 268 | 267 |
| 269 String toString() { | 268 String toString() { |
| 270 return 'Selector($kind, $name, ${callStructure.structureToString()})'; | 269 return 'Selector($kind, $name, ${callStructure.structureToString()})'; |
| 271 } | 270 } |
| 272 | 271 |
| 273 Selector toCallSelector() => new Selector.callClosureFrom(this); | 272 Selector toCallSelector() => new Selector.callClosureFrom(this); |
| 274 } | 273 } |
| OLD | NEW |