Commit 94ddd29d authored by Chip Turner's avatar Chip Turner Committed by Sara Golemon

Expose a human-readable type name for a dynamic

Summary: Aids in debugging dynamic types, etc.

Test Plan: unit tests

Reviewed By: delong.j@fb.com

FB internal diff: D812385
parent 7969353a
...@@ -34,6 +34,10 @@ DEF_TYPE(dynamic::ObjectImpl, "object", dynamic::OBJECT); ...@@ -34,6 +34,10 @@ DEF_TYPE(dynamic::ObjectImpl, "object", dynamic::OBJECT);
#undef DEF_TYPE #undef DEF_TYPE
const char* dynamic::typeName() const {
return typeName(type_);
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
} }
......
...@@ -253,6 +253,11 @@ public: ...@@ -253,6 +253,11 @@ public:
*/ */
Type type() const; Type type() const;
/*
* Returns the type of this dynamic as a printable string.
*/
const char* typeName() const;
/* /*
* Extract a value while trying to convert to the specified type. * Extract a value while trying to convert to the specified type.
* Throws exceptions if we cannot convert from the real type to the * Throws exceptions if we cannot convert from the real type to the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment