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

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

Issue 2760923004: Eliminate multi-callback structure for LibraryLoader. (Closed)
Patch Set: . Created 3 years, 9 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 MetadataAnnotation annotation, ConstantValue constant); 356 MetadataAnnotation annotation, ConstantValue constant);
357 357
358 /// Checks [element] for metadata matching the [handler]. Return a non-null 358 /// Checks [element] for metadata matching the [handler]. Return a non-null
359 /// annotation marker matching metadata was found. 359 /// annotation marker matching metadata was found.
360 static T checkAnnotation<T>( 360 static T checkAnnotation<T>(
361 Compiler compiler, Element element, EagerAnnotationHandler<T> handler) { 361 Compiler compiler, Element element, EagerAnnotationHandler<T> handler) {
362 for (MetadataAnnotation annotation in element.implementation.metadata) { 362 for (MetadataAnnotation annotation in element.implementation.metadata) {
363 T result = handler.apply(compiler, element, annotation); 363 T result = handler.apply(compiler, element, annotation);
364 if (result != handler.defaultResult) { 364 if (result != handler.defaultResult) {
365 // TODO(johnniwinther): Perform this check in 365 // TODO(johnniwinther): Perform this check in
366 // [Compiler.onLibrariesLoaded]. 366 // [Compiler.processLoadedLibraries].
367 compiler.libraryLoader 367 compiler.libraryLoader
368 .registerDeferredAction(new DeferredAction(element, () { 368 .registerDeferredAction(new DeferredAction(element, () {
369 annotation.ensureResolved(compiler.resolution); 369 annotation.ensureResolved(compiler.resolution);
370 handler.validate(compiler, element, annotation, 370 handler.validate(compiler, element, annotation,
371 compiler.constants.getConstantValue(annotation.constant)); 371 compiler.constants.getConstantValue(annotation.constant));
372 })); 372 }));
373 return result; 373 return result;
374 } 374 }
375 } 375 }
376 return handler.defaultResult; 376 return handler.defaultResult;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 527
528 class PatchVersion { 528 class PatchVersion {
529 final String tag; 529 final String tag;
530 530
531 const PatchVersion(this.tag); 531 const PatchVersion(this.tag);
532 532
533 bool isActive(String patchTag) => tag == null || tag == patchTag; 533 bool isActive(String patchTag) => tag == null || tag == patchTag;
534 534
535 String toString() => 'PatchVersion($tag)'; 535 String toString() => 'PatchVersion($tag)';
536 } 536 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698