ApplyTreeTransform

cps.macros.forest.ApplyTreeTransform
See theApplyTreeTransform companion object
trait ApplyTreeTransform[F[_], CT, CC <: CpsMonadContext[F]]

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait TreeTransformScope[F, CT, CC]
Self type
TreeTransformScope[F, CT, CC]

Members list

Value members

Concrete methods

def buildApply(cpsFun: <none>, fun: <none>, argRecords: Seq[<none>], applyTerm: <none>, argsProperties: <none>, inShiftedCallChain: Boolean, tails: List[Seq[<none>]])(owner: <none>): CpsTree
def buildApplyPrependArgsFlatMaps(cpsFun: <none>, fun: <none>, argsRecords: Seq[<none>], applyTerm: <none>, argsProperties: <none>, unpure: Boolean, tails: List[Seq[<none>]])(owner: <none>): CpsTree
def buildShiftedApply(cpsFun: <none>, fun: <none>, argRecords: Seq[<none>], argsProperties: <none>, tails: List[Seq[<none>]], applyTerm: <none>)(owner: <none>): CpsTree
def findAsyncShiftTerm(e: <none>): (ImplicitSearchResult, TypeRepr)
def genCpsDirectDefaultConstructor(tf: <none>, fctx: <none>, posTerm: <none>): Term
def handleArgs1(applyTerm: <none>, fun: <none>, cpsFun: <none>, args: List[<none>], tails: List[Seq[<none>]], unpure: Boolean)(owner: <none>): CpsTree

How to handle arguments? We want keep evaluation order from left to right, so, imagine we have function f(a1,a2,a3) and a2 is async, a1, a3 - sync. we will transform this to

How to handle arguments? We want keep evaluation order from left to right, so, imagine we have function f(a1,a2,a3) and a2 is async, a1, a3 - sync. we will transform this to

{ val arg1 = a1;
  transform(a2).flatMap( x =>
     { val arg2 = x;
       val arg3 = a3;
       f(arg1, arg2, arg3)
}    }

more generally we at first generate block: { arg1 = a1; ..... argN = aN; f(arg1,...argN) } and then transform one, knowing that all arguments to f are sync (of course, if all arguments are sync, we just call f(arg1,... arg2) without all this machinery)

Value parameters

applyTerm

= Apply(fun, args) - origin apply

args
  • first argument list
fun
  • function to apply (with type-paerameters)
tails
  • next argument lists if any
unpure
  • if true, that this is call from shifted substitution, which is already return F[_] by design.

Attributes

def handleBooleanAndOr(applyTerm: <none>, fun: <none>, x: <none>, args: List[<none>])(owner: <none>): CpsTree
def handleFun(applyTerm: <none>, fun: <none>, args: List[<none>], tails: List[Seq[<none>]])(owner: <none>): CpsTree
def handleFunApply(applyTerm: <none>, fun: <none>, args: List[<none>], fun1: <none>, args1: List[<none>], tails: List[Seq[<none>]])(owner: <none>): CpsTree
def handleFunIdent(applyTerm: <none>, fun: <none>, args: List[<none>], name: String, tails: List[Seq[<none>]])(owner: <none>): CpsTree
def handleFunSelect(applyTerm: <none>, fun: <none>, args: List[<none>], obj: <none>, methodName: String, tails: List[Seq[<none>]])(owner: <none>): CpsTree
def handleFunTypeApply(applyTerm: <none>, fun: <none>, args: List[<none>], obj: <none>, targs: List[<none>], tails: List[Seq[<none>]])(owner: <none>): CpsTree

applyTerm = Apply(fun, args) fun = TypeApply(obj,targs)

applyTerm = Apply(fun, args) fun = TypeApply(obj,targs)

Attributes

def isCpsDirectByInclusionCall(arg: <none>, originCPsDirectArg: Option[<none>]): Boolean
def optWrapCallIntoCpsDirect(originApplyTerm: <none>, optCpsDirectArg: Option[<none>], call: <none>, isChanged: Boolean)(owner: <none>): CpsTree
def runApply(applyTerm: <none>, fun: <none>, args: List[<none>], tails: List[Seq[<none>]])(owner: <none>): CpsTree

case Apply(fun,args) transform application

case Apply(fun,args) transform application

tails -- list of prepared sequence of curried arguments.

Attributes

def sameSelect(funTerm: <none>, name: String, targs: List[<none>], args: List[<none>])(owner: <none>): Option[Term]
def shiftedApplyCps(funCpsTree: <none>, argRecords: Seq[<none>], argTails: List[Seq[<none>]], applyTerm: <none>, argsSummaryProperties: <none>)(owner: <none>): CpsTree
def shiftedApplyTerm(funTerm: <none>, argRecords: Seq[<none>], argsSummaryProperties: <none>): PartialShiftedApply
def shiftedLambdaType(tpe: <none>): TypeRepr
def shiftedLambdaTypeTree(tpt: <none>): TypeTree
def shiftedResultCpsTree(origin: <none>, shifted: <none>, optCpsDirectArg: Option[<none>])(owner: <none>): CpsTree
def substituteCpsDirectArg(term: <none>, originCPsDirectArg: <none>, nCpsDirectArg: <none>): Option[Term]
def substituteCpsDirectArgApply(applyTerm: <none>, originCPsDirectArg: <none>, nCpsDirectArg: <none>): Option[Apply]
def substituteCpsDirectArgRequired(term: <none>, originCpsDirectArg: <none>, nCpsDirectArg: <none>): Term
def withInlineBindings(owner: <none>, origin: <none>, tree: <none>): CpsTree
def wrapCallIntoCpsDirect(origin: <none>, cpsDirectArg: <none>, applyCall: <none>)(owner: <none>): CpsTree