Index: dart/lib/compiler/implementation/resolver.dart |
diff --git a/dart/lib/compiler/implementation/resolver.dart b/dart/lib/compiler/implementation/resolver.dart |
index 3be55cfe742a5e19e8b5fda3e9aa4fca53533f01..51111cf07df9b37a56d72d898ec23bafd9372c89 100644 |
--- a/dart/lib/compiler/implementation/resolver.dart |
+++ b/dart/lib/compiler/implementation/resolver.dart |
@@ -123,6 +123,8 @@ class ResolverTask extends CompilerTask { |
FunctionExpression tree = element.parseNode(compiler); |
if (isConstructor) { |
resolveConstructorImplementation(element, tree); |
+ compiler.enqueuer.resolution.registerStaticUse( |
+ element.defaultImplementation); |
} |
ResolverVisitor visitor = new ResolverVisitor(compiler, element); |
visitor.useElement(tree, element); |
@@ -803,6 +805,18 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
Element useElement(Node node, Element element) { |
if (element === null) return null; |
+ ElementKind kind = element.kind; |
+ if (element.isTopLevel() || element.isMember()) { |
+ int allowed = ElementCategory.VARIABLE | ElementCategory.FUNCTION |
+ | ElementCategory.FACTORY; |
+ if ((element.kind.category & allowed) != 0 || element.isAccessor()) { |
+ if (element.isInstanceMember()) { |
+ compiler.enqueuer.resolution.registerDynamicInvocationOf(element); |
+ } else { |
+ compiler.enqueuer.resolution.registerStaticUse(element); |
+ } |
+ } |
+ } |
return mapping[node] = element; |
} |
@@ -1064,6 +1078,26 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
// TODO(ngeoffray): Warn if target is null and the send is |
// unqualified. |
useElement(node, target); |
+ if (target === null || target.isMember()) { |
+ Identifier id = node.selector.asIdentifier(); |
+ if (id !== null) { |
+ compiler.enqueuer.resolution.registerDynamicInvocation( |
+ id.source, |
+ mapping.getSelector(node)); |
+ } |
+ // target = new Interceptors(compiler).getStaticInterceptor( |
+ // node.selector.asIdentifier().source, |
+ // node.argumentCount()); |
+ } |
+ if (target !== null && |
+ target.kind !== ElementKind.VARIABLE && |
+ target.kind !== ElementKind.CLASS) { |
+ if (target.isInstanceMember()) { |
+ compiler.enqueuer.resolution.registerDynamicInvocationOf(target); |
+ } else { |
+ compiler.enqueuer.resolution.registerStaticUse(target); |
+ } |
+ } |
if (node.isPropertyAccess) return target; |
} |
@@ -1168,6 +1202,7 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
// parameters. We cannot do this rigth now because of the |
// List constructor. |
} |
+ compiler.enqueuer.resolution.registerStaticUse(constructor); |
useElement(node.send, constructor); |
return null; |
} |
@@ -1232,6 +1267,8 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
} |
visitStringInterpolation(StringInterpolation node) { |
+ compiler.enqueuer.resolution.registerStaticUse(compiler.findHelper( |
+ const SourceString("S"))); |
node.visitChildren(this); |
} |