Class CyclicModuleRecord

Direct Known Subclasses:
JSModuleRecord, WebAssemblyModuleRecord

public abstract class CyclicModuleRecord extends AbstractModuleRecord
A Cyclic Module Record is used to represent information about a module that can participate in dependency cycles with other modules that are subclasses of the Cyclic Module Record type. Module Records that are not subclasses of the Cyclic Module Record type must not participate in dependency cycles with Source Text Module Records.
  • Constructor Details

    • CyclicModuleRecord

      protected CyclicModuleRecord(JSContext context, com.oracle.truffle.api.source.Source source, Object hostDefined)
    • CyclicModuleRecord

      protected CyclicModuleRecord(JSContext context, com.oracle.truffle.api.source.Source source, Object hostDefined, boolean hasTLA)
  • Method Details

    • getRequestedModules

      public abstract List<Module.ModuleRequest> getRequestedModules()
      A list of all the ModuleSpecifier strings and import attributes used by the module represented by this record to request the importation of a module, in occurrence order.
    • initializeEnvironment

      public abstract void initializeEnvironment(JSRealm realm)
      Initialize the Environment Record of the module, including resolving all imported bindings, and create the module's execution context.
    • executeModule

      public abstract Object executeModule(JSRealm realm, PromiseCapabilityRecord capability)
      Evaluate the module's code within its execution context. If this module has true in [[HasTLA]], then a PromiseCapability Record is passed as an argument, and the method is expected to resolve or reject the given capability. In this case, the method must not throw an exception, but instead reject the PromiseCapability Record if necessary.
    • evaluate

      public final JSPromiseObject evaluate(JSRealm realm)
      Description copied from class: AbstractModuleRecord
      Returns a promise for the evaluation of this module and its dependencies, resolving on successful evaluation or if it has already been evaluated successfully, and rejecting for an evaluation error or if it has already been evaluated unsuccessfully. Link must have completed successfully prior to invoking this method.
      Specified by:
      evaluate in class AbstractModuleRecord
    • link

      public final void link(JSRealm realm)
      Description copied from class: AbstractModuleRecord
      Prepare the module for evaluation by transitively resolving all module dependencies and creating a Module Environment Record. LoadRequestedModules must have completed successfully prior to invoking this method.
      Specified by:
      link in class AbstractModuleRecord
    • getLoadedModule

      public final AbstractModuleRecord getLoadedModule(JSRealm realm, Module.ModuleRequest moduleRequest)
      Overrides:
      getLoadedModule in class ScriptOrModule
    • addLoadedModule

      public final AbstractModuleRecord addLoadedModule(JSRealm realm, Module.ModuleRequest moduleRequest, AbstractModuleRecord module)
      Overrides:
      addLoadedModule in class ScriptOrModule
    • getImportedModule

      public final AbstractModuleRecord getImportedModule(Module.ModuleRequest moduleRequest)
    • getStatus

      public final CyclicModuleRecord.Status getStatus()
    • setStatus

      public final void setStatus(CyclicModuleRecord.Status status)
    • isLinked

      public final boolean isLinked()
    • hasBeenEvaluated

      public final boolean hasBeenEvaluated()
    • setUnlinked

      public final void setUnlinked()
    • getEvaluationError

      public final Throwable getEvaluationError()
    • setEvaluationError

      public final void setEvaluationError(Throwable evaluationError)
    • getExecutionResult

      public final Object getExecutionResult()
    • setExecutionResult

      public final void setExecutionResult(Object executionResult)
    • getExecutionResultOrThrow

      public final Object getExecutionResultOrThrow()
    • getDFSIndex

      public final int getDFSIndex()
    • setDFSIndex

      public final void setDFSIndex(int dfsIndex)
    • getDFSAncestorIndex

      public final int getDFSAncestorIndex()
    • setDFSAncestorIndex

      public final void setDFSAncestorIndex(int dfsAncestorIndex)
    • getTopLevelCapability

      public final PromiseCapabilityRecord getTopLevelCapability()
    • setTopLevelCapability

      public final void setTopLevelCapability(PromiseCapabilityRecord capability)
    • isAsyncEvaluation

      public final boolean isAsyncEvaluation()
    • setAsyncEvaluation

      public final void setAsyncEvaluation(boolean asyncEvaluation)
    • getAsyncParentModules

      public final List<CyclicModuleRecord> getAsyncParentModules()
    • setPendingAsyncDependencies

      public final void setPendingAsyncDependencies(int value)
    • initAsyncParentModules

      public final void initAsyncParentModules()
    • incPendingAsyncDependencies

      public final void incPendingAsyncDependencies()
    • decPendingAsyncDependencies

      public final void decPendingAsyncDependencies()
    • appendAsyncParentModules

      public final void appendAsyncParentModules(CyclicModuleRecord moduleRecord)
    • getPendingAsyncDependencies

      public final int getPendingAsyncDependencies()
    • setAsyncEvaluatingOrder

      public final void setAsyncEvaluatingOrder(long order)
    • getAsyncEvaluatingOrder

      public final long getAsyncEvaluatingOrder()
    • hasTLA

      public final boolean hasTLA()
    • setCycleRoot

      public final void setCycleRoot(CyclicModuleRecord module)
    • getCycleRoot

      public final CyclicModuleRecord getCycleRoot()