Skip to content

Commit 2a264a8

Browse files
committed
Add comments
1 parent 8fda2e3 commit 2a264a8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

library/src-bootstrapped/scala/runtime/quoted/Matcher.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ object Matcher {
3838
case (Block(Nil, expr), _) => treeMatches(expr, pattern)
3939
case (_, Block(Nil, pat)) => treeMatches(scrutinee, pat)
4040

41-
// Match
41+
// Match a scala.internal.Quoted.patternHole and return the scrutinee tree
4242
case (IsTerm(scrutinee), TypeApply(patternHole, tpt :: Nil))
4343
if patternHole.symbol == kernel.Definitions_InternalQuoted_patternHole && scrutinee.tpe <:< tpt.tpe =>
4444
Some(Tuple1(scrutinee.seal))
4545

46-
case (Inlined(_, Nil, scr), _) =>
47-
treeMatches(scr, pattern)
48-
case (_, Inlined(_, Nil, pat)) =>
49-
treeMatches(scrutinee, pat)
46+
// Normalize inline trees
47+
case (Inlined(_, Nil, scr), _) => treeMatches(scr, pattern)
48+
case (_, Inlined(_, Nil, pat)) => treeMatches(scrutinee, pat)
49+
50+
//
51+
// Match two equivalent trees
52+
//
5053

5154
case (Literal(constant1), Literal(constant2)) if constant1 == constant2 =>
5255
Some(())
@@ -150,6 +153,7 @@ object Matcher {
150153
val finalizerMatch = treeOptMatches(finalizer1, finalizer2)
151154
foldMatchings(bodyMacth, casesMatch, finalizerMatch)
152155

156+
// No Match
153157
case _ =>
154158
if (debug)
155159
println(

0 commit comments

Comments
 (0)