Chromium Code Reviews| Index: lib/compiler/implementation/resolver.dart |
| diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart |
| index 67f338b387a5da84c0cb49992898cd2c3f47e8eb..b4971a3a0c282b7e580e96ad44df99fc688c3be5 100644 |
| --- a/lib/compiler/implementation/resolver.dart |
| +++ b/lib/compiler/implementation/resolver.dart |
| @@ -577,12 +577,22 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
| this.enclosingElement = element, |
| inInstanceContext = element.isInstanceMember() |
| || element.isGenerativeConstructor(), |
| - this.context = element.isMember() |
| - ? new ClassScope(element.enclosingElement, element.getLibrary()) |
| - : new TopScope(element.getLibrary()), |
| this.currentClass = element.isMember() ? element.enclosingElement : null, |
| this.statementScope = new StatementScope(), |
| - super(compiler); |
| + super(compiler) { |
| + LibraryElement library = element.getLibrary(); |
|
kasperl
2012/05/03 13:25:29
How about a helper function for this while loop? I
|
| + while (element !== null) { |
| + if (element.isMember()) { |
| + this.context = new ClassScope(element.enclosingElement, library); |
| + break; |
| + } else { |
| + element = element.enclosingElement; |
| + } |
| + } |
| + if (this.context === null) { |
| + this.context = new TopScope(library); |
| + } |
| + } |
| Element lookup(Node node, SourceString name) { |
| Element result = context.lookup(name); |
| @@ -1068,8 +1078,11 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
| if (send !== null) { |
| typeName = send.selector; |
| } |
| - if (typeName.source == Types.VOID) return compiler.types.voidType.element; |
| - if (send !== null) { |
| + if (typeName.source == Types.VOID) { |
| + return compiler.types.voidType.element; |
| + } else if (typeName.source.stringValue === Keyword.FACTORY.stringValue) { |
|
kasperl
2012/05/03 13:25:29
=== on string values seems a bit fishy. Maybe chan
|
| + return compiler.dynamicClass; |
| + } else if (send !== null) { |
| Element e = context.lookup(send.receiver.asIdentifier().source); |
| if (e !== null && e.kind === ElementKind.PREFIX) { |
| // The receiver is a prefix. Lookup in the imported members. |