Skip to content

Commit 1cf00ff

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Migrate YogaErrata enum to Kotlin
Summary: Migrate YogaErrata.java to YogaErrata.kt by adding Errata to KOTLIN_ENUM_NAMES in enums.py and regenerating. Differential Revision: D104666332
1 parent 2a9b193 commit 1cf00ff

3 files changed

Lines changed: 44 additions & 42 deletions

File tree

enums.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@
9595
}
9696

9797
# Temporary filter enums to not upgrade all enums at once
98-
KOTLIN_ENUM_NAMES = {"Direction", "Align", "BoxSizing", "Dimension", "Display", "Edge"}
98+
KOTLIN_ENUM_NAMES = {
99+
"Direction",
100+
"Align",
101+
"BoxSizing",
102+
"Dimension",
103+
"Display",
104+
"Edge",
105+
"Errata",
106+
}
99107

100108
ENUMS_KOTLIN = {name: ENUMS[name] for name in KOTLIN_ENUM_NAMES}
101109
ENUMS_JAVA = {

java/com/facebook/yoga/YogaErrata.java

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// @generated by enums.py
9+
10+
package com.facebook.yoga
11+
12+
public enum class YogaErrata(public val intValue: Int) {
13+
NONE(0),
14+
STRETCH_FLEX_BASIS(1),
15+
ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
16+
ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4),
17+
ALL(2147483647),
18+
CLASSIC(2147483646);
19+
20+
public fun intValue(): Int = intValue
21+
22+
public companion object {
23+
@JvmStatic
24+
public fun fromInt(value: Int): YogaErrata =
25+
when (value) {
26+
0 -> NONE
27+
1 -> STRETCH_FLEX_BASIS
28+
2 -> ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING
29+
4 -> ABSOLUTE_PERCENT_AGAINST_INNER_SIZE
30+
2147483647 -> ALL
31+
2147483646 -> CLASSIC
32+
else -> throw IllegalArgumentException("Unknown enum value: $value")
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)