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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 340783011: Take inheritance into account when computing the elements accessible by mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased + fixes Created 6 years, 5 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 | Annotate | Revision Log
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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 /// constants. 214 /// constants.
215 BackendConstantEnvironment get constants; 215 BackendConstantEnvironment get constants;
216 216
217 /// The compiler task responsible for the compilation of constants for both 217 /// The compiler task responsible for the compilation of constants for both
218 /// the frontend and the backend. 218 /// the frontend and the backend.
219 ConstantCompilerTask get constantCompilerTask; 219 ConstantCompilerTask get constantCompilerTask;
220 220
221 /// Backend callback methods for the resolution phase. 221 /// Backend callback methods for the resolution phase.
222 ResolutionCallbacks get resolutionCallbacks; 222 ResolutionCallbacks get resolutionCallbacks;
223 223
224 /// Set of classes that need to be considered for reflection although not
225 /// otherwise visible during resolution.
226 Iterable<ClassElement> classesRequiredForReflection = const [];
227
224 // Given a [FunctionElement], return a buffer with the code generated for it 228 // Given a [FunctionElement], return a buffer with the code generated for it
225 // or null if no code was generated. 229 // or null if no code was generated.
226 CodeBuffer codeOf(Element element) => null; 230 CodeBuffer codeOf(Element element) => null;
227 231
228 void initializeHelperClasses() {} 232 void initializeHelperClasses() {}
229 233
230 void enqueueHelpers(ResolutionEnqueuer world, Registry registry); 234 void enqueueHelpers(ResolutionEnqueuer world, Registry registry);
231 void codegen(CodegenWorkItem work); 235 void codegen(CodegenWorkItem work);
232 236
233 // The backend determines the native resolution enqueuer, with a no-op 237 // The backend determines the native resolution enqueuer, with a no-op
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return new Future.value(); 399 return new Future.value();
396 } 400 }
397 401
398 /// Called by [MirrorUsageAnalyzerTask] after it has merged all @MirrorsUsed 402 /// Called by [MirrorUsageAnalyzerTask] after it has merged all @MirrorsUsed
399 /// annotations. The arguments corresponds to the unions of the corresponding 403 /// annotations. The arguments corresponds to the unions of the corresponding
400 /// fields of the annotations. 404 /// fields of the annotations.
401 void registerMirrorUsage(Set<String> symbols, 405 void registerMirrorUsage(Set<String> symbols,
402 Set<Element> targets, 406 Set<Element> targets,
403 Set<Element> metaTargets) {} 407 Set<Element> metaTargets) {}
404 408
405 /// Returns true if this element should be retained for reflection even if it 409 /// Returns true if this element needs reflection information at runtime.
406 /// would normally be tree-shaken away. 410 bool isAccessibleByReflection(Element element) => true;
407 bool isNeededForReflection(Element element) => false; 411
412 /// Returns true if this element is covered by a mirrorsUsed annotation.
413 ///
414 /// Note that it might still be ok to tree shake the element away if no
415 /// reflection is used in the program (and thus [isTreeShakingDisabled] is
416 /// still false). Therefore _do not_ use this predicate to decide inclusion
417 /// in the tree, use [requiredByMirrorSystem] instead.
418 bool referencedFromMirrorSystem(Element element, [recursive]) => false;
419
420 /// Returns true if this element has to be enqueued due to
421 /// mirror usage. Might be a subset of [referencedFromMirrorSystem] if
422 /// normal tree shaking is still active ([isTreeShakingDisabled] is false).
423 bool requiredByMirrorSystem(Element element) => false;
408 424
409 /// Returns true if global optimizations such as type inferencing 425 /// Returns true if global optimizations such as type inferencing
410 /// can apply to this element. One category of elements that do not 426 /// can apply to this element. One category of elements that do not
411 /// apply is runtime helpers that the backend calls, but the 427 /// apply is runtime helpers that the backend calls, but the
412 /// optimizations don't see those calls. 428 /// optimizations don't see those calls.
413 bool canBeUsedForGlobalOptimizations(Element element) => true; 429 bool canBeUsedForGlobalOptimizations(Element element) => true;
414 430
415 /// Called when [enqueuer]'s queue is empty, but before it is closed. 431 /// Called when [enqueuer]'s queue is empty, but before it is closed.
416 /// This is used, for example, by the JS backend to enqueue additional 432 /// This is used, for example, by the JS backend to enqueue additional
417 /// elements needed for reflection. 433 /// elements needed for reflection. [recentClasses] is a collection of
418 void onQueueEmpty(Enqueuer enqueuer) {} 434 /// all classes seen for the first time by the [enqueuer] since the last call
435 /// to [onQueueEmpty].
436 ///
437 /// A return value of [:true:] indicates that [recentClasses] has been
438 /// processed and its elements do not need to be seen in the next round. When
439 /// [:false:] is returned, [onQueueEmpty] will be called again once the
440 /// resolution queue has drained and [recentClasses] will be a superset of the
441 /// current value.
442 ///
443 /// There is no guarantee that a class is only present once in
444 /// [recentClasses], but every class seen by the [enqueuer] will be present in
445 /// [recentClasses] at least once.
446 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) {
447 return true;
448 }
419 449
420 /// Called after [element] has been resolved. 450 /// Called after [element] has been resolved.
421 // TODO(johnniwinther): Change [TreeElements] to [Registry] or a dependency 451 // TODO(johnniwinther): Change [TreeElements] to [Registry] or a dependency
422 // node. [elements] is currently unused by the implementation. 452 // node. [elements] is currently unused by the implementation.
423 void onElementResolved(Element element, TreeElements elements) {} 453 void onElementResolved(Element element, TreeElements elements) {}
424 454
425 // Does this element belong in the output 455 // Does this element belong in the output
426 bool shouldOutput(Element element) => true; 456 bool shouldOutput(Element element) => true;
427 } 457 }
428 458
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 static NullSink outputProvider(String name, String extension) { 2015 static NullSink outputProvider(String name, String extension) {
1986 return new NullSink('$name.$extension'); 2016 return new NullSink('$name.$extension');
1987 } 2017 }
1988 } 2018 }
1989 2019
1990 /// Information about suppressed warnings and hints for a given library. 2020 /// Information about suppressed warnings and hints for a given library.
1991 class SuppressionInfo { 2021 class SuppressionInfo {
1992 int warnings = 0; 2022 int warnings = 0;
1993 int hints = 0; 2023 int hints = 0;
1994 } 2024 }
OLDNEW
« no previous file with comments | « pkg/dart2js_incremental/lib/caching_compiler.dart ('k') | sdk/lib/_internal/compiler/implementation/deferred_load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698