| 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 | 8 import '../common/names.dart' show |
| 9 Names; | 9 Names; |
| 10 import '../elements/elements.dart' show | 10 import '../elements/elements.dart' show |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 List<String> get namedArguments => callStructure.namedArguments; | 55 List<String> get namedArguments => callStructure.namedArguments; |
| 56 | 56 |
| 57 String get name => memberName.text; | 57 String get name => memberName.text; |
| 58 | 58 |
| 59 LibraryElement get library => memberName.library; | 59 LibraryElement get library => memberName.library; |
| 60 | 60 |
| 61 Selector.internal(this.kind, | 61 Selector.internal(this.kind, |
| 62 this.memberName, | 62 this.memberName, |
| 63 this.callStructure, | 63 this.callStructure, |
| 64 this.hashCode) { | 64 this.hashCode) { |
| 65 assert(kind == SelectorKind.INDEX || | 65 assert(invariant(NO_LOCATION_SPANNABLE, |
| 66 (memberName != Names.INDEX_NAME && | 66 kind == SelectorKind.INDEX || |
| 67 memberName != Names.INDEX_SET_NAME)); | 67 (memberName != Names.INDEX_NAME && |
| 68 assert(kind == SelectorKind.OPERATOR || | 68 memberName != Names.INDEX_SET_NAME), |
| 69 kind == SelectorKind.INDEX || | 69 message: "kind=$kind,memberName=$memberName," |
| 70 !Elements.isOperatorName(memberName.text) || | 70 "callStructure:$callStructure")); |
| 71 identical(memberName.text, '??')); | 71 assert(invariant(NO_LOCATION_SPANNABLE, |
| 72 assert(kind == SelectorKind.CALL || | 72 kind == SelectorKind.OPERATOR || |
| 73 kind == SelectorKind.GETTER || | 73 kind == SelectorKind.INDEX || |
| 74 kind == SelectorKind.SETTER || | 74 !Elements.isOperatorName(memberName.text) || |
| 75 Elements.isOperatorName(memberName.text) || | 75 memberName.text == '??', |
| 76 identical(memberName.text, '??')); | 76 message: "kind=$kind,memberName=$memberName," |
| 77 "callStructure:$callStructure")); |
| 78 assert(invariant(NO_LOCATION_SPANNABLE, |
| 79 kind == SelectorKind.CALL || |
| 80 kind == SelectorKind.GETTER || |
| 81 kind == SelectorKind.SETTER || |
| 82 Elements.isOperatorName(memberName.text) || |
| 83 memberName.text == '??', |
| 84 message: "kind=$kind,memberName=$memberName," |
| 85 "callStructure:$callStructure")); |
| 77 } | 86 } |
| 78 | 87 |
| 79 // TODO(johnniwinther): Extract caching. | 88 // TODO(johnniwinther): Extract caching. |
| 80 static Map<int, List<Selector>> canonicalizedValues = | 89 static Map<int, List<Selector>> canonicalizedValues = |
| 81 new Map<int, List<Selector>>(); | 90 new Map<int, List<Selector>>(); |
| 82 | 91 |
| 83 factory Selector(SelectorKind kind, | 92 factory Selector(SelectorKind kind, |
| 84 Name name, | 93 Name name, |
| 85 CallStructure callStructure) { | 94 CallStructure callStructure) { |
| 86 // TODO(johnniwinther): Maybe use equality instead of implicit hashing. | 95 // TODO(johnniwinther): Maybe use equality instead of implicit hashing. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // Add bits from the call structure. | 287 // Add bits from the call structure. |
| 279 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); | 288 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); |
| 280 } | 289 } |
| 281 | 290 |
| 282 String toString() { | 291 String toString() { |
| 283 return 'Selector($kind, $name, ${callStructure.structureToString()})'; | 292 return 'Selector($kind, $name, ${callStructure.structureToString()})'; |
| 284 } | 293 } |
| 285 | 294 |
| 286 Selector toCallSelector() => new Selector.callClosureFrom(this); | 295 Selector toCallSelector() => new Selector.callClosureFrom(this); |
| 287 } | 296 } |
| OLD | NEW |