@@ -234,18 +234,18 @@ object QuoteMatcher {
234
234
scrutinee =?= expr2
235
235
236
236
case _ =>
237
- ( scrutinee, pattern) match
237
+ scrutinee match
238
238
/* Match type ascription (a) */
239
- case ( Typed (expr1, _) , _) =>
239
+ case Typed (expr1, _) =>
240
240
expr1 =?= pattern
241
241
242
242
/* Match literal */
243
- case ( Literal (constant1), _ ) =>
243
+ case Literal (constant1) =>
244
244
pattern match
245
245
case Literal (constant2) if constant1 == constant2 => matched
246
246
case _ => notMatched
247
247
248
- case ( ref : RefTree , _) =>
248
+ case ref : RefTree =>
249
249
pattern match
250
250
/* Match selection */
251
251
case Select (qual2, _) if symbolMatch(scrutinee, pattern) =>
@@ -262,21 +262,21 @@ object QuoteMatcher {
262
262
case _ => notMatched
263
263
264
264
/* Match application */
265
- case ( Apply (fn1, args1), _ ) =>
265
+ case Apply (fn1, args1) =>
266
266
pattern match
267
267
case Apply (fn2, args2) =>
268
268
fn1 =?= fn2 &&& args1 =?= args2
269
269
case _ => notMatched
270
270
271
271
/* Match type application */
272
- case ( TypeApply (fn1, args1), _ ) =>
272
+ case TypeApply (fn1, args1) =>
273
273
pattern match
274
274
case TypeApply (fn2, args2) =>
275
275
fn1 =?= fn2 &&& args1 =?= args2
276
276
case _ => notMatched
277
277
278
278
/* Match block */
279
- case ( Block (stat1 :: stats1, expr1), _ ) =>
279
+ case Block (stat1 :: stats1, expr1) =>
280
280
pattern match
281
281
case Block (stat2 :: stats2, expr2) =>
282
282
val newEnv = (stat1, stat2) match {
@@ -291,65 +291,65 @@ object QuoteMatcher {
291
291
case _ => notMatched
292
292
293
293
/* Match if */
294
- case ( If (cond1, thenp1, elsep1), _ ) =>
294
+ case If (cond1, thenp1, elsep1) =>
295
295
pattern match
296
296
case If (cond2, thenp2, elsep2) =>
297
297
cond1 =?= cond2 &&& thenp1 =?= thenp2 &&& elsep1 =?= elsep2
298
298
case _ => notMatched
299
299
300
300
/* Match while */
301
- case ( WhileDo (cond1, body1), _ ) =>
301
+ case WhileDo (cond1, body1) =>
302
302
pattern match
303
303
case WhileDo (cond2, body2) => cond1 =?= cond2 &&& body1 =?= body2
304
304
case _ => notMatched
305
305
306
306
/* Match assign */
307
- case ( Assign (lhs1, rhs1), _ ) =>
307
+ case Assign (lhs1, rhs1) =>
308
308
pattern match
309
309
case Assign (lhs2, rhs2) => lhs1 =?= lhs2 &&& rhs1 =?= rhs2
310
310
case _ => notMatched
311
311
312
312
/* Match new */
313
- case ( New (tpt1), _ ) =>
313
+ case New (tpt1) =>
314
314
pattern match
315
315
case New (tpt2) if tpt1.tpe.typeSymbol == tpt2.tpe.typeSymbol => matched
316
316
case _ => notMatched
317
317
318
318
/* Match this */
319
- case ( This (_), _) =>
319
+ case This (_) =>
320
320
pattern match
321
321
case This (_) if scrutinee.symbol == pattern.symbol => matched
322
322
case _ => notMatched
323
323
324
324
/* Match super */
325
- case ( Super (qual1, mix1), _ ) =>
325
+ case Super (qual1, mix1) =>
326
326
pattern match
327
327
case Super (qual2, mix2) if mix1 == mix2 => qual1 =?= qual2
328
328
case _ => notMatched
329
329
330
330
/* Match varargs */
331
- case ( SeqLiteral (elems1, _) , _) =>
331
+ case SeqLiteral (elems1, _) =>
332
332
pattern match
333
333
case SeqLiteral (elems2, _) if elems1.size == elems2.size => elems1 =?= elems2
334
334
case _ => notMatched
335
335
336
336
/* Match type */
337
337
// TODO remove this?
338
- case ( TypeTreeTypeTest (scrutinee), _ ) =>
338
+ case TypeTreeTypeTest (scrutinee) =>
339
339
pattern match
340
340
case TypeTreeTypeTest (pattern) if scrutinee.tpe <:< pattern.tpe => matched
341
341
case _ => notMatched
342
342
343
343
/* Match val */
344
- case ( scrutinee @ ValDef (_, tpt1, _) , _) =>
344
+ case scrutinee @ ValDef (_, tpt1, _) =>
345
345
pattern match
346
346
case pattern @ ValDef (_, tpt2, _) if checkValFlags() =>
347
347
def rhsEnv = summon[Env ] + (scrutinee.symbol -> pattern.symbol)
348
348
tpt1 =?= tpt2 &&& withEnv(rhsEnv)(scrutinee.rhs =?= pattern.rhs)
349
349
case _ => notMatched
350
350
351
351
/* Match def */
352
- case ( scrutinee @ DefDef (_, paramss1, tpt1, _) , _) =>
352
+ case scrutinee @ DefDef (_, paramss1, tpt1, _) =>
353
353
pattern match
354
354
case pattern @ DefDef (_, paramss2, tpt2, _) =>
355
355
def rhsEnv : Env =
@@ -367,17 +367,17 @@ object QuoteMatcher {
367
367
&&& withEnv(rhsEnv)(scrutinee.rhs =?= pattern.rhs)
368
368
case _ => notMatched
369
369
370
- case ( Closure (_, _, tpt1), _ ) =>
370
+ case Closure (_, _, tpt1) =>
371
371
pattern match
372
372
case Closure (_, _, tpt2) => matched // TODO match tpt1 with tpt2?
373
373
case _ => notMatched
374
374
375
- case ( NamedArg (name1, arg1), _ ) =>
375
+ case NamedArg (name1, arg1) =>
376
376
pattern match
377
377
case NamedArg (name2, arg2) if name1 == name2 => arg1 =?= arg2
378
378
case _ => notMatched
379
379
380
- case ( EmptyTree , _) =>
380
+ case EmptyTree =>
381
381
if pattern.isEmpty then matched
382
382
else notMatched
383
383
0 commit comments