1
1
object tasty {
2
2
3
+ // ------ Names --------------------------------
4
+
3
5
trait PossiblySignedName
4
6
5
7
enum Name extends PossiblySignedName {
@@ -19,12 +21,19 @@ object tasty {
19
21
20
22
case class SignedName (name : Name , resultSig : Name , paramSigs : List [Name ]) extends PossiblySignedName
21
23
24
+ // ------ Positions ---------------------------
25
+
22
26
case class Position (firstOffset : Int , lastOffset : Int )
23
27
24
28
trait Positioned {
25
29
def pos : Position = ???
26
30
}
27
31
32
+ // ------ Statements ---------------------------------
33
+
34
+ // Note: Definitions are written as extractors, because they may be referred to
35
+ // recursively from some of their arguments (since we equate symbols with definitions)
36
+
28
37
trait TopLevelStatement extends Positioned
29
38
30
39
trait Statement extends TopLevelStatement
@@ -109,6 +118,9 @@ object tasty {
109
118
110
119
case class Id (name : Name ) extends Positioned // untyped ident
111
120
121
+ // ------ Terms ---------------------------------
122
+
123
+ /** Trees denoting terms */
112
124
enum Term extends Statement {
113
125
def tpe : Type = ???
114
126
case Ident (name : Name , override val tpe : Type )
@@ -134,6 +146,7 @@ object tasty {
134
146
case Tpt (underlying : TypeTerm | Empty )
135
147
}
136
148
149
+ /** Trees denoting types */
137
150
enum TypeTerm extends Positioned {
138
151
def tpe : Type = ???
139
152
case Ident (name : Name , override val tpe : Type )
@@ -148,6 +161,7 @@ object tasty {
148
161
case ByName (tpt : TypeTerm )
149
162
}
150
163
164
+ /** Trees denoting patterns */
151
165
enum Pattern extends Positioned {
152
166
def tpe : Type = ???
153
167
case Value (v : Term )
@@ -162,6 +176,8 @@ object tasty {
162
176
163
177
sealed trait Type
164
178
179
+ // ------ Types ---------------------------------
180
+
165
181
object Type {
166
182
case class ConstantType (value : Constant ) extends Type
167
183
case class SymRef (sym : Definition , qualifier : Type | Empty = Empty ) extends Type
@@ -178,6 +194,9 @@ object tasty {
178
194
case class ParamRef (binder : LambdaType , idx : Int ) extends Type
179
195
case class RecThis (binder : RecursiveType ) extends Type
180
196
197
+ // The following types are all expressed by extractors because they may be referred
198
+ // to from some of their arguments
199
+
181
200
class RecursiveType (underlyingExp : RecursiveType => Type ) extends Type {
182
201
val underlying = underlyingExp(this )
183
202
}
@@ -236,6 +255,8 @@ object tasty {
236
255
case class TypeBounds (loBound : Type , hiBound : Type )
237
256
}
238
257
258
+ // ------ Modifiers ---------------------------------
259
+
239
260
enum Modifier extends Positioned {
240
261
case Private , Protected , Abstract , Final , Sealed , Case , Implicit , Erased , Lazy , Override , Inline ,
241
262
Macro , // inline method containing toplevel splices
@@ -260,6 +281,8 @@ object tasty {
260
281
case Annotation (tree : Term )
261
282
}
262
283
284
+ // ------ Constants ---------------------------------
285
+
263
286
enum Constant (value : Any ) {
264
287
case Unit extends Constant (())
265
288
case False extends Constant (false )
0 commit comments