| 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 'dart:uri'; | 7 import 'dart:uri'; |
| 8 | 8 |
| 9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. | 9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. |
| 10 import '../../compiler.dart' as api_e; | 10 import '../../compiler.dart' as api_e; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 Token findMyName(Token token) { | 257 Token findMyName(Token token) { |
| 258 for (Token t = token; !identical(t.kind, EOF_TOKEN); t = t.next) { | 258 for (Token t = token; !identical(t.kind, EOF_TOKEN); t = t.next) { |
| 259 if (t.value == name) return t; | 259 if (t.value == name) return t; |
| 260 } | 260 } |
| 261 return token; | 261 return token; |
| 262 } | 262 } |
| 263 | 263 |
| 264 // TODO(kasperl): This is a very bad hash code for the element and | 264 // TODO(kasperl): This is a very bad hash code for the element and |
| 265 // there's no reason why two elements with the same name should have | 265 // there's no reason why two elements with the same name should have |
| 266 // the same hash code. Replace this with a simple id in the element? | 266 // the same hash code. Replace this with a simple id in the element? |
| 267 int hashCode() => name == null ? 0 : name.hashCode(); | 267 int get hashCode => name == null ? 0 : name.hashCode; |
| 268 | 268 |
| 269 CompilationUnitElement getCompilationUnit() { | 269 CompilationUnitElement getCompilationUnit() { |
| 270 Element element = this; | 270 Element element = this; |
| 271 while (!element.isCompilationUnit()) { | 271 while (!element.isCompilationUnit()) { |
| 272 element = element.enclosingElement; | 272 element = element.enclosingElement; |
| 273 } | 273 } |
| 274 return element; | 274 return element; |
| 275 } | 275 } |
| 276 | 276 |
| 277 LibraryElement getLibrary() => enclosingElement.getLibrary(); | 277 LibraryElement getLibrary() => enclosingElement.getLibrary(); |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 */ | 1637 */ |
| 1638 bool isSubclassOf(ClassElement cls) { | 1638 bool isSubclassOf(ClassElement cls) { |
| 1639 for (ClassElement s = this; s != null; s = s.superclass) { | 1639 for (ClassElement s = this; s != null; s = s.superclass) { |
| 1640 if (identical(s, cls)) return true; | 1640 if (identical(s, cls)) return true; |
| 1641 } | 1641 } |
| 1642 return false; | 1642 return false; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 bool isInterface() => false; | 1645 bool isInterface() => false; |
| 1646 bool isNative() => nativeName != null; | 1646 bool isNative() => nativeName != null; |
| 1647 int hashCode() => id; | 1647 int get hashCode => id; |
| 1648 | 1648 |
| 1649 // TODO(johnniwinther): Rewrite to avoid the optional argument. | 1649 // TODO(johnniwinther): Rewrite to avoid the optional argument. |
| 1650 Scope buildScope({bool patchScope: false}) { | 1650 Scope buildScope({bool patchScope: false}) { |
| 1651 if (origin != null) { | 1651 if (origin != null) { |
| 1652 return new PatchClassScope( | 1652 return new PatchClassScope( |
| 1653 enclosingElement.buildScope(patchScope: patchScope), origin, this); | 1653 enclosingElement.buildScope(patchScope: patchScope), origin, this); |
| 1654 } else if (patchScope && patch != null) { | 1654 } else if (patchScope && patch != null) { |
| 1655 return new PatchClassScope( | 1655 return new PatchClassScope( |
| 1656 enclosingElement.buildScope(patchScope: patchScope), this, patch); | 1656 enclosingElement.buildScope(patchScope: patchScope), this, patch); |
| 1657 } else { | 1657 } else { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 | 1969 |
| 1970 MetadataAnnotation ensureResolved(Compiler compiler) { | 1970 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1971 if (resolutionState == STATE_NOT_STARTED) { | 1971 if (resolutionState == STATE_NOT_STARTED) { |
| 1972 compiler.resolver.resolveMetadataAnnotation(this); | 1972 compiler.resolver.resolveMetadataAnnotation(this); |
| 1973 } | 1973 } |
| 1974 return this; | 1974 return this; |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1977 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1978 } | 1978 } |
| OLD | NEW |