This commit is contained in:
DieMyst 2023-04-19 14:04:27 +04:00
parent 5f00b1ea8d
commit 95bbe8ed73
3 changed files with 14 additions and 9 deletions

View File

@ -1,10 +1,7 @@
func returnCall() -> string -> string:
closure = (s: string) -> string:
<- s
closure("123asdf")
<- closure
service Op("op"):
noop()
func test() -> string:
a = returnCall()
b = a("arg")
<- b
func test():
a:*string
on a[0] via a[1]:
Op.noop()

View File

@ -50,11 +50,16 @@ object ArrowInliner extends Logging {
// Now, substitute the arrows that were received as function arguments
// Use the new op tree (args are replaced with values, names are unique & safe)
callableFuncBodyNoTopology <- TagInliner.handleTree(tree, fn.funcName)
_ = println("func no topology: " + callableFuncBodyNoTopology.show)
callableFuncBody =
fn.capturedTopology
.fold[OpModel](SeqModel)(ApplyTopologyModel.apply)
.wrap(callableFuncBodyNoTopology)
_ = println("func topology: " + callableFuncBody.show)
// Fix return values with exports collected in the body
resolvedResult <- RawValueInliner.valueListToModel(result)
// Fix the return values
@ -196,6 +201,7 @@ object ArrowInliner extends Logging {
for {
_ <- Arrows[S].resolved(passArrows)
av <- ArrowInliner.inline(arrow, call)
_ = println("after inlining: " + av._1.show)
// find and get resolved arrows if we return them from the function
returnedArrows = av._2.collect { case VarModel(name, ArrowType(_, _), _) =>
name

View File

@ -68,6 +68,8 @@ object Transform extends Logging {
// Resolve the topology, clear the resulting tree
val resultingTree = preparedFunc.flatMap(tree => Topology.resolve(tree).map(clear(_)))
println("resultingTree: " + resultingTree.value.show)
resultingTree.map(res =>
FuncRes(
func.funcName,