| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 Element localLookup(SourceString name) => elements[name]; | 98 Element localLookup(SourceString name) => elements[name]; |
| 99 } | 99 } |
| 100 | 100 |
| 101 class MethodScope extends MutableScope { | 101 class MethodScope extends MutableScope { |
| 102 final Element element; | 102 final Element element; |
| 103 | 103 |
| 104 MethodScope(Scope parent, this.element) | 104 MethodScope(Scope parent, this.element) |
| 105 : super(parent); | 105 : super(parent); |
| 106 | 106 |
| 107 String toString() => 'MethodScope($element${elements.keys})'; | 107 String toString() => 'MethodScope($element${elements.keys.toList()})'; |
| 108 } | 108 } |
| 109 | 109 |
| 110 class BlockScope extends MutableScope { | 110 class BlockScope extends MutableScope { |
| 111 BlockScope(Scope parent) : super(parent); | 111 BlockScope(Scope parent) : super(parent); |
| 112 | 112 |
| 113 String toString() => 'BlockScope(${elements.keys})'; | 113 String toString() => 'BlockScope(${elements.keys.toList()})'; |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * [ClassScope] defines the inner scope of a class/interface declaration in | 117 * [ClassScope] defines the inner scope of a class/interface declaration in |
| 118 * which declared members, declared type variables, entities in the enclosing | 118 * which declared members, declared type variables, entities in the enclosing |
| 119 * scope and inherited members are available, in the given order. | 119 * scope and inherited members are available, in the given order. |
| 120 */ | 120 */ |
| 121 class ClassScope extends TypeDeclarationScope { | 121 class ClassScope extends TypeDeclarationScope { |
| 122 ClassElement get element => super.element; | 122 ClassElement get element => super.element; |
| 123 | 123 |
| (...skipping 30 matching lines...) Expand all 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 |