Skip to content

Commit

Permalink
fix: Also annotate primary constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jan 9, 2025
1 parent 123e5ae commit 7d5a076
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
9 changes: 6 additions & 3 deletions packages/nitrogen/src/syntax/kotlin/KotlinStruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ import com.margelo.nitro.core.*
*/
@DoNotStrip
@Keep
data class ${structType.structName}(
${indent(values.join(',\n'), ' ')}
) {
data class ${structType.structName}
@DoNotStrip
@Keep
constructor(
${indent(values.join(',\n'), ' ')}
) {
${indent(secondaryConstructor, ' ')}
}
`.trim()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ import com.margelo.nitro.core.*
*/
@DoNotStrip
@Keep
data class Car(
val year: Double,
val make: String,
val model: String,
val power: Double,
val powertrain: Powertrain,
val driver: Person?,
val isFast: Boolean?
) {
data class Car
@DoNotStrip
@Keep
constructor(
val year: Double,
val make: String,
val model: String,
val power: Double,
val powertrain: Powertrain,
val driver: Person?,
val isFast: Boolean?
) {
/* main constructor */
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ import com.margelo.nitro.core.*
*/
@DoNotStrip
@Keep
data class ImageSize(
val width: Double,
val height: Double
) {
data class ImageSize
@DoNotStrip
@Keep
constructor(
val width: Double,
val height: Double
) {
/* main constructor */
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ import com.margelo.nitro.core.*
*/
@DoNotStrip
@Keep
data class JsStyleStruct(
val value: Double,
val onChanged: (num: Double) -> Unit
) {
data class JsStyleStruct
@DoNotStrip
@Keep
constructor(
val value: Double,
val onChanged: (num: Double) -> Unit
) {
@DoNotStrip
@Keep
@Suppress("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ import com.margelo.nitro.core.*
*/
@DoNotStrip
@Keep
data class Person(
val name: String,
val age: Double
) {
data class Person
@DoNotStrip
@Keep
constructor(
val name: String,
val age: Double
) {
/* main constructor */
}

0 comments on commit 7d5a076

Please sign in to comment.