Skip to content

Commit 19d0ae9

Browse files
committed
Implement TASTy reflect constructors
1 parent 28fded8 commit 19d0ae9

File tree

11 files changed

+639
-139
lines changed

11 files changed

+639
-139
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -960,13 +960,13 @@ object Trees {
960960
* so that they selectively retype themselves. Retyping needs a context.
961961
*/
962962
abstract class TreeCopier {
963-
def postProcess(tree: Tree, copied: untpd.Tree): copied.ThisTree[T]
964-
def postProcess(tree: Tree, copied: untpd.MemberDef): copied.ThisTree[T]
963+
protected def postProcess(tree: Tree, copied: untpd.Tree): copied.ThisTree[T]
964+
protected def postProcess(tree: Tree, copied: untpd.MemberDef): copied.ThisTree[T]
965965

966-
def finalize(tree: Tree, copied: untpd.Tree): copied.ThisTree[T] =
966+
protected def finalize(tree: Tree, copied: untpd.Tree): copied.ThisTree[T] =
967967
postProcess(tree, copied.withPos(tree.pos).withAttachmentsFrom(tree))
968968

969-
def finalize(tree: Tree, copied: untpd.MemberDef): copied.ThisTree[T] =
969+
protected def finalize(tree: Tree, copied: untpd.MemberDef): copied.ThisTree[T] =
970970
postProcess(tree, copied.withPos(tree.pos).withAttachmentsFrom(tree))
971971

972972
def Ident(tree: Tree)(name: Name): Ident = tree match {

compiler/src/dotty/tools/dotc/tastyreflect/CaseDefOpsImpl.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ trait CaseDefOpsImpl extends scala.tasty.reflect.CaseDefOps with CoreImpl with H
1010
}
1111

1212
object CaseDef extends CaseDefExtractor {
13+
def apply(pat: Pattern, guard: Option[Term], body: Term)(implicit ctx: Context): CaseDef = ???
14+
15+
def copy(original: CaseDef)(pat: Pattern, guard: Option[Term], body: Term)(implicit ctx: Context): CaseDef = ???
16+
1317
def unapply(x: CaseDef): Some[(Pattern, Option[Term], Term)] = Some(x.pat, optional(x.guard), x.body)
1418
}
1519

compiler/src/dotty/tools/dotc/tastyreflect/CoreImpl.scala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ trait CoreImpl extends scala.tasty.reflect.Core {
2424
type DefDef = tpd.DefDef
2525
type ValDef = tpd.ValDef
2626
type Term = tpd.Tree
27+
type Ref = tpd.RefTree
28+
type Ident = tpd.Ident
29+
type Select = tpd.Select
30+
type Literal = tpd.Literal
31+
type This = tpd.This
32+
type New = tpd.New
33+
type NamedArg = tpd.NamedArg
34+
type Apply = tpd.Apply
35+
type TypeApply = tpd.TypeApply
36+
type Super = tpd.Super
37+
type Typed = tpd.Typed
38+
type Assign = tpd.Assign
39+
type Block = tpd.Block
40+
type Lambda = tpd.Closure
41+
type If = tpd.If
42+
type Match = tpd.Match
43+
type Try = tpd.Try
44+
type Return = tpd.Return
45+
type Repeated = tpd.SeqLiteral
46+
type Inlined = tpd.Inlined
47+
type SelectOuter = Nothing
48+
type While = tpd.WhileDo
2749

2850
type CaseDef = tpd.CaseDef
2951
type TypeCaseDef = tpd.CaseDef

0 commit comments

Comments
 (0)