File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 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] =>
134134 case _ => argss
135135 loop(tree, Nil )
136136
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+
137145 /** All type and term arguments of an application in a single flattened list */
138146 def allArguments (tree : Tree ): List [Tree ] = unsplice(tree) match {
139147 case Apply (fn, args) => allArguments(fn) ::: args
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ object Annotations {
3131 def derivedAnnotation (tree : Tree )(using Context ): Annotation =
3232 if (tree eq this .tree) this else Annotation (tree)
3333
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)
3636
3737 def argument (i : Int )(using Context ): Option [Tree ] = {
3838 val args = arguments
@@ -55,7 +55,7 @@ object Annotations {
5555 * type, since ranges cannot be types of trees.
5656 */
5757 def mapWith (tm : TypeMap )(using Context ) =
58- val args = arguments
58+ val args = tpd.allArguments(tree)
5959 if args.isEmpty then this
6060 else
6161 // 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