| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart' show | 8 import '../common/resolution.dart' show |
| 9 Resolution, | 9 Resolution, |
| 10 Parsing; | 10 Parsing; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // the outermost for elements in closure classses, but some call-sites rely | 201 // the outermost for elements in closure classses, but some call-sites rely |
| 202 // on that behavior. | 202 // on that behavior. |
| 203 for (Element e = this; e != null; e = e.enclosingElement) { | 203 for (Element e = this; e != null; e = e.enclosingElement) { |
| 204 if (e.isClassMember || e.isTopLevel) { | 204 if (e.isClassMember || e.isTopLevel) { |
| 205 return e; | 205 return e; |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 return null; | 208 return null; |
| 209 } | 209 } |
| 210 | 210 |
| 211 ClassElement get contextClass { |
| 212 ClassElement cls; |
| 213 for (Element e = this; e != null; e = e.enclosingElement) { |
| 214 if (e.isClass) { |
| 215 // Record [e] instead of returning it directly. We need the last class |
| 216 // in the chain since the first classes might be closure classes. |
| 217 cls = e.declaration; |
| 218 } |
| 219 } |
| 220 return cls; |
| 221 } |
| 222 |
| 211 /** | 223 /** |
| 212 * Creates the scope for this element. | 224 * Creates the scope for this element. |
| 213 */ | 225 */ |
| 214 Scope buildScope() => enclosingElement.buildScope(); | 226 Scope buildScope() => enclosingElement.buildScope(); |
| 215 | 227 |
| 216 String toString() { | 228 String toString() { |
| 217 // TODO(johnniwinther): Test for nullness of name, or make non-nullness an | 229 // TODO(johnniwinther): Test for nullness of name, or make non-nullness an |
| 218 // invariant for all element types? | 230 // invariant for all element types? |
| 219 var nameText = name != null ? name : '?'; | 231 var nameText = name != null ? name : '?'; |
| 220 if (enclosingElement != null && !isTopLevel) { | 232 if (enclosingElement != null && !isTopLevel) { |
| (...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 AstElement get definingElement; | 3221 AstElement get definingElement; |
| 3210 | 3222 |
| 3211 bool get hasResolvedAst => definingElement.hasTreeElements; | 3223 bool get hasResolvedAst => definingElement.hasTreeElements; |
| 3212 | 3224 |
| 3213 ResolvedAst get resolvedAst { | 3225 ResolvedAst get resolvedAst { |
| 3214 return new ResolvedAst(declaration, | 3226 return new ResolvedAst(declaration, |
| 3215 definingElement.node, definingElement.treeElements); | 3227 definingElement.node, definingElement.treeElements); |
| 3216 } | 3228 } |
| 3217 | 3229 |
| 3218 } | 3230 } |
| OLD | NEW |