forked from dotty-staging/dotty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3922cce
commit 66a3409
Showing
4 changed files
with
46 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package dotty.tools | ||
|
||
import java.io.File | ||
|
||
import scala.io.Source | ||
|
||
object StdLibSources { | ||
|
||
def whitelistFile: String = "./test/dotc/scala-collections.whitelist" | ||
def blacklistFile: String = "./test/dotc/scala-collections.blacklist" | ||
|
||
def whitelisted: List[String] = loadList(whitelistFile) | ||
def blacklisted: List[String] = loadList(blacklistFile) | ||
|
||
def all: List[String] = { | ||
def collectAllFilesInDir(dir: File, acc: List[String]): List[String] = { | ||
val files = dir.listFiles() | ||
val acc2 = files.foldLeft(acc)((acc1, file) => if (file.isFile && file.getPath.endsWith(".scala")) file.getPath :: acc1 else acc1) | ||
files.foldLeft(acc2)((acc3, file) => if (file.isDirectory) collectAllFilesInDir(file, acc3) else acc3) | ||
} | ||
collectAllFilesInDir(new File("../scala-scala/src/library/"), Nil) | ||
} | ||
|
||
private def loadList(path: String): List[String] = Source.fromFile(path, "UTF8").getLines() | ||
.map(_.trim) // allow identation | ||
.filter(!_.startsWith("#")) // allow comment lines prefixed by # | ||
.map(_.takeWhile(_ != '#').trim) // allow comments in the end of line | ||
.filter(_.nonEmpty) | ||
.toList | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters