| 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 #library('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return element; | 172 return element; |
| 173 } | 173 } |
| 174 | 174 |
| 175 ClassElement getEnclosingClass() { | 175 ClassElement getEnclosingClass() { |
| 176 for (Element e = this; e !== null; e = e.enclosingElement) { | 176 for (Element e = this; e !== null; e = e.enclosingElement) { |
| 177 if (e.kind === ElementKind.CLASS) return e; | 177 if (e.kind === ElementKind.CLASS) return e; |
| 178 } | 178 } |
| 179 return null; | 179 return null; |
| 180 } | 180 } |
| 181 | 181 |
| 182 Element getEnclosingMember() { |
| 183 for (Element e = this; e !== null; e = e.enclosingElement) { |
| 184 if (e.isMember()) return e; |
| 185 } |
| 186 return null; |
| 187 } |
| 188 |
| 182 toString() => '$kind(${name.slowToString()})'; | 189 toString() => '$kind(${name.slowToString()})'; |
| 183 | 190 |
| 184 bool _isNative = false; | 191 bool _isNative = false; |
| 185 void setNative() { _isNative = true; } | 192 void setNative() { _isNative = true; } |
| 186 bool isNative() => _isNative; | 193 bool isNative() => _isNative; |
| 187 } | 194 } |
| 188 | 195 |
| 189 class ContainerElement extends Element { | 196 class ContainerElement extends Element { |
| 190 ContainerElement(name, kind, enclosingElement) : | 197 ContainerElement(name, kind, enclosingElement) : |
| 191 super(name, kind, enclosingElement); | 198 super(name, kind, enclosingElement); |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 final Node node; | 1028 final Node node; |
| 1022 Type bound; | 1029 Type bound; |
| 1023 Type type; | 1030 Type type; |
| 1024 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1031 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1025 [this.bound]) | 1032 [this.bound]) |
| 1026 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1033 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1027 Type computeType(compiler) => type; | 1034 Type computeType(compiler) => type; |
| 1028 Node parseNode(compiler) => node; | 1035 Node parseNode(compiler) => node; |
| 1029 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1036 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1030 } | 1037 } |
| OLD | NEW |