| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class Scope { | 7 abstract class Scope { |
| 8 /** | 8 /** |
| 9 * Adds [element] to this scope. This operation is only allowed on mutable | 9 * Adds [element] to this scope. This operation is only allowed on mutable |
| 10 * scopes such as [MethodScope] and [BlockScope]. | 10 * scopes such as [MethodScope] and [BlockScope]. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 static Scope buildEnclosingScope(Element element) { | 38 static Scope buildEnclosingScope(Element element) { |
| 39 return element.enclosingElement != null | 39 return element.enclosingElement != null |
| 40 ? element.enclosingElement.buildScope() : element.buildScope(); | 40 ? element.enclosingElement.buildScope() : element.buildScope(); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * [TypeDeclarationScope] defines the outer scope of a type declaration in | 45 * [TypeDeclarationScope] defines the outer scope of a type declaration in |
| 46 * which the declared type variables and the entities in the enclosing scope are | 46 * which the declared type variables and the entities in the enclosing scope are |
| 47 * available but where declared and inherited members are not available. This | 47 * available but where declared and inherited members are not available. This |
| 48 * scope is only used for class/interface declarations during resolution of the | 48 * scope is only used for class declarations during resolution of the |
| 49 * class hierarchy. In all other cases [ClassScope] is used. | 49 * class hierarchy. In all other cases [ClassScope] is used. |
| 50 */ | 50 */ |
| 51 class TypeDeclarationScope extends NestedScope { | 51 class TypeDeclarationScope extends NestedScope { |
| 52 final TypeDeclarationElement element; | 52 final TypeDeclarationElement element; |
| 53 | 53 |
| 54 TypeDeclarationScope(parent, this.element) | 54 TypeDeclarationScope(parent, this.element) |
| 55 : super(parent) { | 55 : super(parent) { |
| 56 assert(parent != null); | 56 assert(parent != null); |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 Element localLookup(SourceString name) => library.find(name); | 155 Element localLookup(SourceString name) => library.find(name); |
| 156 Element lookup(SourceString name) => localLookup(name); | 156 Element lookup(SourceString name) => localLookup(name); |
| 157 | 157 |
| 158 Element add(Element newElement) { | 158 Element add(Element newElement) { |
| 159 throw "Cannot add an element to a library scope"; | 159 throw "Cannot add an element to a library scope"; |
| 160 } | 160 } |
| 161 | 161 |
| 162 String toString() => 'LibraryScope($library)'; | 162 String toString() => 'LibraryScope($library)'; |
| 163 } | 163 } |
| OLD | NEW |