| 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 /// Mixins that implement convenience methods on [Element] subclasses. | 5 /// Mixins that implement convenience methods on [Element] subclasses. |
| 6 | 6 |
| 7 library elements.common; | 7 library elements.common; |
| 8 | 8 |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Names, | 10 Names, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 @override | 117 @override |
| 118 Element get patch { | 118 Element get patch { |
| 119 throw new UnsupportedError('patch is not supported on $this'); | 119 throw new UnsupportedError('patch is not supported on $this'); |
| 120 } | 120 } |
| 121 | 121 |
| 122 @override | 122 @override |
| 123 Element get origin { | 123 Element get origin { |
| 124 throw new UnsupportedError('origin is not supported on $this'); | 124 throw new UnsupportedError('origin is not supported on $this'); |
| 125 } | 125 } |
| 126 | |
| 127 @override | |
| 128 ClassElement get contextClass { | |
| 129 ClassElement cls; | |
| 130 for (Element e = this; e != null; e = e.enclosingElement) { | |
| 131 if (e.isClass) { | |
| 132 // Record [e] instead of returning it directly. We need the last class | |
| 133 // in the chain since the first classes might be closure classes. | |
| 134 cls = e.declaration; | |
| 135 } | |
| 136 } | |
| 137 return cls; | |
| 138 } | |
| 139 } | 126 } |
| 140 | 127 |
| 141 abstract class LibraryElementCommon implements LibraryElement { | 128 abstract class LibraryElementCommon implements LibraryElement { |
| 142 @override | 129 @override |
| 143 bool get isDartCore => canonicalUri == Uris.dart_core; | 130 bool get isDartCore => canonicalUri == Uris.dart_core; |
| 144 | 131 |
| 145 @override | 132 @override |
| 146 bool get isPlatformLibrary => canonicalUri.scheme == 'dart'; | 133 bool get isPlatformLibrary => canonicalUri.scheme == 'dart'; |
| 147 | 134 |
| 148 @override | 135 @override |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 do { | 324 do { |
| 338 // Iterate through the members in textual order, which requires | 325 // Iterate through the members in textual order, which requires |
| 339 // to reverse the data structure [localMembers] we created. | 326 // to reverse the data structure [localMembers] we created. |
| 340 // Textual order may be important for certain operations, for | 327 // Textual order may be important for certain operations, for |
| 341 // example when emitting the initializers of fields. | 328 // example when emitting the initializers of fields. |
| 342 classElement.forEachLocalMember((e) => f(classElement, e)); | 329 classElement.forEachLocalMember((e) => f(classElement, e)); |
| 343 if (includeBackendMembers) { | 330 if (includeBackendMembers) { |
| 344 classElement.forEachBackendMember((e) => f(classElement, e)); | 331 classElement.forEachBackendMember((e) => f(classElement, e)); |
| 345 } | 332 } |
| 346 if (includeInjectedMembers) { | 333 if (includeInjectedMembers) { |
| 347 if (classElement.isPatched) { | 334 if (classElement.patch != null) { |
| 348 classElement.patch.forEachLocalMember((e) { | 335 classElement.patch.forEachLocalMember((e) { |
| 349 if (!e.isPatch) f(classElement, e); | 336 if (!e.isPatch) f(classElement, e); |
| 350 }); | 337 }); |
| 351 } | 338 } |
| 352 } | 339 } |
| 353 classElement = includeSuperAndInjectedMembers | 340 classElement = includeSuperAndInjectedMembers |
| 354 ? classElement.superclass | 341 ? classElement.superclass |
| 355 : null; | 342 : null; |
| 356 } while (classElement != null); | 343 } while (classElement != null); |
| 357 } | 344 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // this signature must not have more required parameters. Having more | 490 // this signature must not have more required parameters. Having more |
| 504 // optional parameters is not a problem, they simply are never provided | 491 // optional parameters is not a problem, they simply are never provided |
| 505 // by call sites of a call to a method with the other signature. | 492 // by call sites of a call to a method with the other signature. |
| 506 int otherTotalCount = signature.parameterCount; | 493 int otherTotalCount = signature.parameterCount; |
| 507 return requiredParameterCount <= otherTotalCount | 494 return requiredParameterCount <= otherTotalCount |
| 508 && parameterCount >= otherTotalCount; | 495 && parameterCount >= otherTotalCount; |
| 509 } | 496 } |
| 510 return true; | 497 return true; |
| 511 } | 498 } |
| 512 } | 499 } |
| OLD | NEW |