summaryrefslogtreecommitdiff
path: root/test/files/run/memberpos.check
Commit message (Collapse)AuthorAgeFilesLines
* Merge v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-masterJason Zaugg2013-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | ================================================================ Merge commit 'v2.10.1-326-g4f8c306' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala ================================================================ Merge -s ours 4e64a27 ([nomaster commit range]) ================================================================ Merge commit '0ae7e55' into merge/v2.10.1-326-g4f8c306-to-master Conflicts: src/compiler/scala/tools/nsc/typechecker/Macros.scala
* -Yshow-member-pos, print the positions of members.Paul Phillips2013-04-201-0/+11
Here for instance is a command line which leverages the output of this option to print the method bodies of all methods called 'transformInfo' found under src. Given 1500 source files it accomplishes this in four seconds, thanks to -Ystop-after:parser. % scalac -Yshow-member-pos sed -Ystop-after:parser \ $(find src/compiler -name '*.scala') | \ grep transformInfo | sed 's/ # .*//;' | \ while read line; do echo "// $line" && gsed -n $line && echo; done Or more simply, the start/end lines of each member of Random: % scalac -Yshow-member-pos "" ./src/library/scala/util/Random.scala ./src/library/scala/util/Random.scala 20,134 class Random 33 def nextBoolean 38 def nextBytes 43 def nextDouble 48 def nextFloat 54 def nextGaussian 59 def nextInt 65 def nextInt 70 def nextLong 81,89 def nextString 82,86 def safeChar 83 val surrogateStart 84 val res 94,98 def nextPrintableChar [snip] It makes me sad I'm always in the position of having to hack the compiler to do this sort of thing. All we need is something like -Yinsert-phase:Foo where Foo is a class implementing a (Phase, Tree) => Tree method, and the compiler runs all the unit.bodies through it after each phase, and then one could easily accomplish this in the privacy of one's own compiler.