| 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 } |
| 126 } | 139 } |
| 127 | 140 |
| 128 abstract class LibraryElementCommon implements LibraryElement { | 141 abstract class LibraryElementCommon implements LibraryElement { |
| 129 @override | 142 @override |
| 130 bool get isDartCore => canonicalUri == Uris.dart_core; | 143 bool get isDartCore => canonicalUri == Uris.dart_core; |
| 131 | 144 |
| 132 @override | 145 @override |
| 133 bool get isPlatformLibrary => canonicalUri.scheme == 'dart'; | 146 bool get isPlatformLibrary => canonicalUri.scheme == 'dart'; |
| 134 | 147 |
| 135 @override | 148 @override |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 do { | 337 do { |
| 325 // Iterate through the members in textual order, which requires | 338 // Iterate through the members in textual order, which requires |
| 326 // to reverse the data structure [localMembers] we created. | 339 // to reverse the data structure [localMembers] we created. |
| 327 // Textual order may be important for certain operations, for | 340 // Textual order may be important for certain operations, for |
| 328 // example when emitting the initializers of fields. | 341 // example when emitting the initializers of fields. |
| 329 classElement.forEachLocalMember((e) => f(classElement, e)); | 342 classElement.forEachLocalMember((e) => f(classElement, e)); |
| 330 if (includeBackendMembers) { | 343 if (includeBackendMembers) { |
| 331 classElement.forEachBackendMember((e) => f(classElement, e)); | 344 classElement.forEachBackendMember((e) => f(classElement, e)); |
| 332 } | 345 } |
| 333 if (includeInjectedMembers) { | 346 if (includeInjectedMembers) { |
| 334 if (classElement.patch != null) { | 347 if (classElement.isPatched) { |
| 335 classElement.patch.forEachLocalMember((e) { | 348 classElement.patch.forEachLocalMember((e) { |
| 336 if (!e.isPatch) f(classElement, e); | 349 if (!e.isPatch) f(classElement, e); |
| 337 }); | 350 }); |
| 338 } | 351 } |
| 339 } | 352 } |
| 340 classElement = includeSuperAndInjectedMembers | 353 classElement = includeSuperAndInjectedMembers |
| 341 ? classElement.superclass | 354 ? classElement.superclass |
| 342 : null; | 355 : null; |
| 343 } while (classElement != null); | 356 } while (classElement != null); |
| 344 } | 357 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 // this signature must not have more required parameters. Having more | 503 // this signature must not have more required parameters. Having more |
| 491 // optional parameters is not a problem, they simply are never provided | 504 // optional parameters is not a problem, they simply are never provided |
| 492 // by call sites of a call to a method with the other signature. | 505 // by call sites of a call to a method with the other signature. |
| 493 int otherTotalCount = signature.parameterCount; | 506 int otherTotalCount = signature.parameterCount; |
| 494 return requiredParameterCount <= otherTotalCount | 507 return requiredParameterCount <= otherTotalCount |
| 495 && parameterCount >= otherTotalCount; | 508 && parameterCount >= otherTotalCount; |
| 496 } | 509 } |
| 497 return true; | 510 return true; |
| 498 } | 511 } |
| 499 } | 512 } |
| OLD | NEW |