|
1 | 1 | package sigma.compiler.ir |
2 | 2 |
|
3 | 3 | import org.ergoplatform._ |
4 | | -import sigma.ast.SType.tT |
5 | | -import sigma.{SigmaException, VersionContext, ast} |
6 | 4 | import sigma.Evaluation.stypeToRType |
| 5 | +import sigma.SigmaException |
| 6 | +import sigma.VersionContext |
| 7 | +import sigma.ast.{Ident, Select, Val} |
7 | 8 | import sigma.ast.SType.tT |
8 | | -import sigma.{SigmaException, VersionContext, ast} |
9 | 9 | import sigma.ast.TypeCodes.LastConstantCode |
10 | 10 | import sigma.ast.Value.Typed |
11 | 11 | import sigma.ast.syntax.{SValue, ValueOps} |
12 | 12 | import sigma.ast._ |
13 | 13 | import sigma.compiler.ir.core.MutableLazy |
14 | 14 | import sigma.crypto.EcPointType |
15 | | -import sigma.VersionContext |
16 | 15 | import sigma.data.ExactIntegral.{ByteIsExactIntegral, IntIsExactIntegral, LongIsExactIntegral, ShortIsExactIntegral} |
17 | 16 | import sigma.data.ExactOrdering.{ByteIsExactOrdering, IntIsExactOrdering, LongIsExactOrdering, ShortIsExactOrdering} |
18 | 17 | import sigma.data.{CSigmaDslBuilder, ExactIntegral, ExactNumeric, ExactOrdering, Lazy, Nullable} |
19 | | -import sigma.util.Extensions.ByteOps |
20 | | -import sigmastate.interpreter.Interpreter.ScriptEnv |
21 | | -import sigma.ast.{Ident, Select, Val} |
22 | 18 | import sigma.data.UnsignedBigIntNumericOps.{UnsignedBigIntIsExactIntegral, UnsignedBigIntIsExactOrdering} |
23 | 19 | import sigma.exceptions.GraphBuildingException |
24 | 20 | import sigma.serialization.OpCodes |
25 | | -import sigma.{SigmaException, ast} |
26 | | -import sigma.VersionContext |
| 21 | +import sigma.util.Extensions.ByteOps |
| 22 | +import sigmastate.interpreter.Interpreter.ScriptEnv |
27 | 23 |
|
28 | 24 | import scala.collection.mutable.ArrayBuffer |
29 | 25 | import scala.language.{existentials,implicitConversions} |
@@ -265,6 +261,7 @@ trait GraphBuilding extends Base with DefRewriting { IR: IRContext => |
265 | 261 | case SLong => LongElement |
266 | 262 | case SString => StringElement |
267 | 263 | case SAny => AnyElement |
| 264 | + case SUnit => UnitElement |
268 | 265 | case SBigInt => bigIntElement |
269 | 266 | case SUnsignedBigInt => unsignedBigIntElement |
270 | 267 | case SBox => boxElement |
@@ -292,6 +289,7 @@ trait GraphBuilding extends Base with DefRewriting { IR: IRContext => |
292 | 289 | case LongElement => SLong |
293 | 290 | case StringElement => SString |
294 | 291 | case AnyElement => SAny |
| 292 | + case UnitElement => SUnit |
295 | 293 | case _: BigIntElem[_] => SBigInt |
296 | 294 | case _: UnsignedBigIntElem[_] => SUnsignedBigInt |
297 | 295 | case _: GroupElementElem[_] => SGroupElement |
@@ -513,10 +511,10 @@ trait GraphBuilding extends Base with DefRewriting { IR: IRContext => |
513 | 511 | case Ident(n, _) => |
514 | 512 | env.getOrElse(n, !!!(s"Variable $n not found in environment $env")) |
515 | 513 |
|
516 | | - case ast.Upcast(Constant(value, _), toTpe: SNumericType) => |
| 514 | + case sigma.ast.Upcast(Constant(value, _), toTpe: SNumericType) => |
517 | 515 | eval(mkConstant(toTpe.upcast(value.asInstanceOf[AnyVal]), toTpe)) |
518 | 516 |
|
519 | | - case ast.Downcast(Constant(value, _), toTpe: SNumericType) => |
| 517 | + case sigma.ast.Downcast(Constant(value, _), toTpe: SNumericType) => |
520 | 518 | eval(mkConstant(toTpe.downcast(value.asInstanceOf[AnyVal]), toTpe)) |
521 | 519 |
|
522 | 520 | // Rule: col.size --> SizeOf(col) |
@@ -743,7 +741,7 @@ trait GraphBuilding extends Base with DefRewriting { IR: IRContext => |
743 | 741 | val res = sigmaDslBuilder.sha256(inputV) |
744 | 742 | res |
745 | 743 |
|
746 | | - case ast.SizeOf(In(xs)) => |
| 744 | + case SizeOf(In(xs)) => |
747 | 745 | xs.elem.asInstanceOf[Any] match { |
748 | 746 | case _: CollElem[a,_] => |
749 | 747 | val xsV = asRep[Coll[a]](xs) |
@@ -937,11 +935,11 @@ trait GraphBuilding extends Base with DefRewriting { IR: IRContext => |
937 | 935 | val values = colBuilder.fromItems(vs: _*)(eAny) |
938 | 936 | values |
939 | 937 |
|
940 | | - case ast.Upcast(In(input), tpe) => |
| 938 | + case sigma.ast.Upcast(In(input), tpe) => |
941 | 939 | val elem = stypeToElem(tpe.asNumType) |
942 | 940 | upcast(input)(elem) |
943 | 941 |
|
944 | | - case ast.Downcast(In(input), tpe) => |
| 942 | + case sigma.ast.Downcast(In(input), tpe) => |
945 | 943 | val elem = stypeToElem(tpe.asNumType) |
946 | 944 | downcast(input)(elem) |
947 | 945 |
|
|
0 commit comments