@@ -174,82 +174,154 @@ trait TreeOps extends Core {
174
174
val Term : TermModule
175
175
abstract class TermModule extends TermCoreModule {
176
176
177
+ val Ident : IsIdentExtractor
178
+ abstract class IsIdentExtractor {
179
+ /** Matches any Ident and returns it */
180
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Ident ]
181
+ }
182
+
177
183
/** Scala term identifier */
178
184
val Ident : IdentExtractor
179
185
abstract class IdentExtractor {
180
186
/** Matches a term identifier and returns its name */
181
187
def unapply (tree : Tree )(implicit ctx : Context ): Option [String ]
182
188
}
183
189
190
+ val Select : IsSelectExtractor
191
+ abstract class IsSelectExtractor {
192
+ /** Matches any Select and returns it */
193
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Select ]
194
+ }
195
+
184
196
/** Scala term selection */
185
197
val Select : SelectExtractor
186
198
abstract class SelectExtractor {
187
199
/** Matches `<qual: Term>.<name: String>: <sig: Signature>` */
188
200
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , String , Option [Signature ])]
189
201
}
190
202
203
+ val Literal : IsLiteralExtractor
204
+ abstract class IsLiteralExtractor {
205
+ /** Matches any Literal and returns it */
206
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Literal ]
207
+ }
208
+
191
209
/** Scala literal constant */
192
210
val Literal : LiteralExtractor
193
211
abstract class LiteralExtractor {
194
212
def unapply (tree : Tree )(implicit ctx : Context ): Option [Constant ]
195
213
}
196
214
215
+ val This : IsThisExtractor
216
+ abstract class IsThisExtractor {
217
+ /** Matches any This and returns it */
218
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [This ]
219
+ }
220
+
197
221
/** Scala `this` or `this[id]` */
198
222
val This : ThisExtractor
199
223
abstract class ThisExtractor {
200
224
/** Matches new `this[<id: Option[Id]>` */
201
225
def unapply (tree : Tree )(implicit ctx : Context ): Option [Option [Id ]]
202
226
}
203
227
228
+ val New : IsNewExtractor
229
+ abstract class IsNewExtractor {
230
+ /** Matches any New and returns it */
231
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [New ]
232
+ }
233
+
204
234
/** Scala `new` */
205
235
val New : NewExtractor
206
236
abstract class NewExtractor {
207
237
/** Matches new `new <tpt: TypeTree>` */
208
238
def unapply (tree : Tree )(implicit ctx : Context ): Option [TypeTree ]
209
239
}
210
240
241
+ val NamedArg : IsNamedArgExtractor
242
+ abstract class IsNamedArgExtractor {
243
+ /** Matches any NamedArg and returns it */
244
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [NamedArg ]
245
+ }
246
+
211
247
/** Scala named argument `x = y` in argument position */
212
248
val NamedArg : NamedArgExtractor
213
249
abstract class NamedArgExtractor {
214
250
/** Matches `<name: String> = <value: Term>` */
215
251
def unapply (tree : Tree )(implicit ctx : Context ): Option [(String , Term )]
216
252
}
217
253
254
+ val Apply : IsApplyExtractor
255
+ abstract class IsApplyExtractor {
256
+ /** Matches any Apply and returns it */
257
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Apply ]
258
+ }
259
+
218
260
/** Scala parameter application */
219
261
val Apply : ApplyExtractor
220
262
abstract class ApplyExtractor {
221
263
/** Matches function application `<fun: Term>(<args: List[Term]>)` */
222
264
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , List [Term ])]
223
265
}
224
266
267
+ val TypeApply : IsTypeApplyExtractor
268
+ abstract class IsTypeApplyExtractor {
269
+ /** Matches any TypeApply and returns it */
270
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [TypeApply ]
271
+ }
272
+
225
273
/** Scala type parameter application */
226
274
val TypeApply : TypeApplyExtractor
227
275
abstract class TypeApplyExtractor {
228
276
/** Matches function type application `<fun: Term>[<args: List[TypeTree]>]` */
229
277
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , List [TypeTree ])]
230
278
}
231
279
280
+ val Super : IsSuperExtractor
281
+ abstract class IsSuperExtractor {
282
+ /** Matches any Super and returns it */
283
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Super ]
284
+ }
285
+
232
286
/** Scala `x.super` or `x.super[id]` */
233
287
val Super : SuperExtractor
234
288
abstract class SuperExtractor {
235
289
/** Matches new `<qualifier: Term>.super[<id: Option[Id]>` */
236
290
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , Option [Id ])]
237
291
}
238
292
293
+ val Typed : IsTypedExtractor
294
+ abstract class IsTypedExtractor {
295
+ /** Matches any Typed and returns it */
296
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Typed ]
297
+ }
298
+
239
299
/** Scala ascription `x: T` */
240
300
val Typed : TypedExtractor
241
301
abstract class TypedExtractor {
242
302
/** Matches `<x: Term>: <tpt: Term>` */
243
303
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , TypeTree )]
244
304
}
245
305
306
+ val Assign : IsAssignExtractor
307
+ abstract class IsAssignExtractor {
308
+ /** Matches any Assign and returns it */
309
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Assign ]
310
+ }
311
+
246
312
/** Scala assign `x = y` */
247
313
val Assign : AssignExtractor
248
314
abstract class AssignExtractor {
249
315
/** Matches `<lhs: Term> = <rhs: Term>` */
250
316
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , Term )]
251
317
}
252
318
319
+ val Block : IsBlockExtractor
320
+ abstract class IsBlockExtractor {
321
+ /** Matches any Block and returns it */
322
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Block ]
323
+ }
324
+
253
325
/** Scala code block `{ stat0; ...; statN; expr }` term */
254
326
val Block : BlockExtractor
255
327
abstract class BlockExtractor {
@@ -262,49 +334,97 @@ trait TreeOps extends Core {
262
334
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , Option [TypeTree ])]
263
335
}
264
336
337
+ val XYZ : IsXYZExtractor
338
+ abstract class IsXYZExtractor {
339
+ /** Matches any XYZ and returns it */
340
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
341
+ }
342
+
265
343
/** Scala `if`/`else` term */
266
344
val If : IfExtractor
267
345
abstract class IfExtractor {
268
346
/** Matches `if (<cond: Term>) <thenp: Term> else <elsep: Term>` */
269
347
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , Term , Term )]
270
348
}
271
349
350
+ val XYZ : IsXYZExtractor
351
+ abstract class IsXYZExtractor {
352
+ /** Matches any XYZ and returns it */
353
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
354
+ }
355
+
272
356
/** Scala `match` term */
273
357
val Match : MatchExtractor
274
358
abstract class MatchExtractor {
275
359
/** Matches `<scrutinee: Trem> match { <cases: List[CaseDef]> }` */
276
360
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , List [CaseDef ])]
277
361
}
278
362
363
+ val XYZ : IsXYZExtractor
364
+ abstract class IsXYZExtractor {
365
+ /** Matches any XYZ and returns it */
366
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
367
+ }
368
+
279
369
/** Scala `try`/`catch`/`finally` term */
280
370
val Try : TryExtractor
281
371
abstract class TryExtractor {
282
372
/** Matches `try <body: Term> catch { <cases: List[CaseDef]> } finally <finalizer: Option[Term]>` */
283
373
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , List [CaseDef ], Option [Term ])]
284
374
}
285
375
376
+ val XYZ : IsXYZExtractor
377
+ abstract class IsXYZExtractor {
378
+ /** Matches any XYZ and returns it */
379
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
380
+ }
381
+
286
382
/** Scala local `return` */
287
383
val Return : ReturnExtractor
288
384
abstract class ReturnExtractor {
289
385
/** Matches `return <expr: Term>` */
290
386
def unapply (tree : Tree )(implicit ctx : Context ): Option [Term ]
291
387
}
292
388
389
+ val XYZ : IsXYZExtractor
390
+ abstract class IsXYZExtractor {
391
+ /** Matches any XYZ and returns it */
392
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
393
+ }
394
+
293
395
val Repeated : RepeatedExtractor
294
396
abstract class RepeatedExtractor {
295
397
def unapply (tree : Tree )(implicit ctx : Context ): Option [List [Term ]]
296
398
}
297
399
400
+ val XYZ : IsXYZExtractor
401
+ abstract class IsXYZExtractor {
402
+ /** Matches any XYZ and returns it */
403
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
404
+ }
405
+
298
406
val Inlined : InlinedExtractor
299
407
abstract class InlinedExtractor {
300
408
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Option [TermOrTypeTree ], List [Definition ], Term )]
301
409
}
302
410
411
+ val XYZ : IsXYZExtractor
412
+ abstract class IsXYZExtractor {
413
+ /** Matches any XYZ and returns it */
414
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
415
+ }
416
+
303
417
val SelectOuter : SelectOuterExtractor
304
418
abstract class SelectOuterExtractor {
305
419
def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , Int , Type )]
306
420
}
307
421
422
+ val XYZ : IsXYZExtractor
423
+ abstract class IsXYZExtractor {
424
+ /** Matches any XYZ and returns it */
425
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [XYZ ]
426
+ }
427
+
308
428
val While : WhileExtractor
309
429
abstract class WhileExtractor {
310
430
/** Extractor for while loops. Matches `while (<cond>) <body>` and returns (<cond>, <body>) */
0 commit comments