Skip to content

Commit 2ed6914

Browse files
committed
Reorder pattern match based on frequency
1 parent af528a1 commit 2ed6914

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,6 @@ object TreeTransforms {
974974
val qual = transform(tree.qualifier, mutatedInfo, cur)
975975
goSelect(cpy.Select(tree)(qual, tree.name), mutatedInfo.nx.nxTransSelect(cur))
976976
}
977-
case tree: Bind =>
978-
implicit val mutatedInfo: TransformerInfo = mutateTransformers(info, prepForBind, info.nx.nxPrepBind, tree, cur)
979-
if (mutatedInfo eq null) tree
980-
else {
981-
val body = transform(tree.body, mutatedInfo, cur)
982-
goBind(cpy.Bind(tree)(tree.name, body), mutatedInfo.nx.nxTransBind(cur))
983-
}
984977
case tree: ValDef if !tree.isEmpty => // As a result of discussing with Martin: emptyValDefs shouldn't be copied // NAME
985978
implicit val mutatedInfo: TransformerInfo = mutateTransformers(info, prepForValDef, info.nx.nxPrepValDef, tree, cur)
986979
if (mutatedInfo eq null) tree
@@ -1008,6 +1001,13 @@ object TreeTransforms {
10081001
val rhs = transform(tree.rhs, mutatedInfo, cur)(localContext(tree.symbol))
10091002
goTypeDef(cpy.TypeDef(tree)(tree.name, rhs), mutatedInfo.nx.nxTransTypeDef(cur))
10101003
}
1004+
case tree: Bind =>
1005+
implicit val mutatedInfo: TransformerInfo = mutateTransformers(info, prepForBind, info.nx.nxPrepBind, tree, cur)
1006+
if (mutatedInfo eq null) tree
1007+
else {
1008+
val body = transform(tree.body, mutatedInfo, cur)
1009+
goBind(cpy.Bind(tree)(tree.name, body), mutatedInfo.nx.nxTransBind(cur))
1010+
}
10111011
case _ =>
10121012
tree
10131013
}

0 commit comments

Comments
 (0)