Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed Sep 27, 2024
1 parent 3574d4f commit 1826832
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion frontend/src/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ case class JobAttributes(

val jobAttributes = Var(Option.empty[JobAttributes])

val text = Var(SaveState.readString(SaveState.TEXT_KEY))
val text = Var(SaveState.readString(SaveState.TEXT_KEY, DEFAULT_TEXT))

val generations = Var(
SaveState.readString(SaveState.GENERATIONS_KEY).toIntOption.getOrElse(100)
Expand Down Expand Up @@ -287,3 +287,33 @@ def renderStats(stats: Stats) = div(
li(cls := "ml-2", strong(job.id.toString), " : ", job.hearbeat)
)
)

val DEFAULT_TEXT =
"""
abstract class MemberDefTraverser extends Traverser {
def onMember(defn: MemberDef): Unit
private var depth: Int = 0
private def lower[T](body: => T): T = {
depth += 1
try body finally depth -= 1
}
def currentDepth = depth
/** Prune this tree and all trees beneath it. Can be overridden. */
def prune(md: MemberDef): Boolean = (
md.mods.isSynthetic
|| md.mods.isParamAccessor
|| nme.isConstructorName(md.name)
|| (md.name containsName nme.ANON_CLASS_NAME)
)
override def traverse(t: Tree): Unit = t match {
case md: MemberDef if prune(md) =>
case md @ PackageDef(_, stats) => traverseTrees(stats)
case md: ImplDef => onMember(md) ; lower(traverseTrees(md.impl.body))
case md: ValOrDefDef => onMember(md) ; lower(traverse(md.rhs))
case _ => super.traverse(t)
}
}
"""

0 comments on commit 1826832

Please sign in to comment.