Files
sdk/utils/apidoc/lib/metadata.dart
T
amouravski@google.com d2a79c9bdd First half of the new HTML json docs.
This half produces the JSON file by going through each of the HTML libraries
and pulling out the @DomName annotations as keys for the map.
This means that even though member names may change, the map still works.

Currently creates a blank json file because I have not hooked up the other half
that puts the docs into the libraries to begin with.

Review URL: https://codereview.chromium.org//12035057

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17610 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-24 22:53:00 +00:00

15 lines
503 B
Dart

library metadata;
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
/// Returns the metadata for the given string or null if not found.
InstanceMirror findMetadata(List<InstanceMirror> metadataList, String find) {
return metadataList.firstMatching(
(metadata) {
if (metadata is TypeInstanceMirror) {
return metadata.representedType.simpleName == find;
}
return metadata.type.simpleName == find;
}, orElse: () => null);
}