@@ -21,7 +21,10 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
21
21
}
22
22
23
23
object PackageClause extends PackageClauseModule {
24
- def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term , List [Tree ])] = tree match {
24
+ def apply (pid : Ref , stats : List [Tree ])(implicit ctx : Context ): PackageClause =
25
+ tpd.PackageDef (pid.asInstanceOf [tpd.RefTree ], stats)
26
+
27
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [(Ref , List [Tree ])] = tree match {
25
28
case x : tpd.PackageDef => Some ((x.pid, x.stats))
26
29
case _ => None
27
30
}
@@ -34,6 +37,9 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
34
37
// ----- Statements -----------------------------------------------
35
38
36
39
object Import extends ImportModule {
40
+ def apply (expr : Term , selectors : List [ImportSelector ])(implicit ctx : Context ): Import =
41
+ tpd.Import (expr, selectors)
42
+
37
43
def unapply (x : Tree )(implicit ctx : Context ): Option [(Term , List [ImportSelector ])] = x match {
38
44
case x : tpd.Import => Some ((x.expr, x.selectors))
39
45
case _ => None
@@ -69,6 +75,10 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
69
75
}
70
76
71
77
object ClassDef extends ClassDefModule {
78
+ def apply (name : String , constr : DefDef , parents : List [TermOrTypeTree ], selfOpt : Option [ValDef ], body : List [Statement ])(implicit ctx : Context ): ClassDef = {
79
+ ???
80
+ }
81
+
72
82
def unapply (tree : Tree )(implicit ctx : Context ): Option [(String , DefDef , List [TermOrTypeTree ], Option [ValDef ], List [Statement ])] = tree match {
73
83
case Trees .TypeDef (name, impl : tpd.Template ) =>
74
84
Some ((name.toString, impl.constr, impl.parents, optional(impl.self), impl.body))
@@ -95,6 +105,9 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
95
105
}
96
106
97
107
object DefDef extends DefDefModule {
108
+ def apply (symbol : DefSymbol , rhsFn : List [Type ] => List [List [Term ]] => Option [Term ])(implicit ctx : Context ): DefDef =
109
+ tpd.polyDefDef(symbol, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree ))
110
+
98
111
def unapply (tree : Tree )(implicit ctx : Context ): Option [(String , List [TypeDef ], List [List [ValDef ]], TypeTree , Option [Term ])] = tree match {
99
112
case x : tpd.DefDef =>
100
113
Some ((x.name.toString, x.tparams, x.vparamss, x.tpt, optional(x.rhs)))
@@ -120,6 +133,9 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
120
133
}
121
134
122
135
object ValDef extends ValDefModule {
136
+ def apply (symbol : ValSymbol , rhs : Option [Term ])(implicit ctx : Context ): ValDef =
137
+ tpd.ValDef (symbol, rhs.getOrElse(tpd.EmptyTree ))
138
+
123
139
def unapply (tree : Tree )(implicit ctx : Context ): Option [(String , TypeTree , Option [Term ])] = tree match {
124
140
case x : tpd.ValDef =>
125
141
Some ((x.name.toString, x.tpt, optional(x.rhs)))
@@ -143,6 +159,8 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
143
159
}
144
160
145
161
object TypeDef extends TypeDefModule {
162
+ def apply (symbol : TypeSymbol )(implicit ctx : Context ): TypeDef = tpd.TypeDef (symbol)
163
+
146
164
def unapply (tree : Tree )(implicit ctx : Context ): Option [(String , TypeOrBoundsTree /* TypeTree | TypeBoundsTree */ )] = tree match {
147
165
case x : tpd.TypeDef if ! x.symbol.isClass => Some ((x.name.toString, x.rhs))
148
166
case _ => None
@@ -213,7 +231,16 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
213
231
def name (implicit ctx : Context ): String = x.name.show
214
232
}
215
233
234
+ object Ref extends RefModule {
235
+ def apply (sym : Symbol )(implicit ctx : Context ): Ref = tpd.ref(sym).asInstanceOf [tpd.RefTree ]
236
+ def copy (original : Tree )(name : String )(implicit ctx : Context ): Ref = ???
237
+ }
238
+
216
239
object Ident extends IdentModule {
240
+ def apply (name : String )(implicit ctx : Context ): Ident = ???
241
+
242
+ def copy (original : Tree )(name : String )(implicit ctx : Context ): Ident = ???
243
+
217
244
def unapply (x : Term )(implicit ctx : Context ): Option [String ] = x match {
218
245
case x : tpd.Ident if x.isTerm => Some (x.name.show)
219
246
case _ => None
@@ -236,6 +263,10 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
236
263
}
237
264
238
265
object Select extends SelectModule {
266
+ def apply (qualifier : Term , name : String , signature : Option [Signature ])(implicit ctx : Context ): Select = ???
267
+
268
+ def copy (original : Tree )(qualifier : Term , name : String )(implicit ctx : Context ): Select = ???
269
+
239
270
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , String )] = x match {
240
271
case x : tpd.Select if x.isTerm => Some ((x.qualifier, x.name.toString))
241
272
case _ => None
@@ -255,6 +286,12 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
255
286
}
256
287
257
288
object Literal extends LiteralModule {
289
+
290
+ def apply (constant : Constant )(implicit ctx : Context ): Literal =
291
+ tpd.Literal (constant)
292
+
293
+ def copy (original : Tree )(constant : Constant )(implicit ctx : Context ): Literal = ???
294
+
258
295
def unapply (x : Term )(implicit ctx : Context ): Option [Constant ] = x match {
259
296
case Trees .Literal (const) => Some (const)
260
297
case _ => None
@@ -273,6 +310,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
273
310
}
274
311
275
312
object This extends ThisModule {
313
+
314
+ def apply (cls : ClassSymbol )(implicit ctx : Context ): This = tpd.This (cls)
315
+
316
+ def copy (original : Tree )(qual : Option [Id ]): This = ???
317
+
276
318
def unapply (x : Term )(implicit ctx : Context ): Option [Option [Id ]] = x match {
277
319
case Trees .This (qual) => Some (optional(qual))
278
320
case _ => None
@@ -292,6 +334,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
292
334
}
293
335
294
336
object New extends NewModule {
337
+
338
+ def apply (tpt : TypeTree )(implicit ctx : Context ): New = tpd.New (tpt)
339
+
340
+ def copy (original : Tree )(tpt : TypeTree )(implicit ctx : Context ): New = ???
341
+
295
342
def unapply (x : Term )(implicit ctx : Context ): Option [TypeTree ] = x match {
296
343
case x : tpd.New => Some (x.tpt)
297
344
case _ => None
@@ -311,6 +358,12 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
311
358
}
312
359
313
360
object NamedArg extends NamedArgModule {
361
+
362
+ def apply (name : String , arg : Term )(implicit ctx : Context ): NamedArg =
363
+ tpd.NamedArg (name.toTermName, arg)
364
+
365
+ def copy (tree : NamedArg )(name : String , arg : Term )(implicit ctx : Context ): NamedArg = ???
366
+
314
367
def unapply (x : Term )(implicit ctx : Context ): Option [(String , Term )] = x match {
315
368
case x : tpd.NamedArg if x.name.isInstanceOf [Names .TermName ] => Some ((x.name.toString, x.arg))
316
369
case _ => None
@@ -330,6 +383,12 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
330
383
}
331
384
332
385
object Apply extends ApplyModule {
386
+
387
+ def apply (fn : Term , args : List [Term ])(implicit ctx : Context ): Apply =
388
+ tpd.Apply (fn, args)
389
+
390
+ def copy (original : Tree )(fun : Term , args : List [Term ])(implicit ctx : Context ): Apply = ???
391
+
333
392
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [Term ])] = x match {
334
393
case x : tpd.Apply => Some ((x.fun, x.args))
335
394
case _ => None
@@ -349,6 +408,12 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
349
408
}
350
409
351
410
object TypeApply extends TypeApplyModule {
411
+
412
+ def apply (fn : Term , args : List [TypeTree ])(implicit ctx : Context ): TypeApply =
413
+ tpd.TypeApply (fn, args)
414
+
415
+ def copy (original : Tree )(fun : Term , args : List [TypeTree ])(implicit ctx : Context ): TypeApply = ???
416
+
352
417
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [TypeTree ])] = x match {
353
418
case x : tpd.TypeApply => Some ((x.fun, x.args))
354
419
case _ => None
@@ -368,6 +433,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
368
433
}
369
434
370
435
object Super extends SuperModule {
436
+ def apply (qual : Term , mix : Option [Id ])(implicit ctx : Context ): Super =
437
+ tpd.Super (qual, mix.getOrElse(untpd.EmptyTypeIdent ), ??? , ??? )
438
+
439
+ def copy (original : Tree )(qual : Term , mix : Option [Id ]): Super = ???
440
+
371
441
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Option [Id ])] = x match {
372
442
case x : tpd.Super => Some ((x.qual, if (x.mix.isEmpty) None else Some (x.mix)))
373
443
case _ => None
@@ -387,6 +457,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
387
457
}
388
458
389
459
object Typed extends TypedModule {
460
+ def apply (expr : Term , tpt : TypeTree )(implicit ctx : Context ): Typed =
461
+ tpd.Typed (expr, tpt)
462
+
463
+ def copy (original : Tree )(expr : Term , tpt : TypeTree )(implicit ctx : Context ): Typed = ???
464
+
390
465
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , TypeTree )] = x match {
391
466
case x : tpd.Typed => Some ((x.expr, x.tpt))
392
467
case _ => None
@@ -406,6 +481,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
406
481
}
407
482
408
483
object Assign extends AssignModule {
484
+ def apply (lhs : Term , rhs : Term )(implicit ctx : Context ): Assign =
485
+ tpd.Assign (lhs, rhs)
486
+
487
+ def copy (original : Tree )(lhs : Term , rhs : Term )(implicit ctx : Context ): Assign = ???
488
+
409
489
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Term )] = x match {
410
490
case x : tpd.Assign => Some ((x.lhs, x.rhs))
411
491
case _ => None
@@ -454,6 +534,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
454
534
}
455
535
456
536
object Block extends BlockModule {
537
+ def apply (stats : List [Statement ], expr : Term )(implicit ctx : Context ): Block =
538
+ tpd.Block (stats, expr)
539
+
540
+ def copy (original : Tree )(stats : List [Statement ], expr : Term )(implicit ctx : Context ): Block = ???
541
+
457
542
def unapply (x : Term )(implicit ctx : Context ): Option [(List [Statement ], Term )] = x match {
458
543
case IsBlock (x) => Some ((x.stats, x.expr))
459
544
case _ => None
@@ -474,6 +559,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
474
559
}
475
560
476
561
object Inlined extends InlinedModule {
562
+ def apply (call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined =
563
+ tpd.Inlined (call.getOrElse(tpd.EmptyTree ), bindings.map { case b : tpd.MemberDef => b }, expansion)
564
+
565
+ def copy (original : Tree )(call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined = ???
566
+
477
567
def unapply (x : Term )(implicit ctx : Context ): Option [(Option [TermOrTypeTree ], List [Statement ], Term )] = x match {
478
568
case x : tpd.Inlined =>
479
569
Some ((optional(x.call), x.bindings, x.expansion))
@@ -494,6 +584,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
494
584
}
495
585
496
586
object Lambda extends LambdaModule {
587
+ def apply (meth : Term , tpt : Option [TypeTree ])(implicit ctx : Context ): Lambda =
588
+ tpd.Closure (Nil , meth, tpt.getOrElse(tpd.EmptyTree ))
589
+
590
+ def copy (original : Tree )(meth : Tree , tpt : Tree )(implicit ctx : Context ): Lambda = ???
591
+
497
592
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Option [TypeTree ])] = x match {
498
593
case x : tpd.Closure => Some ((x.meth, optional(x.tpt)))
499
594
case _ => None
@@ -514,6 +609,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
514
609
}
515
610
516
611
object If extends IfModule {
612
+ def apply (cond : Term , thenp : Term , elsep : Term )(implicit ctx : Context ): If =
613
+ tpd.If (cond, thenp, elsep)
614
+
615
+ def copy (original : Tree )(cond : Term , thenp : Term , elsep : Term )(implicit ctx : Context ): If = ???
616
+
517
617
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Term , Term )] = x match {
518
618
case x : tpd.If => Some ((x.cond, x.thenp, x.elsep))
519
619
case _ => None
@@ -533,6 +633,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
533
633
}
534
634
535
635
object Match extends MatchModule {
636
+ def apply (selector : Term , cases : List [CaseDef ])(implicit ctx : Context ): Match =
637
+ tpd.Match (selector, cases)
638
+
639
+ def copy (original : Tree )(selector : Term , cases : List [CaseDef ])(implicit ctx : Context ): Match = ???
640
+
536
641
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [CaseDef ])] = x match {
537
642
case x : tpd.Match => Some ((x.selector, x.cases))
538
643
case _ => None
@@ -553,6 +658,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
553
658
}
554
659
555
660
object Try extends TryModule {
661
+ def apply (expr : Term , cases : List [CaseDef ], finalizer : Option [Term ])(implicit ctx : Context ): Try =
662
+ tpd.Try (expr, cases, finalizer.getOrElse(tpd.EmptyTree ))
663
+
664
+ def copy (original : Tree )(expr : Term , cases : List [CaseDef ], finalizer : Option [Term ])(implicit ctx : Context ): Try = ???
665
+
556
666
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , List [CaseDef ], Option [Term ])] = x match {
557
667
case x : tpd.Try => Some ((x.expr, x.cases, optional(x.finalizer)))
558
668
case _ => None
@@ -571,6 +681,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
571
681
}
572
682
573
683
object Return extends ReturnModule {
684
+ def apply (expr : Term )(implicit ctx : Context ): Return =
685
+ tpd.Return (expr, ctx.owner)
686
+
687
+ def copy (original : Tree )(expr : Term )(implicit ctx : Context ): Return = ???
688
+
574
689
def unapply (x : Term )(implicit ctx : Context ): Option [Term ] = x match {
575
690
case x : tpd.Return => Some (x.expr)
576
691
case _ => None
@@ -589,6 +704,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
589
704
}
590
705
591
706
object Repeated extends RepeatedModule {
707
+ def apply (elems : List [Term ])(implicit ctx : Context ): Repeated =
708
+ tpd.SeqLiteral (elems, ??? )
709
+
710
+ def copy (original : Tree )(elems : List [Term ])(implicit ctx : Context ): Repeated = ???
711
+
592
712
def unapply (x : Term )(implicit ctx : Context ): Option [List [Term ]] = x match {
593
713
case x : tpd.SeqLiteral => Some (x.elems)
594
714
case _ => None
@@ -616,6 +736,12 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
616
736
}
617
737
618
738
object SelectOuter extends SelectOuterModule {
739
+
740
+ def apply (call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined =
741
+ tpd.Inlined (call.getOrElse(tpd.EmptyTree ), bindings.map { case b : tpd.MemberDef => b }, expansion)
742
+
743
+ def copy (original : Tree )(call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined = ???
744
+
619
745
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Int , Type )] = x match {
620
746
case x : tpd.Select =>
621
747
x.name match {
@@ -639,6 +765,11 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
639
765
}
640
766
641
767
object While extends WhileModule {
768
+ def apply (cond : Term , body : Term )(implicit ctx : Context ): While =
769
+ tpd.WhileDo (cond, body)
770
+
771
+ def copy (original : Tree )(cond : Term , body : Term )(implicit ctx : Context ): While = ???
772
+
642
773
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Term )] = x match {
643
774
case x : tpd.WhileDo => Some ((x.cond, x.body))
644
775
case _ => None
0 commit comments