samples: add scala compiler options. fix warnings (#856)

This commit is contained in:
kenji yoshida 2023-11-09 17:27:28 +09:00 committed by GitHub
parent 083ecbdad2
commit da8c50e474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -29,3 +29,10 @@ teavm.js {
addedToWebApp = true addedToWebApp = true
mainClass = "org.teavm.samples.scala.Client" mainClass = "org.teavm.samples.scala.Client"
} }
tasks.withType<ScalaCompile> {
scalaCompileOptions.additionalParameters = listOf(
"-feature",
"-deprecation",
)
}

View File

@ -6,7 +6,7 @@ import org.teavm.jso.dom.html._
import org.teavm.samples.scala.Calculator.{eval, parse, print} import org.teavm.samples.scala.Calculator.{eval, parse, print}
object Client { object Client {
def main(args: Array[String]) { def main(args: Array[String]): Unit = {
val doc = HTMLDocument.current val doc = HTMLDocument.current
val exprElem = doc.getElementById("expr").asInstanceOf[HTMLInputElement] val exprElem = doc.getElementById("expr").asInstanceOf[HTMLInputElement]
val calcElem = doc.getElementById("calculate") val calcElem = doc.getElementById("calculate")

View File

@ -17,11 +17,11 @@ trait Rule[T] {
def |(other: => Rule[T]): Rule[T] = Rule.firstOf(this, other) def |(other: => Rule[T]): Rule[T] = Rule.firstOf(this, other)
def *(): Rule[List[T]] = Rule.unlimited(this) def * : Rule[List[T]] = Rule.unlimited(this)
def >>[S](f: T => S): Rule[S] = Rule.andThen(this, f) def >>[S](f: T => S): Rule[S] = Rule.andThen(this, f)
def ?(): Rule[Option[T]] = Rule.optional(this) def ? : Rule[Option[T]] = Rule.optional(this)
def debug(str: String) = Rule.rule { x => def debug(str: String) = Rule.rule { x =>
val (result, rem) = parse(x) val (result, rem) = parse(x)