Skip to content

Commit 053a3fd

Browse files
Make function to inline just rhs
1 parent d7cf307 commit 053a3fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/inlines/Inlines.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,14 @@ object Inlines:
684684

685685
private def inlinedRhs(vddef: ValOrDefDef, inlinedSym: Symbol)(using Context): Tree =
686686
val rhs = vddef.rhs.changeOwner(vddef.symbol, inlinedSym)
687+
inlinedRhs(rhs)(using ctx.withOwner(inlinedSym))
688+
689+
private def inlinedRhs(rhs: Tree)(using Context): Tree =
687690
if rhs.isEmpty then
688691
rhs
689692
else
690-
val inlinedRhs = inContext(ctx.withOwner(inlinedSym)) { inlined(rhs)._2 }
691-
Inlined(tpd.ref(parentSym), Nil, inlinedRhs).withSpan(parent.span)
693+
// TODO make version of inlined that does not return bindings?
694+
Inlined(tpd.ref(parentSym), Nil, inlined(rhs)._2).withSpan(parent.span)
692695

693696
private class ParamAccessorsMapper:
694697
private val paramAccessorsTrees: mutable.Map[Symbol, Map[Name, Tree]] = mutable.Map.empty

0 commit comments

Comments
 (0)