Dev #194

Merged
altavir merged 266 commits from dev into master 2021-01-20 17:32:32 +03:00
Showing only changes of commit 8014b3df0b - Show all commits

View File

@ -19,8 +19,7 @@ import kotlin.reflect.KClass
* @author Alexander Nozik
*/
public fun <T : Any> MST.compileWith(type: KClass<T>, algebra: Algebra<T>): Expression<T> {
fun AsmBuilder<T>.visit(node: MST) {
when (node) {
fun AsmBuilder<T>.visit(node: MST): Unit = when (node) {
is MST.Symbolic -> {
val symbol = try {
algebra.symbol(node.value)
@ -53,7 +52,6 @@ public fun <T : Any> MST.compileWith(type: KClass<T>, algebra: Algebra<T>): Expr
visit(node.right)
}
}
}
return AsmBuilder(type, algebra, buildName(this)) { visit(this@compileWith) }.getInstance()
}