Skip to content

Commit 241122e

Browse files
committed
Store post-typer transformed trees in defTree
1 parent 4118884 commit 241122e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
101101
private def transformAnnot(annot: Annotation)(implicit ctx: Context): Annotation =
102102
annot.derivedAnnotation(transformAnnot(annot.tree))
103103

104-
private def transformMemberDef(tree: MemberDef)(implicit ctx: Context): Unit = {
104+
private def processMemberDef(tree: Tree)(implicit ctx: Context): tree.type = {
105105
val sym = tree.symbol
106106
sym.registerIfChild()
107107
sym.transformAnnotations(transformAnnot)
108108
sym.defTree = tree
109+
tree
109110
}
110111

111112
private def transformSelect(tree: Select, targs: List[Tree])(implicit ctx: Context): Tree = {
@@ -257,14 +258,11 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
257258
}
258259
case tree: ValDef =>
259260
val tree1 = cpy.ValDef(tree)(rhs = normalizeErasedRhs(tree.rhs, tree.symbol))
260-
transformMemberDef(tree1)
261-
super.transform(tree1)
261+
processMemberDef(super.transform(tree1))
262262
case tree: DefDef =>
263263
val tree1 = cpy.DefDef(tree)(rhs = normalizeErasedRhs(tree.rhs, tree.symbol))
264-
transformMemberDef(tree1)
265-
superAcc.wrapDefDef(tree1)(super.transform(tree1).asInstanceOf[DefDef])
264+
processMemberDef(superAcc.wrapDefDef(tree1)(super.transform(tree1).asInstanceOf[DefDef]))
266265
case tree: TypeDef =>
267-
transformMemberDef(tree)
268266
val sym = tree.symbol
269267
if (sym.isClass) {
270268
// Add SourceFile annotation to top-level classes
@@ -274,7 +272,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
274272
sym.addAnnotation(Annotation.makeSourceFile(ctx.compilationUnit.source.file.path))
275273
tree
276274
}
277-
super.transform(tree)
275+
processMemberDef(super.transform(tree))
278276
case tree: New if isCheckable(tree) =>
279277
Checking.checkInstantiable(tree.tpe, tree.pos)
280278
super.transform(tree)

0 commit comments

Comments
 (0)