Define Flag operators for YGPrintOptions (#37115)
Summary: X-link: https://github.com/facebook/react-native/pull/37115 Pull Request resolved: https://github.com/facebook/yoga/pull/1267 This is an existing bitset enum in the API. Use the facility added in the last diff to add flag operators to it, to avoid the need for casting, and to make it clearer in the generated YGEnums.h that it is a bitset. Reviewed By: rshest Differential Revision: D45341504 fbshipit-source-id: 0b80588f3e2e167d4c1c722c6d6608408dd617ba
This commit is contained in:
committed by
Facebook GitHub Bot
parent
01c0c4ed3b
commit
c878ceeabd
8
enums.py
8
enums.py
@@ -57,7 +57,11 @@ ENUMS = {
|
||||
# Conformance fix: https://github.com/facebook/yoga/pull/1028
|
||||
"FixAbsoluteTrailingColumnMargin",
|
||||
],
|
||||
"PrintOptions": [("Layout", 1), ("Style", 2), ("Children", 4)],
|
||||
"PrintOptions": [
|
||||
("Layout", 1 << 0),
|
||||
("Style", 1 << 1),
|
||||
("Children", 1 << 2),
|
||||
],
|
||||
"Gutter": ["Column", "Row", "All"],
|
||||
# Known incorrect behavior which can be enabled for compatibility
|
||||
"Errata": [
|
||||
@@ -79,7 +83,7 @@ ENUMS = {
|
||||
# well?
|
||||
DO_NOT_STRIP = ["LogLevel"]
|
||||
|
||||
BITSET_ENUMS = ["Errata"]
|
||||
BITSET_ENUMS = ["PrintOptions", "Errata"]
|
||||
|
||||
|
||||
def get_license(ext):
|
||||
|
@@ -127,6 +127,7 @@ YG_ENUM_DECL(
|
||||
YGPrintOptionsLayout = 1,
|
||||
YGPrintOptionsStyle = 2,
|
||||
YGPrintOptionsChildren = 4)
|
||||
YG_DEFINE_ENUM_FLAG_OPERATORS(YGPrintOptions)
|
||||
|
||||
YG_ENUM_SEQ_DECL(
|
||||
YGUnit,
|
||||
|
Reference in New Issue
Block a user