Index: runtime/lib/class_id.cc |
diff --git a/runtime/lib/class_id.cc b/runtime/lib/class_id.cc |
index 2d9f67d3defa7e0f00e1046d9dda4117b79b61a8..c950b0edd22e9128f893da29b1a7857b1dab943a 100644 |
--- a/runtime/lib/class_id.cc |
+++ b/runtime/lib/class_id.cc |
@@ -13,4 +13,24 @@ DEFINE_NATIVE_ENTRY(ClassID_getID, 1) { |
return Smi::New(instance.GetClassId()); |
} |
+ |
+DEFINE_NATIVE_ENTRY(ClassID_byName, 1) { |
+ GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); |
+ |
+#define CLASS_LIST_WITH_NULL(V) \ |
+ V(Null) \ |
+ CLASS_LIST_NO_OBJECT(V) |
+ |
+#define COMPARE(clazz) \ |
+ if (name.Equals(#clazz)) return Smi::New(k##clazz##Cid); |
+ |
+ CLASS_LIST_WITH_NULL(COMPARE) |
+ |
+#undef COMPARE |
+#undef CLASS_LIST_WITH_NULL |
+ |
+ UNREACHABLE(); |
+ return Smi::New(-1); |
+} |
+ |
} // namespace dart |