@@ -199,98 +199,126 @@ abstract class Tasty { tasty =>
199
199
200
200
implicit def termClassTag : ClassTag [Term ]
201
201
202
+ /** Scala term. Any tree that can go in expression position. */
202
203
val Term : TermModule
203
204
abstract class TermModule {
204
205
206
+ /** Matches any term */
205
207
def unapply (x : Term )(implicit ctx : Context ): Boolean
206
208
209
+ /** Scala term identifier */
207
210
val Ident : IdentExtractor
208
211
abstract class IdentExtractor {
212
+ /** Matches a term identifier and returns its name */
209
213
def unapply (x : Term )(implicit ctx : Context ): Option [String ]
210
214
}
211
215
216
+ /** Scala term selection */
212
217
val Select : SelectExtractor
213
218
abstract class SelectExtractor {
219
+ /** Matches `<qual: Term>.<name: String>: <sig: Signature>` */
214
220
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , String , Option [Signature ])]
215
221
}
216
222
223
+ /** Scala literal constant */
217
224
val Literal : LiteralExtractor
218
225
abstract class LiteralExtractor {
219
226
def unapply (x : Term )(implicit ctx : Context ): Option [Constant ]
220
227
}
221
228
229
+ /** Scala `this` or `this[id]` */
222
230
val This : ThisExtractor
223
231
abstract class ThisExtractor {
232
+ /** Matches new `this[<id: Option[Id]>` */
224
233
def unapply (x : Term )(implicit ctx : Context ): Option [Option [Id ]]
225
234
}
226
235
236
+ /** Scala `new` */
227
237
val New : NewExtractor
228
238
abstract class NewExtractor {
239
+ /** Matches new `new <tpt: TypeTree>` */
229
240
def unapply (x : Term )(implicit ctx : Context ): Option [TypeTree ]
230
241
}
231
242
243
+ /** Scala named argument `x = y` in argument position */
232
244
val NamedArg : NamedArgExtractor
233
245
abstract class NamedArgExtractor {
246
+ /** Matches `<name: String> = <value: Term>` */
234
247
def unapply (x : Term )(implicit ctx : Context ): Option [(String , Term )]
235
248
}
236
249
250
+ /** Scala parameter application */
237
251
val Apply : ApplyExtractor
238
252
abstract class ApplyExtractor {
253
+ /** Matches function application `<fun: Term>(<args: List[Term]>)` */
239
254
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [Term ])]
240
255
}
241
256
257
+ /** Scala type parameter application */
242
258
val TypeApply : TypeApplyExtractor
243
259
abstract class TypeApplyExtractor {
260
+ /** Matches function type application `<fun: Term>[<args: List[TypeTree]>]` */
244
261
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [TypeTree ])]
245
262
}
246
263
264
+ /** Scala `x.super` or `x.super[id]` */
247
265
val Super : SuperExtractor
248
266
abstract class SuperExtractor {
267
+ /** Matches new `<qualifier: Term>.super[<id: Option[Id]>` */
249
268
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Option [Id ])]
250
269
}
251
270
271
+ /** Scala ascription `x: T` */
252
272
val Typed : TypedExtractor
253
273
abstract class TypedExtractor {
274
+ /** Matches `<x: Term>: <tpt: Term>` */
254
275
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , TypeTree )]
255
276
}
256
277
278
+ /** Scala assign `x = y` */
257
279
val Assign : AssignExtractor
258
280
abstract class AssignExtractor {
281
+ /** Matches `<lhs: Term> = <rhs: Term>` */
259
282
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Term )]
260
283
}
261
284
285
+ /** Scala code block `{ stat0; ...; statN; expr }` term */
262
286
val Block : BlockExtractor
263
287
abstract class BlockExtractor {
288
+ /** Matches `{ <statements: List[Statement]>; <expr: Term> }` */
264
289
def unapply (x : Term )(implicit ctx : Context ): Option [(List [Statement ], Term )]
265
290
}
266
291
267
- val Inlined : InlinedExtractor
268
- abstract class InlinedExtractor {
269
- def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [Definition ], Term )]
270
- }
271
-
272
292
val Lambda : LambdaExtractor
273
293
abstract class LambdaExtractor {
274
294
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Option [TypeTree ])]
275
295
}
276
296
297
+ /** Scala `if`/`else` term */
277
298
val If : IfExtractor
278
299
abstract class IfExtractor {
300
+ /** Matches `if (<cond: Term>) <thenp: Term> else <elsep: Term>` */
279
301
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Term , Term )]
280
302
}
281
303
304
+ /** Scala `match` term */
282
305
val Match : MatchExtractor
283
306
abstract class MatchExtractor {
307
+ /** Matches `<scrutinee: Trem> match { <cases: List[CaseDef]> }` */
284
308
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [CaseDef ])]
285
309
}
286
310
311
+ /** Scala `try`/`catch`/`finally` term */
287
312
val Try : TryExtractor
288
313
abstract class TryExtractor {
314
+ /** Matches `try <body: Term> catch { <cases: List[CaseDef]> } finally <finalizer: Option[Term]>` */
289
315
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [CaseDef ], Option [Term ])]
290
316
}
291
317
318
+ /** Scala local `return` */
292
319
val Return : ReturnExtractor
293
320
abstract class ReturnExtractor {
321
+ /** Matches `return <expr: Term>` */
294
322
def unapply (x : Term )(implicit ctx : Context ): Option [Term ]
295
323
}
296
324
@@ -299,6 +327,11 @@ abstract class Tasty { tasty =>
299
327
def unapply (x : Term )(implicit ctx : Context ): Option [List [Term ]]
300
328
}
301
329
330
+ val Inlined : InlinedExtractor
331
+ abstract class InlinedExtractor {
332
+ def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [Definition ], Term )]
333
+ }
334
+
302
335
val SelectOuter : SelectOuterExtractor
303
336
abstract class SelectOuterExtractor {
304
337
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Int , Type )]
0 commit comments