@@ -48,7 +48,7 @@ package scala.tasty.reflect
4848 * | +- Or
4949 * | +- MatchType
5050 * | +- ByName
51- * | +- TypeLambdaTree
51+ * | +- LambdaTypeTree
5252 * | +- Bind
5353 * |
5454 * +- TypeBoundsTree
@@ -136,29 +136,97 @@ trait Core {
136136 /** Tree representing an import in the source code */
137137 type Import <: Statement
138138
139- /** Tree representing a definition in the source code. It can be `PackageDef`, `ClassDef`, `TypeDef`, `DefDef` or `ValDef`*/
139+ /** Tree representing a definition in the source code. It can be `PackageDef`, `ClassDef`, `TypeDef`, `DefDef` or `ValDef` */
140140 type Definition <: Statement
141141
142- /** Tree representing a package definition. This includes definitions in all source files. */
142+ /** Tree representing a package definition. This includes definitions in all source files */
143143 type PackageDef <: Definition
144144
145- /** Tree representing a class definition. This includes annonymus class definitions and the class of a module object. */
145+ /** Tree representing a class definition. This includes annonymus class definitions and the class of a module object */
146146 type ClassDef <: Definition
147147
148- /** Tree representing a type (paramter or member) definition in the source code. */
148+ /** Tree representing a type (paramter or member) definition in the source code */
149149 type TypeDef <: Definition
150150
151- /** Tree representing a method definition in the source code. */
151+ /** Tree representing a method definition in the source code */
152152 type DefDef <: Definition
153153
154- /** Tree representing a value definition in the source code. This inclues `val`, `lazy val`, `var`, `object` and parameter defintions. */
154+ /** Tree representing a value definition in the source code This inclues `val`, `lazy val`, `var`, `object` and parameter defintions. */
155155 type ValDef <: Definition
156156
157- /** Tree representing an expression in the source code. */
157+ /** Tree representing an expression in the source code */
158158 type Term <: Statement
159159
160- // TODO Add subtype types of Term for documentation? Or support refined bindings and add the types.
160+ /** Trees representing an expression in the source code */
161+ val Term : TermCoreModule
161162
163+ /** Trees representing an expression in the source code */
164+ trait TermCoreModule {
165+
166+ /** Tree representing a reference to definition with a given name */
167+ type Ident <: Term
168+
169+ /** Tree representing a selection of definition with a given name on a given prefix */
170+ type Select <: Term
171+
172+ /** Tree representing a literal value in the source code */
173+ type Literal <: Term
174+
175+ /** Tree representing `this` in the source code */
176+ type This <: Term
177+
178+ /** Tree representing `new` in the source code */
179+ type New <: Term
180+
181+ /** Tree representing an argument passed with an explicit name. Such as `arg1 = x` in `foo(arg1 = x)` */
182+ type NamedArg <: Term
183+
184+ /** Tree an application of arguments. It represents a single list of arguments, multiple argument lists will have nested `Apply`s */
185+ type Apply <: Term
186+
187+ /** Tree an application of type arguments */
188+ type TypeApply <: Term
189+
190+ /** Tree representing `super` in the source code */
191+ type Super <: Term
192+
193+ /** Tree representing a type ascription `x: T` in the source code */
194+ type Typed <: Term
195+
196+ /** Tree representing an assignment `x = y` in the source code */
197+ type Assign <: Term
198+
199+ /** Tree representing a block `{ ... }` in the source code */
200+ type Block <: Term
201+
202+ /** Tree representing a lambda `(...) => ...` in the source code */
203+ type Lambda <: Term
204+
205+ /** Tree representing an if/then/else `if (...) ... else ...` in the source code */
206+ type If <: Term
207+
208+ /** Tree representing a pattern match `x match { ... }` in the source code */
209+ type Match <: Term
210+
211+ /** Tree representing a tyr catch `try x catch { ... } finally { ... }` in the source code */
212+ type Try <: Term
213+
214+ /** Tree representing a `return` in the source code */
215+ type Return <: Term
216+
217+ /** Tree representing a variable argument list in the source code */
218+ type Repeated <: Term
219+
220+ /** Tree representing the scope of an inlined tree */
221+ type Inlined <: Term
222+
223+ /** Tree representing a selection of definition with a given name on a given prefix and number of nested scopes of inlined trees */
224+ type SelectOuter <: Term
225+
226+ /** Tree representing a while loop */
227+ type While <: Term
228+
229+ }
162230
163231 /** Branch of a pattern match or catch clause */
164232 type CaseDef <: AnyRef
@@ -190,8 +258,55 @@ trait Core {
190258 /** Type tree representing a type written in the source */
191259 type TypeTree <: TypeOrBoundsTree
192260
193- // TODO Add subtype types of TypeTree for documentation? Or support refined bindings and add the types.
261+ /** Type trees representing a type written in the source */
262+ val TypeTree : TypeTreeCoreModule
263+
264+ /** Type trees representing a type written in the source */
265+ abstract class TypeTreeCoreModule {
266+
267+ /** Type tree representing an inferred type */
268+ type Synthetic <: TypeTree
269+
270+ /** Type tree representing a reference to definition with a given name */
271+ type Ident <: TypeTree
272+
273+ /** Type tree representing a selection of definition with a given name on a given term prefix */
274+ type Select <: TypeTree
275+
276+ /** Type tree representing a selection of definition with a given name on a given type prefix */
277+ type Project <: TypeTree
278+
279+ /** Type tree representing a singleton type */
280+ type Singleton <: TypeTree
281+
282+ /** Type tree representing a type refinement */
283+ type Refined <: TypeTree
284+
285+ /** Type tree representing a type application */
286+ type Applied <: TypeTree
287+
288+ /** Type tree representing an annotated type */
289+ type Annotated <: TypeTree
290+
291+ /** Type tree representing an intersection type */
292+ type And <: TypeTree
293+
294+ /** Type tree representing a union type */
295+ type Or <: TypeTree
296+
297+ /** Type tree representing a type match */
298+ type MatchType <: TypeTree
299+
300+ /** Type tree representing a by name parameter */
301+ type ByName <: TypeTree
302+
303+ /** Type tree representing a lambda abstraction type */
304+ type LambdaTypeTree <: TypeTree
305+
306+ /** Type tree representing a type binding */
307+ type Bind <: TypeTree
194308
309+ }
195310
196311 /** Type tree representing a type bound written in the source */
197312 type TypeBoundsTree <: TypeOrBoundsTree
@@ -250,25 +365,25 @@ trait Core {
250365 */
251366 type Symbol <: AnyRef
252367
253- /** Symbol of a package defnition */
368+ /** Symbol of a package definition */
254369 type PackageSymbol <: Symbol
255370
256- /** Symbol of a class defnition . This includes annonymus class definitions and the class of a module object. */
371+ /** Symbol of a class definition . This includes anonymous class definitions and the class of a module object. */
257372 type ClassSymbol <: Symbol
258373
259- /** Symbol of a type (paramter or member) definition. */
374+ /** Symbol of a type (parameter or member) definition. */
260375 type TypeSymbol <: Symbol
261376
262377 /** Symbol representing a method definition. */
263378 type DefSymbol <: Symbol
264379
265- /** Symbol representing a value definition. This inclues `val`, `lazy val`, `var`, `object` and parameter defintions . */
380+ /** Symbol representing a value definition. This includes `val`, `lazy val`, `var`, `object` and parameter definitions . */
266381 type ValSymbol <: Symbol
267382
268383 /** Symbol representing a bind definition. */
269384 type BindSymbol <: Symbol
270385
271- /** No symbol availabe . */
386+ /** No symbol available . */
272387 type NoSymbol <: Symbol
273388
274389}
0 commit comments