mirror of
https://github.com/fluencelabs/hackethberlin
synced 2025-04-24 17:02:18 +00:00
Compile hotfix
This commit is contained in:
parent
fbb4c5eecd
commit
3adf7c3f51
@ -58,6 +58,7 @@ object Expr {
|
||||
boxedValue: T,
|
||||
body: () ⇒ Free[Expr, Void]
|
||||
) extends InlineExpr[T] {
|
||||
|
||||
def bodyVyper: String =
|
||||
body().foldMap(CodeChunk.fromExpr).run._1.toVyper(2)
|
||||
override def toVyper: String = s"$op " + right.toVyper + s":\n$bodyVyper"
|
||||
@ -87,7 +88,10 @@ object Expr {
|
||||
def `:===:`[A <: Type, B <: Type](a: InlineExpr[A], b: InlineExpr[B]): InlineExpr[bool.type] =
|
||||
Infix("==", a, b, bool)
|
||||
|
||||
def `+:+`[A <: timestamp.type, B <: timedelta.type](a: InlineExpr[A], b: InlineExpr[B]): InlineExpr[timestamp.type] =
|
||||
def `+:+`[A <: timestamp.type, B <: timedelta.type](
|
||||
a: InlineExpr[A],
|
||||
b: InlineExpr[B]
|
||||
): InlineExpr[timestamp.type] =
|
||||
Infix("+", a, b, timestamp)
|
||||
|
||||
def `if`(expr: InlineExpr[bool.type], body: () ⇒ Free[Expr, Void]): Free[Expr, Void.type] =
|
||||
@ -110,6 +114,7 @@ object Expr {
|
||||
}
|
||||
|
||||
object Defs extends Defs {
|
||||
|
||||
val predef = ProductType(
|
||||
(Symbol("block.timestamp") ->> timestamp) ::
|
||||
(Symbol("msg.value") ->> wei_value) ::
|
||||
|
@ -7,7 +7,7 @@ import Decorator._
|
||||
import syntax.singleton._
|
||||
import cats.free.Free
|
||||
import fluence.hackethberlin.{Contract, Expr, FuncDef}
|
||||
import fluence.hackethberlin.types.{ProductType, Void, `public`}
|
||||
import fluence.hackethberlin.types.{`public`, ProductType, Void}
|
||||
import shapeless.HNil
|
||||
|
||||
object Auction extends App {
|
||||
|
@ -48,16 +48,17 @@ object MakeVyperApp extends App {
|
||||
import Expr.Defs._
|
||||
|
||||
val f = `@public` @:
|
||||
sumArgs.funcDef("sum", uint256) { args ⇒
|
||||
sumArgs.funcDef("sumSome", uint256) { args ⇒
|
||||
for {
|
||||
c ← 'c :=: `++`(args.ref('a), args.ref('b))
|
||||
_ ← `++`(args.ref('a), args.ref('b))
|
||||
d ← 'd :=: `++`(args.ref('b), c)
|
||||
_ ← d :=: c
|
||||
sum ← `++`(args.ref('a), d).toReturn
|
||||
} yield sum
|
||||
}
|
||||
|
||||
println(f.toVyper)
|
||||
|
||||
val all = recordStruct :: data :: func :: f :: HNil
|
||||
|
||||
val c = new Contract(recordStruct :: struct :: data :: func :: f :: HNil)
|
||||
@ -67,6 +68,5 @@ object MakeVyperApp extends App {
|
||||
println(
|
||||
func(recordStruct.ref('record_address) :: HNil).toVyper
|
||||
)
|
||||
|
||||
// println(s"MMMMMACRO\n\n ${new MyContract("abc", 123).toAST.toVyper}")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user