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..f376ec760e78f85657ed03f44d21355b586719d0 100644 |
| --- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| +++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart |
| @@ -127,6 +127,33 @@ class PlaceholderCollector extends AbstractVisitor { |
| == 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();} |
|
Anton Muhin
2012/08/21 09:06:35
interface I default C ?
Roman
2012/08/21 09:18:40
Done.
|
| + // class C { I() {} } |
| + if (element.defaultImplementation !== null |
| + && element.defaultImplementation !== element) { |
|
Anton Muhin
2012/08/21 09:06:35
what this check does?
Roman
2012/08/21 09:18:40
Here we are processing interface constructor:
inte
|
| + 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(); } |
|
Anton Muhin
2012/08/21 09:06:35
again, I default C?
Roman
2012/08/21 09:18:40
Actually, here not necessary default.
|
| + // class C implements I { C(); } don't rename this case. |
| + if (factoryName.token.slowToString() |
|
Anton Muhin
2012/08/20 18:43:34
SourceString's are comparable
Anton Muhin
2012/08/20 18:43:34
why do you need a check here? maybe just drop if
Roman
2012/08/21 08:31:20
The comment above is actually incorrect, that if i
Roman
2012/08/21 08:31:20
Done.
|
| + != implementingFactory.getEnclosingClass().name.slowToString()) { |
|
Anton Muhin
2012/08/21 09:06:35
it might be more straightforward to compare for eq
Roman
2012/08/21 09:18:40
I changed that to factoryName.token == implementin
|
| + makeElementPlaceholder(factoryName, enclosingClass); |
| + } |
| + } else { |
| + // I.named() inside C, rename first part. |
| + assert(factoryName is Send); |
| + makeElementPlaceholder((factoryName as Send).receiver, enclosingClass); |
|
Anton Muhin
2012/08/20 18:43:34
nit: factoryName.asSend()
Anton Muhin
2012/08/20 18:43:34
nit: line too long
Roman
2012/08/21 08:31:20
Done.
Roman
2012/08/21 08:31:20
Done.
|
| + } |
| + } |
| + |
| // Process Ctor(this._field) correctly. |
| for (Node parameter in node.parameters) { |
| VariableDefinitions definitions = parameter.asVariableDefinitions(); |