How to understand this val x={....} sentence?

when reading the source code of play framework, I met this sentence:

val server = {
        type ServerStart = {
          def mainDevHttpAndHttpsMode(
              buildLink: BuildLink,
              httpPort: Int,
              httpsPort: Int,
              httpAddress: String
          ): ReloadableServer

          def mainDevHttpMode(buildLink: BuildLink, httpPort: Int, httpAddress: String): ReloadableServer

          def mainDevOnlyHttpsMode(buildLink: BuildLink, httpsPort: Int, httpAddress: String): ReloadableServer
        }

        import scala.language.reflectiveCalls
        val mainClass  = applicationLoader.loadClass(mainClassName + "$")
        val mainObject = mainClass.getField("MODULE$").get(null).asInstanceOf[ServerStart]

        if (httpPort.isDefined && httpsPort.isDefined) {
          mainObject.mainDevHttpAndHttpsMode(reloader, httpPort.get, httpsPort.get, httpAddress)
        } else if (httpPort.isDefined) {
          mainObject.mainDevHttpMode(reloader, httpPort.get, httpAddress)
        } else {
          mainObject.mainDevOnlyHttpsMode(reloader, httpsPort.get, httpAddress)
        }
      }

what does val server={ code blocks} mean?

it means all the code blocks in the curly bracket will be excuted as sequence and finally return the final expression result to the val server(and the return type is ReloadableServer) ?

or it means a function literal without parameter and the code blocks in the curly bracket will not be executed or evaluated until the function is called?

thanks.

The first one:

it means all the code blocks in the curly bracket will be excuted as sequence and finally return the final expression result to the val server(and the return type is ReloadableServer) ?

2 Likes