hamzaremmal/amy

View on GitHub
compiler/src/main/scala/amyc/utils/Preconditions.scala

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
package amyc.utils

import amyc.*
import amyc.core.Context

object Preconditions {

  inline def require(cc: Boolean)(using Context): Unit =
    if !cc then reporter.fatal(s"require error")

  inline def require[A](cc: Boolean)(body: => A)(using Context): A =
    if(cc)
      body
    else
      reporter.fatal("require error")


}