| 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 'elements.dart'; | 7 import 'elements.dart'; |
| 8 import '../../compiler.dart' as api; | 8 import '../../compiler.dart' as api; |
| 9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 /** Look up a top-level element in this library, but only look for | 895 /** Look up a top-level element in this library, but only look for |
| 896 * non-imported elements. Returns null if no such element exist. */ | 896 * non-imported elements. Returns null if no such element exist. */ |
| 897 Element findLocal(String elementName) { | 897 Element findLocal(String elementName) { |
| 898 // TODO(johnniwinther): How to handle injected elements in the patch | 898 // TODO(johnniwinther): How to handle injected elements in the patch |
| 899 // library? | 899 // library? |
| 900 Element result = localScope.lookup(elementName); | 900 Element result = localScope.lookup(elementName); |
| 901 if (result == null || result.getLibrary() != this) return null; | 901 if (result == null || result.getLibrary() != this) return null; |
| 902 return result; | 902 return result; |
| 903 } | 903 } |
| 904 | 904 |
| 905 Element findExported(String elementName) { |
| 906 for (Link link = exports; !link.isEmpty; link = link.tail) { |
| 907 Element element = link.head; |
| 908 if (element.name == elementName) return element; |
| 909 } |
| 910 return null; |
| 911 } |
| 912 |
| 905 void forEachExport(f(Element element)) { | 913 void forEachExport(f(Element element)) { |
| 906 exports.forEach((Element e) => f(e)); | 914 exports.forEach((Element e) => f(e)); |
| 907 } | 915 } |
| 908 | 916 |
| 909 void forEachLocalMember(f(Element element)) { | 917 void forEachLocalMember(f(Element element)) { |
| 910 if (isPatch) { | 918 if (isPatch) { |
| 911 // Patch libraries traverse both origin and injected members. | 919 // Patch libraries traverse both origin and injected members. |
| 912 origin.localMembers.forEach(f); | 920 origin.localMembers.forEach(f); |
| 913 | 921 |
| 914 void filterPatch(Element element) { | 922 void filterPatch(Element element) { |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 | 2371 |
| 2364 MetadataAnnotation ensureResolved(Compiler compiler) { | 2372 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2365 if (resolutionState == STATE_NOT_STARTED) { | 2373 if (resolutionState == STATE_NOT_STARTED) { |
| 2366 compiler.resolver.resolveMetadataAnnotation(this); | 2374 compiler.resolver.resolveMetadataAnnotation(this); |
| 2367 } | 2375 } |
| 2368 return this; | 2376 return this; |
| 2369 } | 2377 } |
| 2370 | 2378 |
| 2371 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2379 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2372 } | 2380 } |
| OLD | NEW |