Dev #194

Merged
altavir merged 266 commits from dev into master 2021-01-20 17:32:32 +03:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit cfc13cda8f - Show all commits

View File

@ -2,7 +2,7 @@ package kscience.kmath.estree
import kscience.kmath.ast.MST
import kscience.kmath.ast.MstExpression
import kscience.kmath.estree.internal.JSBuilder
import kscience.kmath.estree.internal.ESTreeBuilder
import kscience.kmath.estree.internal.estree.BaseExpression
import kscience.kmath.expressions.Expression
import kscience.kmath.operations.Algebra
@ -11,7 +11,7 @@ import kscience.kmath.operations.RealField
@PublishedApi
internal fun <T> MST.compileWith(algebra: Algebra<T>): Expression<T> {
fun JSBuilder<T>.visit(node: MST): BaseExpression = when (node) {
fun ESTreeBuilder<T>.visit(node: MST): BaseExpression = when (node) {
is MST.Symbolic -> {
val symbol = try {
algebra.symbol(node.value)
@ -57,7 +57,7 @@ internal fun <T> MST.compileWith(algebra: Algebra<T>): Expression<T> {
}
}
return JSBuilder<T> { visit(this@compileWith) }.instance
return ESTreeBuilder<T> { visit(this@compileWith) }.instance
}

View File

@ -5,7 +5,7 @@ import kscience.kmath.estree.internal.estree.*
import kscience.kmath.expressions.Expression
import kscience.kmath.expressions.Symbol
internal class JSBuilder<T>(val bodyCallback: JSBuilder<T>.() -> BaseExpression) {
internal class ESTreeBuilder<T>(val bodyCallback: ESTreeBuilder<T>.() -> BaseExpression) {
private class GeneratedExpression<T>(val executable: dynamic, val constants: Array<dynamic>) : Expression<T> {
@Suppress("UNUSED_VARIABLE")
override fun invoke(arguments: Map<Symbol, T>): T {