File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
tests/run-custom-args/tasty-inspector Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ method SyncIterator$$super$next
Original file line number Diff line number Diff line change 1+ import scala .quoted .*
2+ import scala .tasty .inspector .*
3+
4+ @ main def Test = {
5+ // Artefact of the current test infrastructure
6+ // TODO improve infrastructure to avoid needing this code on each test
7+ val classpath = dotty.tools.dotc.util.ClasspathFromClassloader (this .getClass.getClassLoader).split(java.io.File .pathSeparator).find(_.contains(" runWithCompiler" )).get
8+ val allTastyFiles = dotty.tools.io.Path (classpath).walkFilter(_.extension == " tasty" ).map(_.toString).toList
9+ val tastyFiles = allTastyFiles.filter(_.contains(" SyncIterator" ))
10+
11+ TastyInspector .inspectTastyFiles(tastyFiles)(new MyInspector )
12+ }
13+
14+ class MyInspector extends Inspector :
15+
16+ override def inspect (using Quotes )(tastys : List [Tasty [quotes.type ]]): Unit =
17+ import quotes .reflect .*
18+ class Traverser extends TreeTraverser :
19+ override def traverseTree (tree : Tree )(owner : Symbol ) =
20+ tree match
21+ case tree : DefDef if tree.symbol.isSuperAccessor =>
22+ println(tree.symbol)
23+ case _ =>
24+ super .traverseTree(tree)(owner)
25+ end Traverser
26+
27+ val traverser = new Traverser
28+ tastys.foreach { tasty =>
29+ traverser.traverseTree(tasty.ast)(tasty.ast.symbol)
30+ }
31+
32+
33+ trait IntIterator {
34+ def next : Int
35+ def drop (n : Int ): Unit
36+ }
37+ trait SyncIterator extends IntIterator {
38+ abstract override def next : Int = super .next
39+ }
You can’t perform that action at this time.
0 commit comments