Skip to content

Commit

Permalink
Move some shared definitions back to src/main/scala/
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Feb 4, 2021
1 parent a15c08f commit 6208f80
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,15 @@ object AmmonitePlugin{
val sym = t.symbol
(sym.isType, sym.decodedName, sym.decodedName, Seq())
}
val ignoredSyms = Set(
"package class-use",
"object package-info",
"class package-info"
)
val ignoredNames = Set(
// Probably synthetic
"<init>",
"<clinit>",
"$main",
// Don't care about this
"toString",
// Behaves weird in 2.10.x, better to just ignore.
"_"
)
def saneSym(sym: g.Symbol): Boolean = {
!sym.name.decoded.contains('$') &&
sym.exists &&
!sym.isSynthetic &&
!sym.isPrivate &&
!sym.isProtected &&
sym.isPublic &&
!ignoredSyms(sym.toString) &&
!ignoredNames(sym.name.decoded)
!CompilerUtil.ignoredSyms(sym.toString) &&
!CompilerUtil.ignoredNames(sym.name.decoded)
}

val stats = {
Expand Down Expand Up @@ -272,7 +257,7 @@ object AmmonitePlugin{

val open = for {
((fromName, toName, importString), items) <- grouped
if !ignoredNames(fromName)
if !CompilerUtil.ignoredNames(fromName)
} yield {
val importType = items match{
case Seq(true) => ImportData.Type
Expand Down
21 changes: 21 additions & 0 deletions amm/compiler/src/main/scala/ammonite/compiler/CompilerUtil.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ammonite.compiler

object CompilerUtil {

val ignoredSyms = Set(
"package class-use",
"object package-info",
"class package-info"
)
val ignoredNames = Set(
// Probably synthetic
"<init>",
"<clinit>",
"$main",
// Don't care about this
"toString",
// Behaves weird in 2.10.x, better to just ignore.
"_"
)

}

0 comments on commit 6208f80

Please sign in to comment.