Skip to content

Commit

Permalink
Only use var in Builder when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed Aug 15, 2023
1 parent 6dd04a8 commit dc7b61b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class Permissions internal constructor(
public fun copy(code: DiscordBitSet = this.code): Permissions = Permissions(code)

public class Builder(
private var code: DiscordBitSet = EmptyBitSet(),
private val code: DiscordBitSet = EmptyBitSet(),
) {
public operator fun Permission.unaryPlus() {
this@Builder.code.add(this.code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class Intents internal constructor(
public fun copy(code: DiscordBitSet = this.code): Intents = Intents(code)

public class Builder(
private var code: DiscordBitSet = EmptyBitSet(),
private val code: DiscordBitSet = EmptyBitSet(),
) {
public operator fun Intent.unaryPlus() {
this@Builder.code.add(this.code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ internal fun TypeSpec.Builder.addBuilder() {
}
}
addProperty(valueName, valueCN, PRIVATE) {
mutable()
mutable(
when (valueType) {
INT -> true
BIT_SET -> false
}
)
initializer(valueName)
}

Expand Down

0 comments on commit dc7b61b

Please sign in to comment.