File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed
compiler/src/dotty/tools/dotc/tasty Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import dotty.tools.dotc.core.Contexts.Context
5
5
import dotty .tools .dotc .core .Symbols ._
6
6
import dotty .tools .dotc .core .Flags ._
7
7
8
-
9
8
object FromSymbol {
10
9
11
10
def definition (sym : Symbol )(implicit ctx : Context ): tpd.Tree = {
@@ -18,8 +17,7 @@ object FromSymbol {
18
17
else valDef(sym.asTerm)
19
18
}
20
19
21
- def packageDef (sym : Symbol )(implicit ctx : Context ): tpd.PackageDef =
22
- tpd.PackageDef (tpd.Ident (sym.typeRef), Nil )
20
+ def packageDef (sym : Symbol )(implicit ctx : Context ): PackageDefinition = PackageDefinitionImpl (sym)
23
21
24
22
def classDef (cls : ClassSymbol )(implicit ctx : Context ): tpd.Tree = {
25
23
val constr = tpd.DefDef (cls.unforcedDecls.find(_.isPrimaryConstructor).asTerm)
Original file line number Diff line number Diff line change @@ -192,13 +192,13 @@ object TastyImpl extends scala.tasty.Tasty {
192
192
}
193
193
}
194
194
195
- type PackageDef = tpd. Tree
195
+ type PackageDef = PackageDefinition
196
196
197
197
def packageDefClassTag : ClassTag [PackageDef ] = implicitly[ClassTag [PackageDef ]]
198
198
199
199
object PackageDef extends PackageDefExtractor {
200
200
def unapply (x : PackageDef )(implicit ctx : Context ): Option [(String , List [Statement ])] = x match {
201
- case x : tpd. PackageDef =>
201
+ case x : PackageDefinition =>
202
202
// FIXME Do not do this eagerly as it forces everithing in the package to be loaded.
203
203
// An alternative would be to add it as an extension method instead.
204
204
val definitions =
Original file line number Diff line number Diff line change
1
+ package dotty .tools .dotc
2
+
3
+ import dotty .tools .dotc .ast .Trees .{Tree , Untyped }
4
+ import dotty .tools .dotc .core .Symbols .Symbol
5
+ import dotty .tools .dotc .core .Types .Type
6
+
7
+ package object tasty {
8
+
9
+ type PackageDefinition = PackageDefinitionImpl [Type ]
10
+
11
+ /** Represents the symbol of a definition in tree form */
12
+ case class PackageDefinitionImpl [- T >: Untyped ] private [tasty] (symbol : Symbol ) extends Tree [T ] {
13
+ type ThisTree [- T >: Untyped ] = PackageDefinitionImpl [T ]
14
+ }
15
+
16
+ }
You can’t perform that action at this time.
0 commit comments