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

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

Issue 2735763002: Create ResolutionEnqueuer after library loading. (Closed)
Patch Set: Updated cf. comments. 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 import 'elements/resolution_types.dart' show ResolutionDartType; 127 import 'elements/resolution_types.dart' show ResolutionDartType;
128 import 'elements/elements.dart'; 128 import 'elements/elements.dart';
129 import 'elements/modelx.dart' 129 import 'elements/modelx.dart'
130 show 130 show
131 BaseFunctionElementX, 131 BaseFunctionElementX,
132 ClassElementX, 132 ClassElementX,
133 GetterElementX, 133 GetterElementX,
134 LibraryElementX, 134 LibraryElementX,
135 MetadataAnnotationX, 135 MetadataAnnotationX,
136 SetterElementX; 136 SetterElementX;
137 import 'enqueue.dart' show DeferredAction;
137 import 'id_generator.dart'; 138 import 'id_generator.dart';
138 import 'library_loader.dart' show LibraryLoader; 139 import 'library_loader.dart' show LibraryLoader;
139 import 'parser/element_listener.dart' show ElementListener; 140 import 'parser/element_listener.dart' show ElementListener;
140 import 'parser/member_listener.dart' show MemberListener; 141 import 'parser/member_listener.dart' show MemberListener;
141 import 'parser/partial_elements.dart' 142 import 'parser/partial_elements.dart'
142 show ClassElementParser, PartialClassElement; 143 show ClassElementParser, PartialClassElement;
143 import 'parser/diet_parser_task.dart' show PartialParser; 144 import 'parser/diet_parser_task.dart' show PartialParser;
144 import 'script.dart'; 145 import 'script.dart';
145 146
146 class PatchParserTask extends CompilerTask { 147 class PatchParserTask extends CompilerTask {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 357
357 /// Checks [element] for metadata matching the [handler]. Return a non-null 358 /// Checks [element] for metadata matching the [handler]. Return a non-null
358 /// annotation marker matching metadata was found. 359 /// annotation marker matching metadata was found.
359 static T checkAnnotation<T>( 360 static T checkAnnotation<T>(
360 Compiler compiler, Element element, EagerAnnotationHandler<T> handler) { 361 Compiler compiler, Element element, EagerAnnotationHandler<T> handler) {
361 for (MetadataAnnotation annotation in element.implementation.metadata) { 362 for (MetadataAnnotation annotation in element.implementation.metadata) {
362 T result = handler.apply(compiler, element, annotation); 363 T result = handler.apply(compiler, element, annotation);
363 if (result != handler.defaultResult) { 364 if (result != handler.defaultResult) {
364 // TODO(johnniwinther): Perform this check in 365 // TODO(johnniwinther): Perform this check in
365 // [Compiler.onLibrariesLoaded]. 366 // [Compiler.onLibrariesLoaded].
366 compiler.enqueuer.resolution.addDeferredAction(element, () { 367 compiler.libraryLoader
368 .registerDeferredAction(new DeferredAction(element, () {
367 annotation.ensureResolved(compiler.resolution); 369 annotation.ensureResolved(compiler.resolution);
368 handler.validate(compiler, element, annotation, 370 handler.validate(compiler, element, annotation,
369 compiler.constants.getConstantValue(annotation.constant)); 371 compiler.constants.getConstantValue(annotation.constant));
370 }); 372 }));
371 return result; 373 return result;
372 } 374 }
373 } 375 }
374 return handler.defaultResult; 376 return handler.defaultResult;
375 } 377 }
376 378
377 /// Result that signals the absence of annotations. 379 /// Result that signals the absence of annotations.
378 T get defaultResult => null; 380 T get defaultResult => null;
379 } 381 }
380 382
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 527
526 class PatchVersion { 528 class PatchVersion {
527 final String tag; 529 final String tag;
528 530
529 const PatchVersion(this.tag); 531 const PatchVersion(this.tag);
530 532
531 bool isActive(String patchTag) => tag == null || tag == patchTag; 533 bool isActive(String patchTag) => tag == null || tag == patchTag;
532 534
533 String toString() => 'PatchVersion($tag)'; 535 String toString() => 'PatchVersion($tag)';
534 } 536 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/resolution/resolution_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698