Skip to content

Commit 135f6cd

Browse files
committed
Keep inlined nodes until backend phase
Refactoring of inlined nodes to simplify the work on #17055. This work is based on #18229.
1 parent 40d44d3 commit 135f6cd

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import dotty.tools.dotc.core.Contexts._
2525
import dotty.tools.dotc.core.Phases._
2626
import dotty.tools.dotc.core.Decorators.em
2727
import dotty.tools.dotc.report
28+
import dotty.tools.dotc.inlines.Inlines
2829

2930
/*
3031
*
@@ -479,6 +480,10 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
479480
case t: TypeApply => // dotty specific
480481
generatedType = genTypeApply(t)
481482

483+
case inlined @ Inlined(_, _, _) =>
484+
genLoadTo(Inlines.dropInlined(inlined) , expectedType, dest)
485+
generatedDest = dest
486+
482487
case _ => abort(s"Unexpected tree in genLoad: $tree/${tree.getClass} at: ${tree.span}")
483488
}
484489

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import dotty.tools.dotc.transform.sjs.JSSymUtils._
3636

3737
import JSEncoding._
3838
import ScopedVar.withScopedVars
39+
import dotty.tools.dotc.inlines.Inlines
3940

4041
/** Main codegen for Scala.js IR.
4142
*
@@ -1930,6 +1931,9 @@ class JSCodeGen()(using genCtx: Context) {
19301931
case EmptyTree =>
19311932
js.Skip()
19321933

1934+
case inlined @ Inlined(_, _, _) =>
1935+
genStatOrExpr(Inlines.dropInlined(inlined), isStat)
1936+
19331937
case _ =>
19341938
throw new FatalError("Unexpected tree in genExpr: " +
19351939
tree + "/" + tree.getClass + " at: " + (tree.span: Position))

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 =

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Names._
1717
import NameKinds._
1818
import NameOps._
1919
import ast.Trees._
20+
import dotty.tools.dotc.inlines.Inlines
2021

2122
object Mixin {
2223
val name: String = "mixin"
@@ -221,6 +222,7 @@ class Mixin extends MiniPhase with SymTransformer { thisPhase =>
221222
case _ =>
222223
}
223224
(scall, stats ::: inits, args)
225+
case inlined @ Inlined(_, _, _) => transformConstructor(Inlines.dropInlined(inlined) )
224226
case _ =>
225227
val Apply(sel @ Select(New(_), nme.CONSTRUCTOR), args) = tree: @unchecked
226228
val (callArgs, initArgs) = if (tree.symbol.owner.is(Trait)) (Nil, args) else (args, Nil)

0 commit comments

Comments
 (0)