Skip to content

Commit 3e18e2c

Browse files
committed
Keep Inlined nodes until BCode builder
1 parent 8c7c7c8 commit 3e18e2c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
479479
case t: TypeApply => // dotty specific
480480
generatedType = genTypeApply(t)
481481

482+
case inlined @ Inlined(call, bindings, expansion) =>
483+
if(bindings.isEmpty)
484+
genLoadTo(expansion, expectedType, dest)
485+
else
486+
genInlinedTo(inlined, expectedType, dest)
487+
generatedDest = dest
488+
482489
case _ => abort(s"Unexpected tree in genLoad: $tree/${tree.getClass} at: ${tree.span}")
483490
}
484491

@@ -1090,6 +1097,17 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10901097
varsInScope = savedScope
10911098
}
10921099

1100+
def genInlinedTo(tree: Inlined, expectedType: BType, dest: LoadDestination): Unit = tree match {
1101+
case Inlined(call, bindings, expansion) =>
1102+
1103+
val savedScope = varsInScope
1104+
varsInScope = Nil
1105+
bindings foreach genStat
1106+
genLoadTo(expansion, expectedType, dest)
1107+
emitLocalVarScopes()
1108+
varsInScope = savedScope
1109+
}
1110+
10931111
/** Add entries to the `LocalVariableTable` JVM attribute for all the vars in
10941112
* `varsInScope`, ending at the current program point.
10951113
*/

compiler/src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ object Erasure {
897897

898898
override def typedInlined(tree: untpd.Inlined, pt: Type)(using Context): Tree =
899899
super.typedInlined(tree, pt) match {
900-
case tree: Inlined => Inlines.dropInlined(tree)
900+
case tree: Inlined => tree //Inlines.dropInlined(tree)
901901
}
902902

903903
override def typedValDef(vdef: untpd.ValDef, sym: Symbol)(using Context): Tree =

0 commit comments

Comments
 (0)