fixed namespace/Math issue
This commit is contained in:
parent
c65f711ee3
commit
939e391a20
@ -64,13 +64,10 @@ class Context(
|
|||||||
return StoredObj(value, isMutable).also { objects.put(name, it) }
|
return StoredObj(value, isMutable).also { objects.put(name, it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getOrCreateNamespace(name: String): ObjNamespace =
|
fun getOrCreateNamespace(name: String): ObjClass {
|
||||||
(objects.getOrPut(name) {
|
val ns = objects.getOrPut(name) { StoredObj(ObjNamespace(name), isMutable = false) }.value
|
||||||
StoredObj(
|
return ns!!.objClass
|
||||||
ObjNamespace(name),
|
}
|
||||||
isMutable = false
|
|
||||||
)
|
|
||||||
}.value as ObjNamespace)
|
|
||||||
|
|
||||||
inline fun addVoidFn(vararg names: String, crossinline fn: suspend Context.() -> Unit) {
|
inline fun addVoidFn(vararg names: String, crossinline fn: suspend Context.() -> Unit) {
|
||||||
addFn<ObjVoid>(*names) {
|
addFn<ObjVoid>(*names) {
|
||||||
|
@ -292,8 +292,12 @@ fun Obj.toBool(): Boolean =
|
|||||||
|
|
||||||
|
|
||||||
data class ObjNamespace(val name: String) : Obj() {
|
data class ObjNamespace(val name: String) : Obj() {
|
||||||
|
override val objClass by lazy { ObjClass(name) }
|
||||||
|
|
||||||
|
override fun inspect(): String = "Ns[$name]"
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "namespace ${name}"
|
return "package $name"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user