Skip to content

Commit

Permalink
sigma-ast: fix ReflectionData
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Aug 27, 2023
1 parent 6d2bb9d commit d0bff03
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
25 changes: 25 additions & 0 deletions core/shared/src/main/scala/sigma/reflection/ReflectionData.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sigma.reflection

import sigma._
import sigma.ast.{SCollectionType, SOption, STuple, SType}
import sigma.data.RType

import scala.collection.compat.immutable.ArraySeq
Expand Down Expand Up @@ -463,4 +464,28 @@ object ReflectionData {
)
)
}

registerClassEntry(classOf[SCollectionType[_]],
constructors = Array(
mkConstructor(Array(classOf[SType])) { args =>
new SCollectionType(args(0).asInstanceOf[SType])
}
)
)

registerClassEntry(classOf[SOption[_]],
constructors = Array(
mkConstructor(Array(classOf[SType])) { args =>
new SOption(args(0).asInstanceOf[SType])
}
)
)

registerClassEntry(classOf[STuple],
constructors = Array(
mkConstructor(Array(classOf[IndexedSeq[_]])) { args =>
new STuple(args(0).asInstanceOf[IndexedSeq[SType]])
}
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,6 @@ object InterpreterReflection {
)
}

registerClassEntry(classOf[SCollectionType[_]],
constructors = Array(
mkConstructor(Array(classOf[SType])) { args =>
new SCollectionType(args(0).asInstanceOf[SType])
}
)
)

{ val clazz = SGlobalMethods.getClass
registerClassEntry(clazz,
methods = Map(
Expand All @@ -402,22 +394,6 @@ object InterpreterReflection {
)
}

registerClassEntry(classOf[SOption[_]],
constructors = Array(
mkConstructor(Array(classOf[SType])) { args =>
new SOption(args(0).asInstanceOf[SType])
}
)
)

registerClassEntry(classOf[STuple],
constructors = Array(
mkConstructor(Array(classOf[IndexedSeq[_]])) { args =>
new STuple(args(0).asInstanceOf[IndexedSeq[SType]])
}
)
)

registerClassEntry(classOf[SigmaAnd],
constructors = Array(
mkConstructor(Array(classOf[Seq[_]])) { args =>
Expand Down

0 comments on commit d0bff03

Please sign in to comment.