TreeTransformScopeInstance

trait TreeTransformScopeInstance[F[_], T](val cpsCtx: TransformationContext[F, T])(implicit evidence$3: Type[F], evidence$4: Type[T], val qctx: Quotes) extends TreeTransformScope[F, T]
trait TreeTransformScope[F, T]
trait AsyncTreeShifter[F, T]
trait MatchTreeTransform[F, T]
trait AwaitTreeTransform[F, T]
trait ApplicationHelper[F, T]
trait ApplyTreeTransform[F, T]
trait RootTreeTransform[F, T]
trait KnownTreeFragments[F, T]
trait CpsTreeScope[F, T]
class Object
trait Matchable
class Any

Type members

Inherited classlikes

case
class AppendCpsTree(frs: CpsTree, snd: CpsTree)

append cps tree, which is frs and then snd. we use this representation instead Mapped/Flatmapped in cases, where we later can apply await to append term and simplify tree instead wrapping awaited tree in extra flatMap

append cps tree, which is frs and then snd. we use this representation instead Mapped/Flatmapped in cases, where we later can apply await to append term and simplify tree instead wrapping awaited tree in extra flatMap

Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class ApplyArgByNameRecord(term: Term, index: Int, cpsTree: CpsTree, shifted: Boolean)
case
class ApplyArgLambdaRecord(term: Term, index: Int, cpsBody: CpsTree, shifted: Boolean, existsLambdaUnshift: Boolean)
case
class ApplyArgNamedRecord(term: NamedArg, name: String, nested: ApplyArgRecord)
case
class ApplyArgNoPrecalcTermRecord(term: Term, index: Int)
case
class ApplyArgPrecalcTermRecord(term: Term, index: Int, termCpsTree: CpsTree, valDef: ValDef, ident: Term)
case
class ApplyArgRepeatRecord(term: Repeated, index: Int, elements: List[ApplyArgRecord], seqTypeTree: TypeTree)
case
class ApplyArgsSummaryPropertiesStep1(hasAsync: Boolean, hasShiftedLambda: Boolean, shouldBeChangedSync: Boolean)
sealed abstract
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class AsyncLambdaCpsTree(originLambda: Term, params: List[ValDef], body: CpsTree, otpe: TypeRepr)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class AwaitAsyncCpsTree(nested: CpsTree, otpe: TypeRepr)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class AwaitSyncCpsTree(origin: Term, otpe: TypeRepr)
Inherited from
CpsTreeScope
Source
CpsTree.scala
object B2
case
class BlockCpsTree(prevs: Queue[Statement], last: CpsTree)
Inherited from
CpsTreeScope
Source
CpsTree.scala
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class BuildApplyArgsAcc(posIndex: Int, paramIndex: Int, wasNamed: Boolean, inRepeat: Boolean, inNamed: Boolean, records: Seq[ApplyArgRecord], filledNamed: Set[Int])
case
class CallChainSubstCpsTree(origin: Term, shifted: Term, otpe: TypeRepr)

when we have swhifted function, which should return F[A] but we want to have in F[A] methods with special meaning, which should be performed on F[_] before jumping into monad (exampe: Iterable.withFilter) we will catch in ApplyTree such methods and substitute to appropriative calls of shifted.

when we have swhifted function, which should return F[A] but we want to have in F[A] methods with special meaning, which should be performed on F[_] before jumping into monad (exampe: Iterable.withFilter) we will catch in ApplyTree such methods and substitute to appropriative calls of shifted.

Inherited from
CpsTreeScope
Source
CpsTree.scala
sealed abstract
class CpsTree
Inherited from
CpsTreeScope
Source
CpsTree.scala
object CpsTree
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class FlatMappedCpsTree(prev: CpsTree, opm: Term => Term, otpe: TypeRepr)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class InlinedBindingsRecord(changes: HashMap[Symbol, InlinedBindingRecord], newBindings: List[Definition], awaitVals: List[ValDef])
case
class InlinedCpsTree(origin: Inlined, bindings: List[Definition], nested: CpsTree)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class InlinedFunBindingRecord(newSym: Symbol, cpsTree: CpsTree, oldValDef: ValDef, newResultType: TypeRepr)
case
class InlinedValBindingRecord(newSym: Symbol, cpsTree: CpsTree, oldValDef: ValDef)
case
class MappedCpsTree(prev: CpsTree, op: Term => Term, otpe: TypeRepr)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class MessageWithPos(message: String, pos: Position)
case
class PureCpsTree(origin: Term, isChanged: Boolean)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class SelectTypeApplyCpsTree(origin: Option[Term], nested: CpsTree, targs: List[TypeTree], selects: List[SelectTypeApplyRecord], otpe: TypeRepr, changed: Boolean)

represent select expression, which can be in monad or outside monad.

represent select expression, which can be in monad or outside monad.

constructor is not devoted to used directly: use SelectTypeApplyCpsTree.create instead. selects is reversed (i.e. external added to head)

Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class SelectTypeApplyRecord(prevTpe: TypeRepr, symbol: Symbol, targs: List[TypeTree], level: Int)
Inherited from
CpsTreeScope
Source
CpsTree.scala
case
class ValCpsTree(valDef: ValDef, rightPart: CpsTree, nested: CpsTree, canBeLambda: Boolean)
Inherited from
CpsTreeScope
Source
CpsTree.scala

Value members

Inherited methods

def asyncShift(t: Term, shiftedSymbols: Set[Symbol]): Term
def asyncShiftCaseDef(cd: CaseDef, shiftedSymbols: Set[Symbol]): CaseDef
def asyncShiftDefinition(t: Definition, shiftedSymbols: Set[Symbol]): Definition
def asyncShiftStatement(t: Statement, shiftedSymbols: Set[Symbol]): Statement
def buildApply(cpsFun: CpsTree, fun: Term, argRecords: Seq[ApplyArgRecord], applyTerm: Term, argsProperties: ApplyArgsSummaryProperties, inShiftedCallChain: Boolean, tails: List[Seq[ApplyArgRecord]]): CpsTree
def buildShiftedApply(cpsFun: CpsTree, fun: Term, argRecords: Seq[ApplyArgRecord], withAsync: Boolean, tails: List[Seq[ApplyArgRecord]], applyTerm: Term): CpsTree
def checkLambdaDef(term: Term): Option[Term]
def exprToTree[T](expr: CpsExpr[F, T], e: Term): CpsTree
def findAsyncShiftTerm(e: Term): (ImplicitSearchResult, TypeRepr)
def handleArgs1(applyTerm: Term, fun: Term, cpsFun: CpsTree, args: List[Term], tails: List[Seq[ApplyArgRecord]], unpure: Boolean): 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 Params
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.
Inherited from
ApplyTreeTransform
Source
ApplyTreeTransform.scala
def handleFun(applyTerm: Term, fun: Term, args: List[Term], tails: List[Seq[ApplyArgRecord]]): CpsTree
def handleFunApply(applyTerm: Term, fun: Term, args: List[Term], fun1: Term, args1: List[Term], tails: List[Seq[ApplyArgRecord]]): CpsTree
def handleFunIdent(applyTerm: Term, fun: Term, args: List[Term], name: String, tails: List[Seq[ApplyArgRecord]]): CpsTree
def handleFunSelect(applyTerm: Term, fun: Term, args: List[Term], obj: Term, methodName: String, tails: List[Seq[ApplyArgRecord]]): CpsTree
def handleFunTypeApply(applyTerm: Term, fun: Term, args: List[Term], obj: Term, targs: List[TypeTree], tails: List[Seq[ApplyArgRecord]]): CpsTree

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

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

Inherited from
ApplyTreeTransform
Source
ApplyTreeTransform.scala
def isInMonad(tpe: TypeRepr): Boolean
def posExpr(t: Term): Expr[Any]
def posExprs(terms: Term*): Expr[Any]
def runApply(applyTerm: Term, fun: Term, args: List[Term], tails: List[Seq[ApplyArgRecord]]): CpsTree

case Apply(fun,args) transform application

case Apply(fun,args) transform application

tails -- list of prepared sequence of curried arguments.

Inherited from
ApplyTreeTransform
Source
ApplyTreeTransform.scala
def runAwait(term: Term, arg: Term, awaitCpsMonadType: TypeRepr, awaitCpsMonad: Term): CpsTree
def runInlined(origin: Inlined): CpsTree
def runLambda(lambdaTerm: Term, params: List[ValDef], expr: Term): CpsTree
def runMatch(matchTerm: Match): CpsTree
def runMyAwait(awaitTerm: Term, arg: Term): CpsTree
def runOtherAwait(awaitTerm: Term, arg: Term, targ: TypeRepr, otherCpsMonad: Term): CpsTree
def runRepeated(repeated: Term, elements: List[Term], tpt: TypeTree): CpsTree
def runRoot(term: Term, muted: Boolean): CpsTree
def runRootUneta(term: Term, muted: Boolean): CpsTree
def runSelect(selectTerm: Select): CpsTree
def runTypeApply(applyTerm: Term, fun: Term, targs: List[TypeTree]): CpsTree
def safeShow(t: Term): String
def sameSelect(funTerm: Term, name: String, targs: List[TypeTree], args: List[Term]): Option[Term]
def shiftedApplyCps(cpsTree: CpsTree, originArgs: List[Term], shiftedArgs: List[Term], shiftedIndexes: Set[Int], shiftedTails: List[List[Term]], applyTerm: Term): CpsTree
def shiftedApplyTerm(term: Term, originArgs: List[Term], shiftedArgs: List[Term], shiftedIndexes: Set[Int]): Term
def shiftedLambdaType(tpe: TypeRepr): TypeRepr
def shiftedLambdaTypeTree(tpt: TypeTree): TypeTree
def shiftedMethodType(paramNames: List[String], paramTypes: List[TypeRepr], otpe: TypeRepr): MethodType
def shiftedResultCpsTree(origin: Term, shifted: Term): CpsTree
def withInlineBindings(origin: Inlined, tree: CpsTree): CpsTree

Concrete fields

Inherited fields

lazy
val awaitPure: Term
lazy
val awaitSymbol: Symbol
lazy
val flatMapSymbol: Symbol
lazy
val mapSymbol: Symbol
lazy
val monadTypeTree: TypeTree
lazy
val objAsyncShift: TypeRepr
lazy
val pureSymbol: Symbol

Extensions

Inherited extensions

extension (otherCake: TreeTransformScope[_[_], _])
def adopt(t: Term): Term
Inherited from
CpsTreeScope
Source
CpsTree.scala
def adoptTerm(t: Term): Term
Inherited from
CpsTreeScope
Source
CpsTree.scala
def adoptTermFun(op: Term => Term): Term => Term
Inherited from
CpsTreeScope
Source
CpsTree.scala
def adoptType(t: TypeRepr): TypeRepr
Inherited from
CpsTreeScope
Source
CpsTree.scala

Implicits

Implicits

implicit override
val qctx: Quotes

Inherited implicits

implicit
val ctType: Type[T]
implicit
val fType: Type[F]