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