mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
fix(aqua-api): Add default constants to Aqua API [LNG-194] (#738)
This commit is contained in:
parent
62b16426de
commit
5f5fc494b6
@ -139,8 +139,8 @@ object APICompilation {
|
||||
|
||||
LogFormatter.initLogger(Some(level))
|
||||
|
||||
val config = AquaCompilerConf(constants)
|
||||
val transformConfig = aquaConfig.getTransformConfig
|
||||
val config = AquaCompilerConf(constants ++ transformConfig.constantsList)
|
||||
|
||||
CompilerAPI
|
||||
.compile[IO, AquaFileError, FileModuleId, FileSpan.F](
|
||||
|
@ -7,4 +7,4 @@ import aqua.raw.ConstantRaw
|
||||
*
|
||||
* @param constantsList List of known constants
|
||||
*/
|
||||
case class AquaCompilerConf(constantsList: List[ConstantRaw] = ConstantRaw.defaultConstants(None))
|
||||
case class AquaCompilerConf(constantsList: List[ConstantRaw])
|
@ -1,14 +1,6 @@
|
||||
package aqua.compiler
|
||||
|
||||
import aqua.model.{
|
||||
CallModel,
|
||||
ForModel,
|
||||
FunctorModel,
|
||||
IntoIndexModel,
|
||||
LiteralModel,
|
||||
ValueModel,
|
||||
VarModel
|
||||
}
|
||||
import aqua.model.{CallModel, ForModel, FunctorModel, IntoIndexModel, LiteralModel, ValueModel, VarModel}
|
||||
import aqua.model.transform.TransformConfig
|
||||
import aqua.model.transform.Transform
|
||||
import aqua.parser.ParserError
|
||||
@ -16,21 +8,9 @@ import aqua.parser.Ast
|
||||
import aqua.parser.Parser
|
||||
import aqua.parser.lift.Span
|
||||
import aqua.parser.lift.Span.S
|
||||
import aqua.raw.ConstantRaw
|
||||
import aqua.raw.value.{LiteralRaw, ValueRaw, VarRaw}
|
||||
import aqua.res.{
|
||||
ApRes,
|
||||
CallRes,
|
||||
CallServiceRes,
|
||||
CanonRes,
|
||||
FoldRes,
|
||||
MakeRes,
|
||||
MatchMismatchRes,
|
||||
NextRes,
|
||||
ParRes,
|
||||
RestrictionRes,
|
||||
SeqRes,
|
||||
XorRes
|
||||
}
|
||||
import aqua.res.{ApRes, CallRes, CallServiceRes, CanonRes, FoldRes, MakeRes, MatchMismatchRes, NextRes, ParRes, RestrictionRes, SeqRes, XorRes}
|
||||
import aqua.types.{ArrayType, CanonStreamType, LiteralType, ScalarType, StreamType, Type}
|
||||
import org.scalatest.flatspec.AnyFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
@ -64,7 +44,7 @@ class AquaCompilerSpec extends AnyFlatSpec with Matchers {
|
||||
.compileToContext[Id, String, String, Span.S](
|
||||
aquaSource(src, imports),
|
||||
id => txt => Parser.parse(Parser.parserSchema)(txt),
|
||||
AquaCompilerConf()
|
||||
AquaCompilerConf(ConstantRaw.defaultConstants(None))
|
||||
)
|
||||
|
||||
"aqua compiler" should "compile a simple snipped to the right context" in {
|
||||
|
@ -7,6 +7,7 @@ import aqua.parser.lexer.{LiteralToken, Token}
|
||||
import aqua.parser.lift.FileSpan.F
|
||||
import aqua.parser.lift.{FileSpan, Span}
|
||||
import aqua.parser.{ArrowReturnError, BlockIndentError, LexerError, ParserError}
|
||||
import aqua.raw.ConstantRaw
|
||||
import aqua.semantics.{HeaderError, RulesViolated, WrongAST}
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
import cats.data.Validated.{Invalid, Valid, invalidNec, validNec}
|
||||
@ -137,7 +138,7 @@ object AquaLSP extends App with Logging {
|
||||
val path = Path(pathStr)
|
||||
val pathId = FileModuleId(path)
|
||||
val sources = new AquaFileSources[IO](path, imports.toList.map(Path.apply))
|
||||
val config = AquaCompilerConf()
|
||||
val config = AquaCompilerConf(ConstantRaw.defaultConstants(None))
|
||||
|
||||
val proc = for {
|
||||
|
||||
|
@ -5,6 +5,7 @@ import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
|
||||
import aqua.io.AquaFileError
|
||||
import aqua.lsp.LSPCompiler
|
||||
import aqua.parser.lift.FileSpan
|
||||
import aqua.raw.ConstantRaw
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
import cats.data.Validated
|
||||
import cats.effect.{IO, IOApp, Sync}
|
||||
@ -18,7 +19,7 @@ object Test extends IOApp.Simple {
|
||||
override def run: IO[Unit] = {
|
||||
|
||||
val sources = new AquaFileSources[IO](Path("./aqua-src/antithesis.aqua"), List(Path("./aqua")))
|
||||
val config = AquaCompilerConf()
|
||||
val config = AquaCompilerConf(ConstantRaw.defaultConstants(None))
|
||||
|
||||
for {
|
||||
start <- IO(System.currentTimeMillis())
|
||||
|
Loading…
Reference in New Issue
Block a user