Skip to content

Commit

Permalink
Fix state inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Dec 28, 2023
1 parent 115f51e commit d49c4df
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@ class State(val parentState: State? = null) {
/**
* The standard output stream of the state.
*/
var stdout: OutputStream = System.out
var stdout: OutputStream = parentState?.stdout ?: System.out

/**
* The standard error stream of the state.
*/
var stderr: OutputStream = System.err
var stderr: OutputStream = parentState?.stderr ?: System.err

/**
* The standard input stream of the state.
*/
var stdin: InputStream = System.`in`
var stdin: InputStream = parentState?.stdin ?: System.`in`

/**
* The [FileSystem] used by the state.
*/
var fileSystem: FileSystem = FileSystems.getDefault()
var fileSystem: FileSystem = parentState?.fileSystem ?: FileSystems.getDefault()

/**
* The current working directory of the state.
*/
var currentDir = System.getProperty("user.dir")
var currentDir: String = parentState?.currentDir ?: System.getProperty("user.dir")

internal val openUpvalues = ArrayDeque<Upvalue.Instance>()

Expand Down

0 comments on commit d49c4df

Please sign in to comment.