Introduce isDefined() and remove cases of !isUndefined() (#1439)
Summary: X-link: https://github.com/facebook/react-native/pull/41209 Pull Request resolved: https://github.com/facebook/yoga/pull/1439 There are so many instances in this code base where we use the double negative of `!yoga::isUndefined(<something>)`. This is not as easy to read since because of this double negative imo. Additionally, sometimes we have really long chains like `!longVariableName.longFunctionName(longArgumentName).isUndefined()` and it is hard to see that this undefined is inverted. This just replaces all instances of inverted `isUndefined()` with `isDefined()` so its easier to read. Reviewed By: NickGerleman Differential Revision: D50705523 fbshipit-source-id: edc7d3f2cbbae38ddaeb2030a419320caf73feff
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e90f2a8e2c
commit
c09554056d
@@ -312,7 +312,7 @@ class YG_EXPORT Style {
|
||||
}
|
||||
|
||||
CompactValue resolveColumnGap() const {
|
||||
if (!gap_[yoga::to_underlying(Gutter::Column)].isUndefined()) {
|
||||
if (gap_[yoga::to_underlying(Gutter::Column)].isDefined()) {
|
||||
return gap_[yoga::to_underlying(Gutter::Column)];
|
||||
} else {
|
||||
return gap_[yoga::to_underlying(Gutter::All)];
|
||||
@@ -320,7 +320,7 @@ class YG_EXPORT Style {
|
||||
}
|
||||
|
||||
CompactValue resolveRowGap() const {
|
||||
if (!gap_[yoga::to_underlying(Gutter::Row)].isUndefined()) {
|
||||
if (gap_[yoga::to_underlying(Gutter::Row)].isDefined()) {
|
||||
return gap_[yoga::to_underlying(Gutter::Row)];
|
||||
} else {
|
||||
return gap_[yoga::to_underlying(Gutter::All)];
|
||||
|
Reference in New Issue
Block a user