mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
fix: name uniqueness in stream gate (#676)
* fix name uniqueness in gate * fix unit test
This commit is contained in:
parent
75c7135e12
commit
00ee8b5312
@ -19,6 +19,8 @@ trait Backend {
|
||||
|
||||
object Backend {
|
||||
|
||||
val client = "IFluenceClient$$"
|
||||
|
||||
trait Transform extends Backend {
|
||||
def transform(ex: AquaContext): AquaRes
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import aqua.backend.ts.TypeScriptTypes
|
||||
import aqua.backend.*
|
||||
import aqua.res.AquaRes
|
||||
|
||||
case class JavaScriptBackend(isOldFluenceJs: Boolean, client: String) extends Backend {
|
||||
case class JavaScriptBackend(isOldFluenceJs: Boolean, client: String = Backend.client) extends Backend {
|
||||
|
||||
val ext = ".js"
|
||||
val tsExt = ".d.ts"
|
||||
|
@ -4,7 +4,7 @@ import aqua.backend.{Backend, Generated, OutputFile}
|
||||
import aqua.res.AquaRes
|
||||
import cats.data.NonEmptyChain
|
||||
|
||||
case class TypeScriptBackend(isOldFluenceJs: Boolean, client: String) extends Backend {
|
||||
case class TypeScriptBackend(isOldFluenceJs: Boolean, client: String = Backend.client) extends Backend {
|
||||
|
||||
val ext = ".ts"
|
||||
|
||||
|
@ -36,7 +36,7 @@ object AquaCli extends IOApp with Logging {
|
||||
case object AirTarget extends CompileTarget
|
||||
|
||||
def targetToBackend(target: CompileTarget, isOldFluenceJs: Boolean): Backend = {
|
||||
val client = if (isOldFluenceJs) "FluencePeer" else "IFluenceClient$$"
|
||||
val client = if (isOldFluenceJs) "FluencePeer" else Backend.client
|
||||
target match {
|
||||
case TypescriptTarget =>
|
||||
TypeScriptBackend(isOldFluenceJs, client)
|
||||
|
@ -130,7 +130,7 @@ class AquaCompilerSpec extends AnyFlatSpec with Matchers {
|
||||
|
||||
private def join(vm: VarModel, length: ValueModel) = {
|
||||
val testVM = VarModel(vm.name + "_test", vm.`type`)
|
||||
val iter = VarModel("s", ScalarType.string)
|
||||
val iter = VarModel(vm.name + "_fold_var", ScalarType.string)
|
||||
val canon = VarModel(vm.name + "_iter_canon", CanonStreamType(ScalarType.string))
|
||||
val canonRes = VarModel(vm.name + "_result_canon", CanonStreamType(ScalarType.string))
|
||||
val arrayRes = VarModel(vm.name + "_gate", ArrayType(ScalarType.string))
|
||||
|
@ -23,11 +23,12 @@ object ApplyGateRawInliner extends RawInliner[ApplyGateRaw] with Logging {
|
||||
uniqueTestName <- Mangler[S].findAndForbidName(afr.name + "_test")
|
||||
uniqueIdxIncr <- Mangler[S].findAndForbidName(afr.name + "_incr")
|
||||
uniqueIterCanon <- Mangler[S].findAndForbidName(afr.name + "_iter_canon")
|
||||
uniqueIter <- Mangler[S].findAndForbidName(afr.name + "_fold_var")
|
||||
idxFolded <- unfold(afr.idx)
|
||||
(idxModel, idxInline) = idxFolded
|
||||
} yield {
|
||||
val varSTest = VarModel(uniqueTestName, afr.streamType)
|
||||
val iter = VarModel("s", afr.streamType.element)
|
||||
val iter = VarModel(uniqueIter, afr.streamType.element)
|
||||
|
||||
val iterCanon = VarModel(uniqueIterCanon, CanonStreamType(afr.streamType.element))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user