mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 16:57:40 +03:00
LF: clarify compilation of choice body. (#11195)
* LF: clarify compilation of choice Body. This is a purely cosmetic choice. We move up the intro of the choice arg binder to make it clear it affect the compilation of every expression in the body of a choices ( namely controllers, observers, and update expression). CHANGELOG_BEGIN CHANGELOG_END * formatting
This commit is contained in:
parent
d8651fae32
commit
4af98a63a2
@ -991,24 +991,22 @@ private[lf] final class Compiler(
|
||||
cidPos: Position,
|
||||
mbKey: Option[Position], // defined for byKey operation
|
||||
tokenPos: Position,
|
||||
) = {
|
||||
) = withEnv { _ =>
|
||||
let(
|
||||
SBUFetch(
|
||||
tmplId
|
||||
)(svar(cidPos), mbKey.fold(SEValue.None: SExpr)(pos => SBSome(svar(pos))))
|
||||
) { tmplArgPos =>
|
||||
addExprVar(tmpl.param, tmplArgPos)
|
||||
addExprVar(choice.argBinder._1, choiceArgPos)
|
||||
let(
|
||||
SBUBeginExercise(tmplId, choice.name, choice.consuming, byKey = mbKey.isDefined)(
|
||||
svar(choiceArgPos),
|
||||
svar(cidPos), {
|
||||
addExprVar(choice.argBinder._1, choiceArgPos)
|
||||
compile(choice.controllers)
|
||||
}, {
|
||||
choice.choiceObservers match {
|
||||
case Some(observers) => compile(observers)
|
||||
case None => SEValue.EmptyList
|
||||
}
|
||||
svar(cidPos),
|
||||
compile(choice.controllers),
|
||||
choice.choiceObservers match {
|
||||
case Some(observers) => compile(observers)
|
||||
case None => SEValue.EmptyList
|
||||
},
|
||||
)
|
||||
) { _ =>
|
||||
|
Loading…
Reference in New Issue
Block a user