| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class TreeElements { | 5 class TreeElements { |
| 6 Map<Node, Element> map; | 6 Map<Node, Element> map; |
| 7 TreeElements() : map = new LinkedHashMap<Node, Element>(); | 7 TreeElements() : map = new LinkedHashMap<Node, Element>(); |
| 8 operator []=(Node node, Element element) => map[node] = element; | 8 operator []=(Node node, Element element) => map[node] = element; |
| 9 operator [](Node node) => map[node]; | 9 operator [](Node node) => map[node]; |
| 10 } | 10 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 final Compiler compiler; | 113 final Compiler compiler; |
| 114 final TreeElements mapping; | 114 final TreeElements mapping; |
| 115 final Element enclosingElement; | 115 final Element enclosingElement; |
| 116 bool inInstanceContext; | 116 bool inInstanceContext; |
| 117 Scope context; | 117 Scope context; |
| 118 | 118 |
| 119 ResolverVisitor(Compiler compiler, Element element) | 119 ResolverVisitor(Compiler compiler, Element element) |
| 120 : this.compiler = compiler, | 120 : this.compiler = compiler, |
| 121 this.mapping = new TreeElements(), | 121 this.mapping = new TreeElements(), |
| 122 this.enclosingElement = element, | 122 this.enclosingElement = element, |
| 123 inInstanceContext = | 123 inInstanceContext = element.isInstanceMember() |
| 124 element.isInstanceMember() || element.kind == ElementKind.CONSTRUCTOR, | 124 || element.isGenerativeConstructor(), |
| 125 this.context = element.isMember() | 125 this.context = element.isMember() |
| 126 ? new ClassScope(element.enclosingElement, compiler.universe) | 126 ? new ClassScope(element.enclosingElement, compiler.universe) |
| 127 : new TopScope(compiler.universe); | 127 : new TopScope(compiler.universe); |
| 128 | 128 |
| 129 ResolverVisitor.from(ResolverVisitor other) | 129 ResolverVisitor.from(ResolverVisitor other) |
| 130 : compiler = other.compiler, | 130 : compiler = other.compiler, |
| 131 mapping = other.mapping, | 131 mapping = other.mapping, |
| 132 enclosingElement = other.enclosingElement, | 132 enclosingElement = other.enclosingElement, |
| 133 inInstanceContext = other.inInstanceContext, | 133 inInstanceContext = other.inInstanceContext, |
| 134 context = other.context; | 134 context = other.context; |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 class TopScope extends Scope { | 753 class TopScope extends Scope { |
| 754 Universe universe; | 754 Universe universe; |
| 755 | 755 |
| 756 TopScope(Universe this.universe) : super(null, null); | 756 TopScope(Universe this.universe) : super(null, null); |
| 757 Element lookup(SourceString name) => universe.find(name); | 757 Element lookup(SourceString name) => universe.find(name); |
| 758 | 758 |
| 759 Element add(Element element) { | 759 Element add(Element element) { |
| 760 throw "Cannot add an element in the top scope"; | 760 throw "Cannot add an element in the top scope"; |
| 761 } | 761 } |
| 762 } | 762 } |
| OLD | NEW |