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