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

Unified Diff: lib/compiler/implementation/js_backend/function_set.dart

Issue 10919003: Fix issue with the partial type tree and implemented interfaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix comment. Created 8 years, 4 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 | « no previous file | lib/compiler/implementation/js_backend/partial_type_tree.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/js_backend/function_set.dart
diff --git a/lib/compiler/implementation/js_backend/function_set.dart b/lib/compiler/implementation/js_backend/function_set.dart
index addb961a549ec75f4ff325935ef99a2fa7725040..c1e0a66406b41dba88d6bf74bd9fae1c9f0e2627 100644
--- a/lib/compiler/implementation/js_backend/function_set.dart
+++ b/lib/compiler/implementation/js_backend/function_set.dart
@@ -9,7 +9,7 @@ class FunctionSet extends PartialTypeTree {
FunctionSet(Compiler compiler) : super(compiler);
- FunctionSetNode newNode(ClassElement type)
+ FunctionSetNode newSpecializedNode(ClassElement type)
=> new FunctionSetNode(type);
// TODO(kasperl): Allow static members too?
@@ -39,6 +39,29 @@ class FunctionSet extends PartialTypeTree {
* Returns all elements that may be invoked with the given [selector].
*/
Set<Element> filterBySelector(Selector selector) {
+ // TODO(kasperl): For now, we use a different implementation for
+ // filtering if the tree contains interface subtypes.
+ return containsInterfaceSubtypes
+ ? filterAllBySelector(selector)
+ : filterHierarchyBySelector(selector);
+ }
+
+ Set<Element> filterAllBySelector(Selector selector) {
+ Set<Element> result = new Set<Element>();
+ if (root === null) return result;
+ root.visitRecursively((FunctionSetNode node) {
+ Element member = node.membersByName[selector.name];
+ // Since we're running through the entire tree we have to use
+ // the applies method that takes types into account.
+ if (member !== null && selector.applies(member, compiler)) {
+ result.add(member);
+ }
+ return true;
+ });
+ return result;
+ }
+
+ Set<Element> filterHierarchyBySelector(Selector selector) {
Set<Element> result = new Set<Element>();
if (root === null) return result;
visitHierarchy(selectorType(selector), (FunctionSetNode node) {
« no previous file with comments | « no previous file | lib/compiler/implementation/js_backend/partial_type_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698