Skip to content

Commit e126a88

Browse files
committed
Map subexpressions in classes
1 parent 69f4285 commit e126a88

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

library/src-bootstrapped/scala/quoted/util/ExprMap.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ trait ExprMap {
3737
case tree: TypeDef =>
3838
tree
3939
case tree: ClassDef =>
40-
ClassDef.copy(tree)(tree.name, tree.constructor, tree.parents, tree.derived, tree.self, tree.body)
40+
val newBody = transformStats(tree.body)
41+
ClassDef.copy(tree)(tree.name, tree.constructor, tree.parents, tree.derived, tree.self, newBody)
4142
}
4243
}
4344

tests/run-macros/expr-map-1.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ adbmal
2424
ravsgra
2525
hctam
2626
def
27+
ooF wen

tests/run-macros/expr-map-1/Test_2.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ object Test {
115115
println(s)
116116
}
117117

118+
rewrite {
119+
class Foo {
120+
println("new Foo")
121+
}
122+
new Foo
123+
}
124+
125+
118126
}
119127

120128
}

0 commit comments

Comments
 (0)