File tree 2 files changed +11
-3
lines changed
compiler/src/dotty/tools/dotc
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,14 @@ trait TreeInfo[T <: Untyped] { self: Trees.Instance[T] =>
134
134
case _ => argss
135
135
loop(tree, Nil )
136
136
137
+ /** All term arguments of an application in a single flattened list */
138
+ def allTermArguments (tree : Tree ): List [Tree ] = unsplice(tree) match {
139
+ case Apply (fn, args) => allArguments(fn) ::: args
140
+ case TypeApply (fn, args) => allArguments(fn)
141
+ case Block (_, expr) => allArguments(expr)
142
+ case _ => Nil
143
+ }
144
+
137
145
/** All type and term arguments of an application in a single flattened list */
138
146
def allArguments (tree : Tree ): List [Tree ] = unsplice(tree) match {
139
147
case Apply (fn, args) => allArguments(fn) ::: args
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ object Annotations {
31
31
def derivedAnnotation (tree : Tree )(using Context ): Annotation =
32
32
if (tree eq this .tree) this else Annotation (tree)
33
33
34
- /** All type and term arguments to this annotation in a single flat list */
35
- def arguments (using Context ): List [Tree ] = tpd.allArguments (tree)
34
+ /** All term arguments of this annotation in a single flat list */
35
+ def arguments (using Context ): List [Tree ] = tpd.allTermArguments (tree)
36
36
37
37
def argument (i : Int )(using Context ): Option [Tree ] = {
38
38
val args = arguments
@@ -55,7 +55,7 @@ object Annotations {
55
55
* type, since ranges cannot be types of trees.
56
56
*/
57
57
def mapWith (tm : TypeMap )(using Context ) =
58
- val args = arguments
58
+ val args = tpd.allArguments(tree)
59
59
if args.isEmpty then this
60
60
else
61
61
// Checks if `tm` would result in any change by applying it to types
You can’t perform that action at this time.
0 commit comments