Skip to content

Commit 409c66c

Browse files
committed
Added JS Inlined code gen and simplified JVM Inlined BCode gen
1 parent 69b2b23 commit 409c66c

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
480480
generatedType = genTypeApply(t)
481481

482482
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
483+
genLoadTo(Block(bindings, expansion), expectedType, dest)
488484

489485
case _ => abort(s"Unexpected tree in genLoad: $tree/${tree.getClass} at: ${tree.span}")
490486
}
@@ -1097,17 +1093,6 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10971093
varsInScope = savedScope
10981094
}
10991095

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-
11111096
/** Add entries to the `LocalVariableTable` JVM attribute for all the vars in
11121097
* `varsInScope`, ending at the current program point.
11131098
*/

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,9 @@ class JSCodeGen()(using genCtx: Context) {
19301930
case EmptyTree =>
19311931
js.Skip()
19321932

1933+
case Inlined(call, bindings, expansion) =>
1934+
genStatOrExpr(Block(bindings, expansion), isStat)
1935+
19331936
case _ =>
19341937
throw new FatalError("Unexpected tree in genExpr: " +
19351938
tree + "/" + tree.getClass + " at: " + (tree.span: Position))

0 commit comments

Comments
 (0)