+var and val
This commit is contained in:
1 parent
50986fbac5
commit
408543d191
7 files changed
+108
-38
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package net.sergeych.ling
|
||||
|
||||
class Context(
|
||||
val parent: Context? = null,
|
||||
val parent: Context? = Script.defaultContext.copy(),
|
||||
val args: Arguments = Arguments.EMPTY
|
||||
) {
|
||||
|
||||
@@ -58,6 +58,11 @@ class Context(
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun eval(code: String): Obj =
|
||||
Compiler().compile(code.toSource()).execute(this)
|
||||
|
||||
fun containsLocal(name: String): Boolean = name in objects
|
||||
|
||||
companion object {
|
||||
operator fun invoke() = Context()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user