All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scalajs.linker.interface.unstable.ModuleInitializerImpl.scala Maven / Gradle / Ivy

There is a newer version: 1.17.0
Show newest version
/*
 * Scala.js (https://www.scala-js.org/)
 *
 * Copyright EPFL.
 *
 * Licensed under Apache License 2.0
 * (https://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package org.scalajs.linker.interface.unstable

import org.scalajs.ir.Names._

import org.scalajs.linker.interface.ModuleInitializer

/** A module initializer for a Scala.js application.
 *
 *  When linking a Scala.js application, a sequence of `ModuleInitializer`s can
 *  be given. Those module initializers will be executed at the startup of the
 *  application. More specifically, the top-level code of the ECMAScript 2015
 *  module emitted for the application will invoke the specified module
 *  initializers in the specified order, after having initialized everything
 *  else (notably static initializers).
 *
 *  Instances of `ModuleInitializer` can be created with methods of
 *  [[ModuleInitializer$ the ModuleInitializer companion object]].
 */
sealed abstract class ModuleInitializerImpl extends ModuleInitializer {
  private[interface] def impl: ModuleInitializerImpl = this
}

object ModuleInitializerImpl {
  def fromModuleInitializer(mi: ModuleInitializer): ModuleInitializerImpl = mi.impl

  final case class VoidMainMethod(className: ClassName,
      encodedMainMethodName: MethodName)
      extends ModuleInitializerImpl

  final case class MainMethodWithArgs(className: ClassName,
      encodedMainMethodName: MethodName, args: List[String])
      extends ModuleInitializerImpl
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy