@@ -21,10 +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 apply (pid : Ref , stats : List [Tree ])(implicit ctx : Context ): PackageClause =
24
+ def apply (pid : Term . Ref , stats : List [Tree ])(implicit ctx : Context ): PackageClause =
25
25
tpd.PackageDef (pid.asInstanceOf [tpd.RefTree ], stats)
26
26
27
- def unapply (tree : Tree )(implicit ctx : Context ): Option [(Ref , List [Tree ])] = tree match {
27
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [(Term . Ref , List [Tree ])] = tree match {
28
28
case x : tpd.PackageDef => Some ((x.pid, x.stats))
29
29
case _ => None
30
30
}
@@ -34,8 +34,6 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
34
34
35
35
}
36
36
37
- // ----- Statements -----------------------------------------------
38
-
39
37
object Import extends ImportModule {
40
38
def apply (expr : Term , selectors : List [ImportSelector ])(implicit ctx : Context ): Import =
41
39
tpd.Import (expr, selectors)
@@ -51,6 +49,15 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
51
49
def selector (implicit ctx : Context ): List [ImportSelector ] = imp.selectors
52
50
}
53
51
52
+ object IsStatement extends IsStatementModule {
53
+ /** Matches any Statement and returns it */
54
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Statement ] = tree match {
55
+ case IsDefinition (tree) => Some (tree)
56
+ case tree if tree.isTerm => Some (tree)
57
+ case _ => None
58
+ }
59
+ }
60
+
54
61
// ----- Definitions ----------------------------------------------
55
62
56
63
object IsDefinition extends IsDefinitionModule {
@@ -537,7 +544,8 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
537
544
def apply (stats : List [Statement ], expr : Term )(implicit ctx : Context ): Block =
538
545
tpd.Block (stats, expr)
539
546
540
- def copy (original : Tree )(stats : List [Statement ], expr : Term )(implicit ctx : Context ): Block = ???
547
+ def copy (original : Tree )(stats : List [Statement ], expr : Term )(implicit ctx : Context ): Block =
548
+ tpd.cpy.Block (original)(stats, expr)
541
549
542
550
def unapply (x : Term )(implicit ctx : Context ): Option [(List [Statement ], Term )] = x match {
543
551
case IsBlock (x) => Some ((x.stats, x.expr))
@@ -562,7 +570,8 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
562
570
def apply (call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined =
563
571
tpd.Inlined (call.getOrElse(tpd.EmptyTree ), bindings.map { case b : tpd.MemberDef => b }, expansion)
564
572
565
- def copy (original : Tree )(call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined = ???
573
+ def copy (original : Tree )(call : Option [TermOrTypeTree ], bindings : List [Definition ], expansion : Term )(implicit ctx : Context ): Inlined =
574
+ tpd.cpy.Inlined (original)(call.getOrElse(tpd.EmptyTree ), bindings.asInstanceOf [List [tpd.MemberDef ]], expansion)
566
575
567
576
def unapply (x : Term )(implicit ctx : Context ): Option [(Option [TermOrTypeTree ], List [Statement ], Term )] = x match {
568
577
case x : tpd.Inlined =>
@@ -737,10 +746,9 @@ trait TreeOpsImpl extends scala.tasty.reflect.TreeOps with CoreImpl with Helpers
737
746
738
747
object SelectOuter extends SelectOuterModule {
739
748
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)
749
+ def apply (qualifier : Term , levels : Int , tpe : Type )(implicit ctx : Context ): SelectOuter = ???
742
750
743
- def copy (original : Tree )(call : Option [ TermOrTypeTree ], bindings : List [ Definition ], expansion : Term )(implicit ctx : Context ): Inlined = ???
751
+ def copy (original : Tree )(qualifier : Term , levels : Int , tpe : Type )(implicit ctx : Context ): SelectOuter = ???
744
752
745
753
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Int , Type )] = x match {
746
754
case x : tpd.Select =>
0 commit comments