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

View File

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

View File

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