Moved YGFloatOptional from C struct to C++ struct

Summary:
Earlier `YGfloatOptional` was plain struct with no privacy around the variables. This diff adds privacy and also enforces checks when one tries to access value of an undefined `YGFloatOptional`

This diff also adds a behaviour in which when a value of an undefined YGFloatOptional is accessed, it will normally terminate(Several cleanup steps are performed).

Reviewed By: emilsjolander

Differential Revision: D7288555

fbshipit-source-id: f61cc92c8fd0d48d2fc1f4d0e6fcef155f19ff8a
This commit is contained in:
Pritesh Nandgaonkar
2018-03-15 12:29:02 -07:00
committed by Facebook Github Bot
parent ae86824636
commit 5d7b75a47a
10 changed files with 123 additions and 64 deletions

View File

@@ -55,7 +55,7 @@ float YGFloatSanitize(const float& val) {
}
float YGUnwrapFloatOptional(const YGFloatOptional& op) {
return op.isUndefined ? YGUndefined : op.value;
return op.isUndefined() ? YGUndefined : op.getValue();
}
bool YGFloatOptionalFloatEquals(