| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 : super(parent) { | 55 : super(parent) { |
| 56 assert(parent != null); | 56 assert(parent != null); |
| 57 } | 57 } |
| 58 | 58 |
| 59 Element add(Element newElement) { | 59 Element add(Element newElement) { |
| 60 throw "Cannot add element to TypeDeclarationScope"; | 60 throw "Cannot add element to TypeDeclarationScope"; |
| 61 } | 61 } |
| 62 | 62 |
| 63 Element lookupTypeVariable(SourceString name) { | 63 Element lookupTypeVariable(SourceString name) { |
| 64 Link<DartType> typeVariableLink = element.typeVariables; | 64 Link<DartType> typeVariableLink = element.typeVariables; |
| 65 while (!typeVariableLink.isEmpty()) { | 65 while (!typeVariableLink.isEmpty) { |
| 66 TypeVariableType typeVariable = typeVariableLink.head; | 66 TypeVariableType typeVariable = typeVariableLink.head; |
| 67 if (typeVariable.name == name) { | 67 if (typeVariable.name == name) { |
| 68 return typeVariable.element; | 68 return typeVariable.element; |
| 69 } | 69 } |
| 70 typeVariableLink = typeVariableLink.tail; | 70 typeVariableLink = typeVariableLink.tail; |
| 71 } | 71 } |
| 72 return null; | 72 return null; |
| 73 } | 73 } |
| 74 | 74 |
| 75 Element localLookup(SourceString name) => lookupTypeVariable(name); | 75 Element localLookup(SourceString name) => lookupTypeVariable(name); |
| (...skipping 78 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 |