Refactor Value and EvaluatorOutput models in order to get rid of optionals(?)
This commit is contained in:
@@ -13,7 +13,7 @@ class ExitFunction : Function("exit") {
|
||||
override fun define(new: FunctionDefinitionTool) {
|
||||
new function simple(optional(ofType(INT))) body { _, arguments ->
|
||||
val exitCode = arguments.getOrNull(0) ?: Value.int(0)
|
||||
exitProcess(exitCode.value!! as Int)
|
||||
exitProcess(exitCode.value as Int)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import io.smnp.type.model.Value
|
||||
class SleepFunction : Function("sleep") {
|
||||
override fun define(new: FunctionDefinitionTool) {
|
||||
new function simple(ofType(INT)) body { _, (milli) ->
|
||||
Thread.sleep((milli.value!! as Int).toLong())
|
||||
Thread.sleep((milli.value as Int).toLong())
|
||||
Value.void()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user