Fabric: `fromDynamic` for float numbers was moved to `core` module
Summary: @public Otherwise, it can mess with implementation for `int`s and causes some errors where `float` implementation was requested but `int` was applied. Reviewed By: mdvacca Differential Revision: D8601752 fbshipit-source-id: cfe51b7785ff29ee4ad88f0f1cbfed335557d5ef
This commit is contained in:
parent
8ce758f48a
commit
97bc0c03ba
|
@ -22,6 +22,8 @@ inline void fromDynamic(const folly::dynamic &value, int &result) {
|
||||||
// So this always converts the value to int64 instead.
|
// So this always converts the value to int64 instead.
|
||||||
result = value.asInt();
|
result = value.asInt();
|
||||||
}
|
}
|
||||||
|
inline void fromDynamic(const folly::dynamic &value, float &result) { result = (float)value.asDouble(); }
|
||||||
|
inline void fromDynamic(const folly::dynamic &value, double &result) { result = value.asDouble(); }
|
||||||
inline void fromDynamic(const folly::dynamic &value, std::string &result) { result = value.getString(); }
|
inline void fromDynamic(const folly::dynamic &value, std::string &result) { result = value.getString(); }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -55,10 +55,6 @@ inline std::string toString(const SharedColor &value) {
|
||||||
|
|
||||||
#pragma mark - Geometry
|
#pragma mark - Geometry
|
||||||
|
|
||||||
inline void fromDynamic(const folly::dynamic &value, Float &result) {
|
|
||||||
result = value.asDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void fromDynamic(const folly::dynamic &value, Point &result) {
|
inline void fromDynamic(const folly::dynamic &value, Point &result) {
|
||||||
if (value.isObject()) {
|
if (value.isObject()) {
|
||||||
result = Point {(Float)value["x"].asDouble(), (Float)value["y"].asDouble()};
|
result = Point {(Float)value["x"].asDouble(), (Float)value["y"].asDouble()};
|
||||||
|
|
Loading…
Reference in New Issue