| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * This library contains the infrastructure to parse and integrate patch files. | 6 * This library contains the infrastructure to parse and integrate patch files. |
| 7 * | 7 * |
| 8 * Three types of elements can be patched: [LibraryElement], [ClassElement], | 8 * Three types of elements can be patched: [LibraryElement], [ClassElement], |
| 9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded | 9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded |
| 10 * together with the corresponding origin library. Which libraries that are | 10 * together with the corresponding origin library. Which libraries that are |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 super.addMember(element); | 378 super.addMember(element); |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 | 381 |
| 382 // TODO(ahe): Get rid of this class. | 382 // TODO(ahe): Get rid of this class. |
| 383 class PatchMetadataAnnotation extends MetadataAnnotationX { | 383 class PatchMetadataAnnotation extends MetadataAnnotationX { |
| 384 final leg.Constant value = null; | 384 final leg.Constant value = null; |
| 385 | 385 |
| 386 PatchMetadataAnnotation() : super(STATE_DONE); | 386 PatchMetadataAnnotation() : super(STATE_DONE); |
| 387 | 387 |
| 388 tree.Node parseNode(leg.DiagnosticListener listener) => null; |
| 389 |
| 388 Token get beginToken => null; | 390 Token get beginToken => null; |
| 389 Token get endToken => null; | 391 Token get endToken => null; |
| 390 } | 392 } |
| 391 | 393 |
| 392 void patchElement(leg.DiagnosticListener listener, | 394 void patchElement(leg.DiagnosticListener listener, |
| 393 Element origin, | 395 Element origin, |
| 394 Element patch) { | 396 Element patch) { |
| 395 if (origin == null) { | 397 if (origin == null) { |
| 396 listener.reportError( | 398 listener.reportError( |
| 397 patch, leg.MessageKind.PATCH_NON_EXISTING, {'name': patch.name}); | 399 patch, leg.MessageKind.PATCH_NON_EXISTING, {'name': patch.name}); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 551 |
| 550 // TODO(johnniwinther): Add unittest when patch is (real) metadata. | 552 // TODO(johnniwinther): Add unittest when patch is (real) metadata. |
| 551 bool isPatchElement(Element element) { | 553 bool isPatchElement(Element element) { |
| 552 // TODO(lrn): More checks needed if we introduce metadata for real. | 554 // TODO(lrn): More checks needed if we introduce metadata for real. |
| 553 // In that case, it must have the identifier "native" as metadata. | 555 // In that case, it must have the identifier "native" as metadata. |
| 554 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { | 556 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { |
| 555 if (link.head is PatchMetadataAnnotation) return true; | 557 if (link.head is PatchMetadataAnnotation) return true; |
| 556 } | 558 } |
| 557 return false; | 559 return false; |
| 558 } | 560 } |
| OLD | NEW |