Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: pkg/compiler/lib/src/patch_parser.dart

Issue 1302333006: Support metadata on patches. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove partial renaming Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 Element element, 379 Element element,
380 MetadataAnnotation annotation, 380 MetadataAnnotation annotation,
381 ConstantValue constant); 381 ConstantValue constant);
382 382
383 383
384 /// Checks [element] for metadata matching the [handler]. Return a non-null 384 /// Checks [element] for metadata matching the [handler]. Return a non-null
385 /// annotation marker matching metadata was found. 385 /// annotation marker matching metadata was found.
386 static checkAnnotation(Compiler compiler, 386 static checkAnnotation(Compiler compiler,
387 Element element, 387 Element element,
388 EagerAnnotationHandler handler) { 388 EagerAnnotationHandler handler) {
389 for (Link<MetadataAnnotation> link = element.metadata; 389 for (MetadataAnnotation annotation in element.implementation.metadata) {
390 !link.isEmpty;
391 link = link.tail) {
392 MetadataAnnotation annotation = link.head;
393 var result = handler.apply(compiler, element, annotation); 390 var result = handler.apply(compiler, element, annotation);
394 if (result != null) { 391 if (result != null) {
395 // TODO(johnniwinther): Perform this check in 392 // TODO(johnniwinther): Perform this check in
396 // [Compiler.onLibrariesLoaded]. 393 // [Compiler.onLibrariesLoaded].
397 compiler.enqueuer.resolution.addDeferredAction(element, () { 394 compiler.enqueuer.resolution.addDeferredAction(element, () {
398 annotation.ensureResolved(compiler); 395 annotation.ensureResolved(compiler);
399 handler.validate( 396 handler.validate(
400 compiler, element, annotation, 397 compiler, element, annotation,
401 compiler.constants.getConstantValue(annotation.constant)); 398 compiler.constants.getConstantValue(annotation.constant));
402 }); 399 });
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 588
592 class PatchVersion { 589 class PatchVersion {
593 final String tag; 590 final String tag;
594 591
595 const PatchVersion(this.tag); 592 const PatchVersion(this.tag);
596 593
597 bool isActive(String patchTag) => tag == null || tag == patchTag; 594 bool isActive(String patchTag) => tag == null || tag == patchTag;
598 595
599 String toString() => 'PatchVersion($tag)'; 596 String toString() => 'PatchVersion($tag)';
600 } 597 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698