Skip to content

Commit

Permalink
Eliminate more trivial backing 'val' storage (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton authored Aug 16, 2024
1 parent f9b3400 commit 5a6c04d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/common/src/Segment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal abstract class SegmentCopyTracker {
* Simple [SegmentCopyTracker] that always reports shared state.
*/
internal object AlwaysSharedCopyTracker : SegmentCopyTracker() {
override val shared: Boolean = true
override val shared: Boolean get() = true
override fun addCopy() = Unit
override fun removeCopy(): Boolean = true
}
Expand Down
2 changes: 1 addition & 1 deletion core/common/src/unsafe/UnsafeBufferOperations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public object UnsafeBufferOperations {
/**
* Maximum value that is safe to pass to [writeToTail].
*/
public val maxSafeWriteCapacity: Int = Segment.SIZE
public val maxSafeWriteCapacity: Int get() = Segment.SIZE

/**
* Moves [bytes] to the end of the [buffer].
Expand Down
2 changes: 1 addition & 1 deletion core/native/src/files/PathsNative.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public actual class Path internal constructor(
}
}

public actual val SystemPathSeparator: Char = UnixPathSeparator
public actual val SystemPathSeparator: Char get() = UnixPathSeparator

internal expect fun dirnameImpl(path: String): String

Expand Down
4 changes: 2 additions & 2 deletions core/wasmWasi/src/files/FileSystemWasm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public actual val SystemTemporaryDirectory: Path = Path("/tmp")
* For example, if following directories were pre-opened: `/work`, `/tmp`, `/persistent`, then
* the path `a/b/c/d` will be resolved to `/work/a/b/c/d` as `/work` is the first pre-opened directory.
*/
public actual val SystemFileSystem: FileSystem = WasiFileSystem
public actual val SystemFileSystem: FileSystem get() = WasiFileSystem

@OptIn(UnsafeWasmMemoryApi::class)
internal object WasiFileSystem : SystemFileSystemImpl() {
Expand Down Expand Up @@ -370,7 +370,7 @@ public actual open class FileNotFoundException actual constructor(
) : IOException(message)

// The property affects only paths processing and in Wasi paths are always '/'-delimited.
internal actual val isWindows: Boolean = false
internal actual val isWindows: Boolean get() = false

internal object PreOpens {
data class PreOpen(val path: Path, val fd: Int)
Expand Down
2 changes: 1 addition & 1 deletion core/wasmWasi/src/files/PathsWasm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public actual class Path internal constructor(rawPath: String, @Suppress("UNUSED

// The path separator is always '/'.
// https://github.com/WebAssembly/wasi-filesystem/blob/e79b05803e9ffd3b0cfdc0a8af20ac743abbe36a/wit/types.wit#L13C4-L13C71
public actual val SystemPathSeparator: Char = UnixPathSeparator
public actual val SystemPathSeparator: Char get() = UnixPathSeparator

public actual fun Path(path: String): Path = Path(path, null as Any?)

0 comments on commit 5a6c04d

Please sign in to comment.