用法:
trait reflectModule
低級類型化 AST 元編程 API。
提供與基於 AST 的元編程相關的所有函數。
API 中的每種類型 XYZ
都定義為抽象類型 type XYZ
。 XYZ
上的方法由 given XYZMethods
提供,它在 trait XYZMethods
中實現 XYZ
上的擴展方法。 XYZ
模塊由 val XYZ: XYZModule
定義,其中包含 XYZModule
中定義的方法。還提供了類型測試(TypeTest
)來對這些類型執行子類型檢查。
類型層次結構
+- Tree -+- PackageClause
|
+- Statement -+- Import
| +- Export
| +- Definition --+- ClassDef
| | +- TypeDef
| | +- DefDef
| | +- ValDef
| |
| +- Term --------+- Ref -+- Ident -+- Wildcard
| | +- Select
| |
| +- Literal
| +- This
| +- New
| +- NamedArg
| +- Apply
| +- TypeApply
| +- Super
| +- Assign
| +- Block
| +- Closure
| +- If
| +- Match
| +- SummonFrom
| +- Try
| +- Return
| +- Repeated
| +- Inlined
| +- SelectOuter
| +- While
| +---+- Typed
| /
+- TypedOrTest +----------------·
+- Bind
+- Unapply
+- Alternatives
|
+- CaseDef
+- TypeCaseDef
|
+- TypeTree ----+- Inferred
| +- TypeIdent
| +- TypeSelect
| +- TypeProjection
| +- Singleton
| +- Refined
| +- Applied
| +- Annotated
| +- MatchTypeTree
| +- ByName
| +- LambdaTypeTree
| +- TypeBind
| +- TypeBlock
|
+- TypeBoundsTree
+- WildcardTypeTree
+- ParamClause -+- TypeParamClause
+- TermParamClause
+- TypeRepr -+- NamedType -+- TermRef
| +- TypeRef
+- ConstantType
+- SuperType
+- Refinement
+- AppliedType
+- AnnotatedType
+- AndOrType -+- AndType
| +- OrType
+- MatchType
+- ByNameType
+- ParamRef
+- ThisType
+- RecursiveThis
+- RecursiveType
+- LambdaType -+- MethodOrPoly -+- MethodType
| | +- PolyType
| +- TypeLambda
+- MatchCase
+- TypeBounds
+- NoPrefix
+- Selector -+- SimpleSelector
+- RenameSelector
+- OmitSelector
+- GivenSelector
+- Signature
+- Position
+- SourceFile
+- Constant -+- BooleanConstant
+- ByteConstant
+- ShortConstant
+- IntConstant
+- LongConstant
+- FloatConstant
+- DoubleConstant
+- CharConstant
+- StringConstant
+- UnitConstant
+- NullConstant
+- ClassOfConstant
+- Symbol
+- Flags
源碼:
- Quotes.scala
相關用法
- Scala Quotes.reflect用法及代碼示例
- Scala Quotes.matches用法及代碼示例
- Scala Queue.runWith用法及代碼示例
- Scala Queue drop()用法及代碼示例
- Scala Queue toMap()用法及代碼示例
- Scala Queue.combinations用法及代碼示例
- Scala Queue.elementWise用法及代碼示例
- Scala Queue.permutations用法及代碼示例
- Scala Queue filter()用法及代碼示例
- Scala Queue dropWhile()用法及代碼示例
- Scala Queue take()用法及代碼示例
- Scala Queue.groupBy用法及代碼示例
- Scala Queue.addString用法及代碼示例
- Scala Queue.sliding用法及代碼示例
- Scala Queue tail()用法及代碼示例
- Scala Queue diff()用法及代碼示例
- Scala Queue max()用法及代碼示例
- Scala Queue.sizeIs用法及代碼示例
- Scala Queue toArray()用法及代碼示例
- Scala Queue.sortWith用法及代碼示例
- Scala Queue.groupMapReduce用法及代碼示例
- Scala Queue exists()用法及代碼示例
- Scala Queue toSeq()用法及代碼示例
- Scala Queue.collectFirst用法及代碼示例
- Scala Queue clear()用法及代碼示例
注:本文由純淨天空篩選整理自scala-lang.org大神的英文原創作品 Quotes.reflectModule。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。