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

Unified Diff: lib/compiler/implementation/world.dart

Issue 10911181: Collect getters in a FunctionSet while resolving. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/universe/function_set.dart ('k') | pkg/dartdoc/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/world.dart
===================================================================
--- lib/compiler/implementation/world.dart (revision 12169)
+++ lib/compiler/implementation/world.dart (working copy)
@@ -3,12 +3,16 @@
// BSD-style license that can be found in the LICENSE file.
class World {
- Compiler compiler; // Set in populate().
+ final Compiler compiler;
final Map<ClassElement, Set<ClassElement>> subtypes;
+ final FunctionSet userDefinedGetters;
- World() : subtypes = new Map<ClassElement, Set<ClassElement>>();
+ World(Compiler compiler)
+ : subtypes = new Map<ClassElement, Set<ClassElement>>(),
+ userDefinedGetters = new FunctionSet(compiler),
+ this.compiler = compiler;
- void populate(Compiler compiler) {
+ void populate() {
void addSubtypes(ClassElement cls) {
if (cls.resolutionState != STATE_DONE) {
compiler.internalErrorOnElement(
@@ -22,12 +26,25 @@
}
compiler.resolverWorld.instantiatedClasses.forEach(addSubtypes);
+ }
- // Mark the world as populated.
- assert(compiler !== null);
- this.compiler = compiler;
+ void recordUserDefinedGetter(Element element) {
+ assert(element.isGetter());
+ userDefinedGetters.add(element);
}
+ bool hasAnyUserDefinedGetter(Selector selector) {
+ return userDefinedGetters.hasAnyElementMatchingSelector(selector);
+ }
+
+ void registerUsedElement(Element element) {
+ if (element.isMember() && element.isGetter()) {
+ // We're collecting user-defined getters to let the codegen know which
+ // field accesses might have side effects.
+ userDefinedGetters.add(element);
+ }
+ }
+
/**
* Returns a [MemberSet] that contains the possible targets of the given
* [selector] on a receiver with the given [type]. This includes all sub
« no previous file with comments | « lib/compiler/implementation/universe/function_set.dart ('k') | pkg/dartdoc/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698