Chromium Code Reviews| Index: lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| index e4813c71903645dea9d6e8e612ea50e4205624be..76b5f672e1fe85603712c18f446d1a40543bfed9 100644 |
| --- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| +++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| @@ -122,11 +122,38 @@ class PlaceholderCollector extends AbstractVisitor { |
| final enclosingClass = element.getEnclosingClass(); |
| Node nameNode = node.name; |
| if (nameNode is Send) nameNode = nameNode.receiver; |
| - // For cases like class C implements I { I(); } |
| + // Skip cases like class C implements I { I(); } |
| if (nameNode.asIdentifier().token.slowToString() |
|
Anton Muhin
2012/08/21 09:06:36
as you're touching this code anyway, maybe make it
Roman
2012/08/21 09:18:41
Done.
|
| == enclosingClass.name.slowToString()) { |
| makeTypePlaceholder(nameNode, enclosingClass.type); |
| } |
| + |
| + // If we have interface constructor, make sure that we put placeholder |
| + // for its default factory implementation. |
| + // Example: |
| + // interface I { I();} |
| + // class C { I() {} } |
| + if (element.defaultImplementation !== null |
| + && element.defaultImplementation !== element) { |
| + FunctionElement implementingFactory = element.defaultImplementation; |
| + Node factoryName = implementingFactory.cachedNode.name; |
| + if (factoryName is Identifier) { |
| + // Plain interface name. Rename it unless it is the default |
| + // constructor for enclosing class. |
| + // Example: |
| + // interface I { I(); } |
| + // class C implements I { C(); } don't rename this case. |
| + if (factoryName.token |
| + != implementingFactory.getEnclosingClass().name) { |
| + makeElementPlaceholder(factoryName, enclosingClass); |
| + } |
| + } else { |
| + // I.named() inside C, rename first part. |
| + assert(factoryName is Send); |
| + makeElementPlaceholder(factoryName.asSend().receiver, enclosingClass); |
|
Anton Muhin
2012/08/21 09:06:36
it looks like you don't check here if you should r
Roman
2012/08/21 09:18:41
I don't understand your comment., what should I re
|
| + } |
| + } |
| + |
| // Process Ctor(this._field) correctly. |
| for (Node parameter in node.parameters) { |
| VariableDefinitions definitions = parameter.asVariableDefinitions(); |