Chromium Code Reviews| Index: lib/compiler/implementation/elements/elements.dart |
| diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart |
| index 3dfee4956fba2b2051c86d758a4487239b3ca02a..d8c42ba4a8eb5a60cf548c0b52824d0e93bbf0cc 100644 |
| --- a/lib/compiler/implementation/elements/elements.dart |
| +++ b/lib/compiler/implementation/elements/elements.dart |
| @@ -1403,24 +1403,43 @@ abstract class ClassElement extends ScopeContainerElement |
| } |
| } |
| - Element lookupConstructor(SourceString className, |
| - [SourceString constructorName = |
| - const SourceString(''), |
| - Element noMatch(Element)]) { |
| + Element validateConstructorLookupResults(Selector selector, |
| + Element result, |
| + Element noMatch(Element)) { |
| + if (result === null |
| + || !result.isConstructor() |
| + || (selector.name.isPrivate() |
| + && result.getLibrary() != selector.library)) { |
| + result = noMatch !== null ? noMatch(result) : null; |
| + } |
| + return result; |
| + } |
| + |
| + Element lookupConstructor(Selector selector, [Element noMatch(Element)]) { |
| // TODO(karlklose): have a map from class names to a map of constructors |
| // instead of creating the name here? |
| SourceString normalizedName; |
| - if (constructorName !== const SourceString('')) { |
| + SourceString className = this.name; |
| + SourceString constructorName = selector.name; |
| + if (constructorName !== const SourceString('') && |
| + ((className === null) || |
| + (constructorName.slowToString() != className.slowToString()))) { |
|
kasperl
2012/10/09 13:56:02
Shouldn't this be indented with an extra space?
aam-me
2012/10/10 00:22:40
Done.
|
| normalizedName = Elements.constructConstructorName(className, |
| constructorName); |
| } else { |
| normalizedName = className; |
| } |
| Element result = localLookup(normalizedName); |
| - if (result === null || !result.isConstructor()) { |
| - result = noMatch !== null ? noMatch(result) : null; |
| - } |
| - return result; |
| + return validateConstructorLookupResults(selector, result, noMatch); |
| + } |
| + |
| + Element lookupFactoryConstructor(Selector selector, |
| + [Element noMatch(Element)]) { |
| + // TODO(karlklose): have a map from class names to a map of constructors |
| + // instead of creating the name here? |
| + SourceString constructorName = selector.name; |
| + Element result = localLookup(constructorName); |
| + return validateConstructorLookupResults(selector, result, noMatch); |
| } |
| bool get hasConstructor { |