== myRun == inline fun myRun(block: () -> T): T { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } --------------------- : {<: () -> T} NEW: magic[FAKE_INITIALIZER](block: () -> T) -> { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } : {<: ContractBuilder.() -> Unit} NEW: r({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) -> contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } : * NEW: call(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }, contract|) -> block : {<: () -> T} NEW: r(block) -> block() : {<: T} NEW: call(block(), invoke|) -> return block() !: * { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } !: * COPY ===================== == anonymous_0 == { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } --------------------- : {<: ContractBuilder} NEW: magic[IMPLICIT_RECEIVER](callsInPlace(block, InvocationKind.EXACTLY_ONCE)) -> block : {<: Function} NEW: r(block) -> EXACTLY_ONCE : {<: InvocationKind} NEW: r(EXACTLY_ONCE) -> InvocationKind.EXACTLY_ONCE : {<: InvocationKind} COPY callsInPlace(block, InvocationKind.EXACTLY_ONCE) : * NEW: call(callsInPlace(block, InvocationKind.EXACTLY_ONCE), callsInPlace|, , ) -> callsInPlace(block, InvocationKind.EXACTLY_ONCE) : * COPY ===================== == getBoolean == fun getBoolean(): Boolean = false --------------------- false : Boolean NEW: r(false) -> ===================== == test == fun test() { val x: Int if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 } x.inc() } --------------------- getBoolean() : Boolean NEW: call(getBoolean(), getBoolean) -> { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } : {<: () -> Unit} NEW: r({ while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }) -> myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } : * NEW: call(myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }, myRun|) -> { x = 42 } : {<: () -> Unit} NEW: r({ x = 42 }) -> myRun { x = 42 } : * NEW: call(myRun { x = 42 }, myRun|) -> if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 } : * NEW: merge(if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 }|, ) -> x : Int NEW: r(x) -> inc() : * NEW: call(inc(), inc|) -> x.inc() : * COPY { val x: Int if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 } x.inc() } : * COPY ===================== == inlined anonymous_1 == { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } --------------------- getBoolean() : Boolean NEW: call(getBoolean(), getBoolean) -> { if (getBoolean()) { x = 42 } else { x = 43 } } : {<: () -> Unit} NEW: r({ if (getBoolean()) { x = 42 } else { x = 43 } }) -> myRun { if (getBoolean()) { x = 42 } else { x = 43 } } : * NEW: call(myRun { if (getBoolean()) { x = 42 } else { x = 43 } }, myRun|) -> break !: * { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } !: * COPY getBoolean() : Boolean NEW: call(getBoolean(), getBoolean) -> { x.inc() } : {<: () -> Int} NEW: r({ x.inc() }) -> myRun { x.inc() } : * NEW: call(myRun { x.inc() }, myRun|) -> { x = 42 } : {<: () -> Unit} NEW: r({ x = 42 }) -> myRun { x = 42 } : * NEW: call(myRun { x = 42 }, myRun|) -> break !: * { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } !: * COPY 42 : Int NEW: r(42) -> x = 42 !: * while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 !: * COPY ===================== == inlined anonymous_2 == { if (getBoolean()) { x = 42 } else { x = 43 } } --------------------- getBoolean() : Boolean NEW: call(getBoolean(), getBoolean) -> 42 : Int NEW: r(42) -> x = 42 !: * { x = 42 } !: * COPY 43 : Int NEW: r(43) -> x = 43 !: * { x = 43 } !: * COPY if (getBoolean()) { x = 42 } else { x = 43 } : * NEW: merge(if (getBoolean()) { x = 42 } else { x = 43 }|!, !) -> if (getBoolean()) { x = 42 } else { x = 43 } : * COPY ===================== == inlined anonymous_3 == { x.inc() } --------------------- x : Int NEW: r(x) -> inc() : Int NEW: call(inc(), inc|) -> x.inc() : Int COPY x.inc() : Int COPY ===================== == inlined anonymous_4 == { x = 42 } --------------------- 42 : Int NEW: r(42) -> x = 42 !: * x = 42 !: * COPY ===================== == inlined anonymous_5 == { x = 42 } --------------------- 42 : Int NEW: r(42) -> x = 42 !: * x = 42 !: * COPY =====================