Index: utils/apidoc/lib/metadata.dart |
diff --git a/utils/apidoc/lib/metadata.dart b/utils/apidoc/lib/metadata.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e042d004423ca9ba8ff40081d6abb0e6b899b70d |
--- /dev/null |
+++ b/utils/apidoc/lib/metadata.dart |
@@ -0,0 +1,14 @@ |
+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); |
+} |