:=: for ref

This commit is contained in:
alari 2018-09-08 23:08:06 +02:00
parent 863f3491cb
commit 577c7a5509
2 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,9 @@ sealed trait InlineExpr[T] extends Expr[T] with Expr.ToInlineVyper {
def :=:(name: Symbol): Free[Expr, Expr.Ref[T]] =
Free.liftF[Expr, Expr.Ref[T]](Expr.Assign[T](Expr.Ref[T](name.name, boxedValue), this))
def :=:(ref: Expr.Ref[T]): Free[Expr, Expr.Ref[T]] =
Free.liftF[Expr, Expr.Ref[T]](Expr.Assign[T](ref, this))
}
object Expr {

View File

@ -51,6 +51,7 @@ object MakeVyperApp extends App {
for {
c 'c :=: `++`(args.ref('a), args.ref('b))
d 'd :=: `++`(args.ref('b), c)
_ d :=: c
sum `++`(args.ref('a), d).toReturn
} yield sum
}
@ -65,5 +66,5 @@ object MakeVyperApp extends App {
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}")
}