Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Enable fatal warnings everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrd committed Mar 10, 2024
1 parent 1f9b80c commit 7031e1d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
10 changes: 10 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import org.scalajs.linker.interface.OutputPatterns

val scalaV = "2.13.12"

inThisBuild(Def.settings(
scalacOptions ++= Seq(
"-encoding",
"utf-8",
"-feature",
"-deprecation",
"-Xfatal-warnings",
)
))

lazy val cli = project
.in(file("cli"))
.enablePlugins(ScalaJSPlugin)
Expand Down
8 changes: 4 additions & 4 deletions wasm/src/main/scala/ir2wasm/WasmBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class WasmBuilder {
}
}

def transformTopLevelExport(export: LinkedTopLevelExport)(implicit ctx: WasmContext): Unit = {
def transformTopLevelExport(topLevelExport: LinkedTopLevelExport)(implicit ctx: WasmContext): Unit = {
implicit val fctx = WasmFunctionContext()
export.tree match {
topLevelExport.tree match {
case d: IRTrees.TopLevelFieldExportDef => ???
case d: IRTrees.TopLevelJSClassExportDef => ???
case d: IRTrees.TopLevelMethodExportDef => transformToplevelMethodExportDef(d)
Expand Down Expand Up @@ -370,11 +370,11 @@ class WasmBuilder {
)
ctx.addFunction(func)

val export = new WasmExport.Function(
val exprt = new WasmExport.Function(
methodName.value,
func
)
ctx.addExport(export)
ctx.addExport(exprt)
}

private def genFunction(
Expand Down
6 changes: 3 additions & 3 deletions wasm/src/main/scala/wasm4s/Wasm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class WasmModule(
def addFunctionType(typ: WasmFunctionType): Unit = _functionTypes.addOne(typ)
def addRecGroupType(typ: WasmStructType): Unit = _recGroupTypes.addOne(typ)
def addGlobal(typ: WasmGlobal): Unit = _globals.addOne(typ)
def addExport(export: WasmExport[_]) = _exports.addOne(export)
def addExport(exprt: WasmExport[_]) = _exports.addOne(exprt)

def functionTypes = _functionTypes.toList
def recGroupTypes = WasmModule.tsort(_recGroupTypes.toList)
Expand All @@ -157,8 +157,8 @@ object WasmModule {
} else {
val found = noPreds.map { _._1 }.toSet
val updated = hasPreds.map {
case (k, Some(v)) => // should be safe because hasPreds has no None
(k, if (found.contains(v)) None else Some(v))
case (k, v) =>
(k, v.filter(!found.contains(_)))
}
tsort(updated, done ++ found)
}
Expand Down
2 changes: 1 addition & 1 deletion wasm/src/main/scala/wasm4s/WasmContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ trait FunctionTypeWriterWasmContext extends ReadOnlyWasmContext { this: WasmCont

class WasmContext(val module: WasmModule) extends FunctionTypeWriterWasmContext {
import WasmContext._
def addExport(export: WasmExport[_]): Unit = module.addExport(export)
def addExport(exprt: WasmExport[_]): Unit = module.addExport(exprt)
def addFunction(fun: WasmFunction): Unit = {
module.addFunction(fun)
functions.define(fun)
Expand Down

0 comments on commit 7031e1d

Please sign in to comment.