Skip to content

Commit f21556d

Browse files
committed
Remove Context from Matcher
1 parent 1cd2faf commit f21556d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ object Matcher {
128128

129129
// TODO improve performance
130130

131-
// TODO use flag from qctx.tasty.rootContext. Maybe -debug or add -debug-macros
131+
// TODO use flag from qctx.tasty. Maybe -debug or add -debug-macros
132132
private final val debug = false
133133

134134
import qctx.tasty._
@@ -203,7 +203,7 @@ object Matcher {
203203

204204
extension (scrutinees: List[Tree]):
205205
/** Check that all trees match with =?= and concatenate the results with &&& */
206-
private def =?= (patterns: List[Tree])(using Context, Env): Matching =
206+
private def =?= (patterns: List[Tree])(using Env): Matching =
207207
matchLists(scrutinees, patterns)(_ =?= _)
208208

209209
extension (scrutinee0: Tree):
@@ -215,7 +215,7 @@ object Matcher {
215215
* @param `summon[Env]` Set of tuples containing pairs of symbols (s, p) where s defines a symbol in `scrutinee` which corresponds to symbol p in `pattern`.
216216
* @return `None` if it did not match or `Some(tup: Tuple)` if it matched where `tup` contains the contents of the holes.
217217
*/
218-
private def =?= (pattern0: Tree)(using Context, Env): Matching = {
218+
private def =?= (pattern0: Tree)(using Env): Matching = {
219219

220220
/* Match block flattening */ // TODO move to cases
221221
/** Normalize the tree */
@@ -374,7 +374,7 @@ object Matcher {
374374
/* Match val */
375375
case (ValDef(_, tpt1, rhs1), ValDef(_, tpt2, rhs2)) if checkValFlags() =>
376376
def rhsEnv = summon[Env] + (scrutinee.symbol -> pattern.symbol)
377-
tpt1 =?= tpt2 &&& treeOptMatches(rhs1, rhs2)(using summon[Context], rhsEnv)
377+
tpt1 =?= tpt2 &&& treeOptMatches(rhs1, rhs2)(using rhsEnv)
378378

379379
/* Match def */
380380
case (DefDef(_, typeParams1, paramss1, tpt1, Some(rhs1)), DefDef(_, typeParams2, paramss2, tpt2, Some(rhs2))) =>
@@ -423,11 +423,11 @@ object Matcher {
423423

424424
private object ClosedPatternTerm {
425425
/** Matches a term that does not contain free variables defined in the pattern (i.e. not defined in `Env`) */
426-
def unapply(term: Term)(using Context, Env): Option[term.type] =
426+
def unapply(term: Term)(using Env): Option[term.type] =
427427
if freePatternVars(term).isEmpty then Some(term) else None
428428

429429
/** Return all free variables of the term defined in the pattern (i.e. defined in `Env`) */
430-
def freePatternVars(term: Term)(using ctx: Context, env: Env): Set[Symbol] =
430+
def freePatternVars(term: Term)(using env: Env): Set[Symbol] =
431431
val accumulator = new TreeAccumulator[Set[Symbol]] {
432432
def foldTree(x: Set[Symbol], tree: Tree)(using ctx: Context): Set[Symbol] =
433433
tree match
@@ -438,7 +438,7 @@ object Matcher {
438438
}
439439

440440
private object IdentArgs {
441-
def unapply(args: List[Term])(using Context): Option[List[Ident]] =
441+
def unapply(args: List[Term]): Option[List[Ident]] =
442442
args.foldRight(Option(List.empty[Ident])) {
443443
case (id: Ident, Some(acc)) => Some(id :: acc)
444444
case (Block(List(DefDef("$anonfun", Nil, List(params), Inferred(), Some(Apply(id: Ident, args)))), Closure(Ident("$anonfun"), None)), Some(acc))
@@ -448,7 +448,7 @@ object Matcher {
448448
}
449449
}
450450

451-
private def treeOptMatches(scrutinee: Option[Tree], pattern: Option[Tree])(using Context, Env): Matching = {
451+
private def treeOptMatches(scrutinee: Option[Tree], pattern: Option[Tree])(using Env): Matching = {
452452
(scrutinee, pattern) match {
453453
case (Some(x), Some(y)) => x =?= y
454454
case (None, None) => matched

0 commit comments

Comments
 (0)