From 255c1f61b5d1a0c5af069c2ced56841e69a68464 Mon Sep 17 00:00:00 2001 From: Dima Date: Thu, 20 Jan 2022 07:08:26 +0300 Subject: [PATCH] VarModel -> VarRaw in `collect` functions (#405) --- .scalafmt.conf | 1 + .../scala/aqua/builder/ArgumentGetter.scala | 8 ++++---- cli/.js/src/main/scala/aqua/run/RunOpts.scala | 2 +- cli/.js/src/main/scala/aqua/run/Runner.scala | 18 +++++++++--------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index c2fdf4b9..16e4dbac 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -2,6 +2,7 @@ version = 3.3.1 runner.dialect = scala3 docstrings.style = Asterisk +docstrings.wrap = no maxColumn = 100 diff --git a/cli/.js/src/main/scala/aqua/builder/ArgumentGetter.scala b/cli/.js/src/main/scala/aqua/builder/ArgumentGetter.scala index 66f398d5..4358f92f 100644 --- a/cli/.js/src/main/scala/aqua/builder/ArgumentGetter.scala +++ b/cli/.js/src/main/scala/aqua/builder/ArgumentGetter.scala @@ -5,14 +5,14 @@ import aqua.js.{CallJsFunction, CallServiceHandler, FluencePeer} import aqua.model.{LiteralModel, VarModel} import aqua.raw.ops import aqua.raw.ops.{Call, CallServiceTag} -import aqua.raw.value.LiteralRaw +import aqua.raw.value.{LiteralRaw, VarRaw} import scalajs.js import scala.concurrent.Promise // Service that can return argument to use it from a code -case class ArgumentGetter(serviceId: String, value: VarModel, arg: scalajs.js.Dynamic) - extends ServiceFunction { +case class ArgumentGetter(serviceId: String, value: VarRaw, arg: scalajs.js.Dynamic) + extends ServiceFunction { def registerService(peer: FluencePeer): Unit = { CallJsFunction.registerService( @@ -44,6 +44,6 @@ object ArgumentGetter { val ServiceId = "getDataSrv" - def apply(value: VarModel, arg: scalajs.js.Dynamic): ArgumentGetter = + def apply(value: VarRaw, arg: scalajs.js.Dynamic): ArgumentGetter = ArgumentGetter(ServiceId, value, arg) } diff --git a/cli/.js/src/main/scala/aqua/run/RunOpts.scala b/cli/.js/src/main/scala/aqua/run/RunOpts.scala index ebee6080..ae532879 100644 --- a/cli/.js/src/main/scala/aqua/run/RunOpts.scala +++ b/cli/.js/src/main/scala/aqua/run/RunOpts.scala @@ -126,7 +126,7 @@ object RunOpts extends Logging { args: List[ValueRaw], data: Option[js.Dynamic] ): ValidatedNec[String, Map[String, ArgumentGetter]] = { - val vars = args.collect { case v @ VarModel(_, _, _) => + val vars = args.collect { case v @ VarRaw(_, _, _) => v // one variable could be used multiple times }.distinctBy(_.name) diff --git a/cli/.js/src/main/scala/aqua/run/Runner.scala b/cli/.js/src/main/scala/aqua/run/Runner.scala index ff88cabb..d11453a9 100644 --- a/cli/.js/src/main/scala/aqua/run/Runner.scala +++ b/cli/.js/src/main/scala/aqua/run/Runner.scala @@ -18,11 +18,11 @@ import scala.concurrent.ExecutionContext import scala.scalajs.js class Runner( - funcName: String, - funcCallable: FuncArrow, - args: List[ValueRaw], - config: RunConfig, - transformConfig: TransformConfig + funcName: String, + funcCallable: FuncArrow, + args: List[ValueRaw], + config: RunConfig, + transformConfig: TransformConfig ) { def resultVariableNames(funcCallable: FuncArrow, name: String): List[String] = @@ -54,9 +54,9 @@ class Runner( // Generates air from function, register all services and make a call through FluenceJS private def genAirAndMakeCall[F[_]: Async]( - wrapped: FuncArrow, - consoleService: Console, - finisherService: Finisher + wrapped: FuncArrow, + consoleService: Console, + finisherService: Finisher )(implicit ec: ExecutionContext): F[Unit] = { val funcRes = Transform.funcRes(wrapped, transformConfig) val definitions = FunctionDef(funcRes) @@ -134,7 +134,7 @@ class Runner( val vars = args .zip(funcCallable.arrowType.domain.toList) - .collect { case (VarModel(n, _, _), argType) => + .collect { case (VarRaw(n, _, _), argType) => (n, argType) } .distinctBy(_._1)