@@ -14,7 +14,7 @@ You may find all you need without using TASTy Reflect.
1414## API: From quotes and splices to TASTy reflect trees and back
1515
1616With ` quoted.Expr ` and ` quoted.Type ` we can compute code but also analyze code
17- by inspecting the ASTs. [ Macros] ( ./macros.md ) provides the guarantee that the
17+ by inspecting the ASTs. [ Macros] ( ./macros.md ) provide the guarantee that the
1818generation of code will be type-correct. Using TASTy Reflect will break these
1919guarantees and may fail at macro expansion time, hence additional explicit
2020checks must be done.
@@ -64,8 +64,7 @@ To easily know which extractors are needed, the `showExtractors` method on a
6464The method ` qctx.tasty.Term.seal ` provides a way to go back to a
6565` quoted.Expr[Any] ` . Note that the type is ` Expr[Any] ` . Consequently, the type
6666must be set explicitly with a checked ` cast ` call. If the type does not conform
67- to it an exception will be thrown. In the code above, we could have replaced
68- ` Expr(n) ` by ` xTree.seal.cast[Int] ` .
67+ to it an exception will be thrown at runtime.
6968
7069### Obtaining the underlying argument
7170
@@ -92,8 +91,8 @@ macro(this.checkCondition())
9291
9392### Positions
9493
95- The tasty context provides a ` rootPosition ` value. For macros it corresponds to
96- the expansion site. The macro authors can obtain various information about that
94+ The tasty context provides a ` rootPosition ` value. It corresponds to
95+ the expansion site for macros . The macro authors can obtain various information about that
9796expansion site. The example below shows how we can obtain position information
9897such as the start line, the end line or even the source code at the expansion
9998point.
@@ -117,10 +116,10 @@ def macroImpl()(qctx: QuoteContext): Expr[Unit] = {
117116### Tree Utilities
118117
119118`scala.tasty.reflect` contains three facilities for tree traversal and
120- transformations .
119+ transformation .
121120
122121`TreeAccumulator` ties the knot of a traversal. By calling `foldOver(x, tree))`
123- we can dive in the `tree` node and start accumulating values of type `X` (e.g.,
122+ we can dive into the `tree` node and start accumulating values of type `X` (e.g.,
124123of type List [Symbol ] if we want to collect symbols). The code below, for
125124example, collects the pattern variables of a tree.
126125
@@ -142,8 +141,8 @@ but without returning any value. Finally a `TreeMap` performs a transformation.
142141#### Let
143142
144143`scala.tasty.Reflection` also offers a method `let` that allows us
145- to bind the `rhs` to a `val` and use it in `body`. Additionally , `lets` binds
146- the given `terms` to names and use them in the `body`. Their type definitions
144+ to bind the `rhs` (right - hand side) to a `val` and use it in `body`. Additionally , `lets` binds
145+ the given `terms` to names and allows to use them in the `body`. Their type definitions
147146are shown below :
148147
149148```scala
0 commit comments