Class JSModuleRecord


public class JSModuleRecord extends CyclicModuleRecord
Source Text Module Record.
  • Constructor Details

  • Method Details

    • getModule

      public Module getModule()
    • getModuleLoader

      public JSModuleLoader getModuleLoader()
    • getFunctionData

      public JSFunctionData getFunctionData()
    • getModuleData

      public JSModuleData getModuleData()
    • getImportMetaOrNull

      public JSObject getImportMetaOrNull()
    • getImportMeta

      public JSObject getImportMeta(CreateImportMetaNode createImportMeta)
    • getURL

      public String getURL()
    • getModuleSource

      public Object getModuleSource()
      Specified by:
      getModuleSource in class AbstractModuleRecord
    • getExportedNames

      public Collection<com.oracle.truffle.api.strings.TruffleString> getExportedNames(Set<JSModuleRecord> exportStarSet)
      Specified by:
      getExportedNames in class AbstractModuleRecord
    • resolveExport

      public ExportResolution resolveExport(com.oracle.truffle.api.strings.TruffleString exportName, Set<Pair<? extends AbstractModuleRecord, com.oracle.truffle.api.strings.TruffleString>> resolveSet)
      ResolveExport attempts to resolve an imported binding to the actual defining module and local binding name. The defining module may be the module represented by the Module Record this method was invoked on or some other module that is imported by that module. The parameter resolveSet is use to detect unresolved circular import/export paths. If a pair consisting of specific Module Record and exportName is reached that is already in resolveSet, an import circularity has been encountered. Before recursively calling ResolveExport, a pair consisting of module and exportName is added to resolveSet. If a defining module is found a Record {[[module]], [[bindingName]]} is returned. This record identifies the resolved binding of the originally requested export. If no definition was found or the request is found to be circular, null is returned. If the request is found to be ambiguous, the string "ambiguous" is returned.
      Specified by:
      resolveExport in class AbstractModuleRecord
    • getRequestedModules

      public List<Module.ModuleRequest> getRequestedModules()
      Description copied from class: CyclicModuleRecord
      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.
      Specified by:
      getRequestedModules in class CyclicModuleRecord
    • loadRequestedModules

      public JSPromiseObject loadRequestedModules(JSRealm realm, Object hostDefinedArg)
      Description copied from class: AbstractModuleRecord
      Prepares the module for linking by recursively loading all its dependencies.
      Specified by:
      loadRequestedModules in class AbstractModuleRecord
    • initializeEnvironment

      public void initializeEnvironment(JSRealm realm)
      Description copied from class: CyclicModuleRecord
      Initialize the Environment Record of the module, including resolving all imported bindings, and create the module's execution context.
      Specified by:
      initializeEnvironment in class CyclicModuleRecord
    • executeModule

      public Object executeModule(JSRealm realm, PromiseCapabilityRecord capability)
      Description copied from class: CyclicModuleRecord
      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.
      Specified by:
      executeModule in class CyclicModuleRecord
    • rememberImportedModuleSource

      public void rememberImportedModuleSource(com.oracle.truffle.api.strings.TruffleString moduleSpecifier, com.oracle.truffle.api.source.Source moduleSource)
      Description copied from class: ScriptOrModule
      Keep a link from the referencing module or script to the imported module's Source, so that the latter is kept alive for the lifetime of the former.
      Overrides:
      rememberImportedModuleSource in class ScriptOrModule
    • toString

      public String toString()
      Overrides:
      toString in class Object