Add support for function/methods invocation on Environment + create call stack model
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package io.smnp.ext.lang
|
||||
|
||||
import io.smnp.callable.function.Function
|
||||
import io.smnp.ext.ModuleDefinition
|
||||
import io.smnp.ext.lang.function.DebugFunction
|
||||
import io.smnp.ext.lang.method.ListAccessMethod
|
||||
import io.smnp.ext.lang.method.MapAccessMethod
|
||||
import org.pf4j.Extension
|
||||
@@ -10,7 +10,7 @@ import org.pf4j.Extension
|
||||
class LangModule : ModuleDefinition {
|
||||
override fun modulePath() = "smnp.lang"
|
||||
|
||||
override fun functions() = emptyList<Function>()
|
||||
override fun functions() = listOf(DebugFunction())
|
||||
|
||||
override fun methods() = listOf(ListAccessMethod(), MapAccessMethod())
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.smnp.ext.lang.function
|
||||
|
||||
import io.smnp.callable.function.Function
|
||||
import io.smnp.callable.function.FunctionDefinitionTool
|
||||
import io.smnp.callable.signature.Signature.Companion.simple
|
||||
import io.smnp.type.model.Value
|
||||
|
||||
class DebugFunction : Function("debug") {
|
||||
override fun define(new: FunctionDefinitionTool) {
|
||||
new function simple() define { env, _ ->
|
||||
env.printCallStack()
|
||||
Value.void()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user