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

Unified 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: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index d221a0b0410c2b2d1eb074f208665e4b26db86dd..131eb2c542c77a0b29851c826ef2d0078158d6b8 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -430,9 +430,14 @@ abstract class Backend {
Set<Element> targets,
Set<Element> metaTargets) {}
- /// Returns true if this element should be retained for reflection even if it
- /// would normally be tree-shaken away.
- bool isNeededForReflection(Element element) => false;
+ /// Returns true if this element needs reflection information at runtime.
+ bool isAccessibleByReflection(Element element) => true;
+ /// Returns true if this element is covered by a mirrorsUsed annotation but
Johnni Winther 2014/06/27 07:43:00 Add an empty line before doc comments.
herhut 2014/06/27 12:34:35 Done.
+ /// is ok to be treeshaken away.
Johnni Winther 2014/06/27 07:43:00 Add an example of how this is sound.
floitsch 2014/06/27 08:59:15 but might be ok to be treeshaken away.
herhut 2014/06/27 12:34:35 Done.
herhut 2014/06/27 12:34:35 Done.
+ bool referencedFromMirrorSystem(Element element, [recursive]) => false;
+ /// Returns true if this element has to be enqueued due to
+ /// mirror usage. Might be a subset of the above.
+ bool requiredByMirrorSystem(Element element) => false;
Johnni Winther 2014/06/27 07:43:00 Give an example.
herhut 2014/06/27 12:34:35 Done.
/// Returns true if global optimizations such as type inferencing
/// can apply to this element. One category of elements that do not
@@ -442,8 +447,13 @@ abstract class Backend {
/// Called when [enqueuer]'s queue is empty, but before it is closed.
/// This is used, for example, by the JS backend to enqueue additional
- /// elements needed for reflection.
- void onQueueEmpty(Enqueuer enqueuer) {}
+ /// elements needed for reflection. [recentClasses] is a collection of
+ /// all classes added since the last call to onQueueEmpty. A return value
Johnni Winther 2014/06/27 07:43:00 'added' -> 'added to the set of instantiation clas
herhut 2014/06/27 12:34:35 seen for the first time by the enqueuer....
+ /// of [true] indicates that recentClasses has been processed and its
+ /// elements do not need to be seen in the next round. When [false] is
+ /// returned, [onQueueEmpty] will be called again and [recentClasses]
+ /// will be a superset of the current value.
Johnni Winther 2014/06/27 07:43:00 When is this needed?
herhut 2014/06/27 12:34:35 This allows each step in onQueueEmpty to abort pro
+ bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) {}
floitsch 2014/06/27 08:59:15 I don't like the name "onX" is something that allo
karlklose 2014/06/27 09:35:28 For me onX is something that allows me to do somet
floitsch 2014/06/27 12:05:38 That's not how it is used in most libraries. For e
herhut 2014/06/27 12:34:35 This needs a more global fix, so not in this CL...
Johnni Winther 2014/06/27 14:22:30 The `domElement.onClick` is a short-hand for getti
/// Called after [element] has been resolved.
// TODO(johnniwinther): Change [TreeElements] to [Registry] or a dependency

Powered by Google App Engine
This is Rietveld 408576698