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

org.scalajs.ir.EntryPointsInfo.scala Maven / Gradle / Ivy

There is a newer version: 1.16.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.ir

import Names.ClassName
import Trees._

final class EntryPointsInfo(
    val className: ClassName,
    val hasEntryPoint: Boolean
)

object EntryPointsInfo {
  def forClassDef(classDef: ClassDef): EntryPointsInfo = {
    val hasEntryPoint = {
      classDef.topLevelExportDefs.nonEmpty ||
      classDef.methods.exists(m =>
          m.flags.namespace == MemberNamespace.StaticConstructor &&
          m.methodName.isStaticInitializer)
    }
    new EntryPointsInfo(classDef.name.name, hasEntryPoint)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy