Class NameCustomSection


  • public class NameCustomSection
    extends CustomSection
    The "name" custom section.
    • Constructor Detail

      • NameCustomSection

        public NameCustomSection​(String moduleName,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> funcNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.ListEntry<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry>> localNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.ListEntry<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry>> labelNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> tableNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> memoryNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> globalNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> elementNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> dataNames,
                                 List<com.dylibso.chicory.wasm.types.NameCustomSection.NameEntry> tagNames)
        Construct a section instance from the specified contents.
    • Method Detail

      • parse

        public static NameCustomSection parse​(byte[] bytes)
        Parse a new instance from a byte array.
        Parameters:
        bytes - the byte content of the section
      • moduleName

        public String moduleName()
        Returns:
        the module name, or null if none is set
      • nameOfFunction

        public String nameOfFunction​(int functionIdx)
        Returns:
        the name of the function with the given index, or null if none is set
      • functionNameCount

        public int functionNameCount()
        Returns:
        the number of function names in this section This value does not have any relationship to the function index of any particular entry; it merely reflects the number of function names in this section. Used for testing.
      • nameOfLocal

        public String nameOfLocal​(int functionIdx,
                                  int localIdx)
        Returns:
        the name of the local with the given index within the function with the given index, or null if none is set
      • nameOfLabel

        public String nameOfLabel​(int functionIdx,
                                  int labelIdx)
        Returns:
        the name of the local with the given index within the function with the given index, or null if none is set
      • nameOfTable

        public String nameOfTable​(int tableIdx)
        Returns:
        the name of the table with the given index, or null if none is set
      • nameOfMemory

        public String nameOfMemory​(int memoryIdx)
        Returns:
        the name of the memory with the given index, or null if none is set
      • nameOfGlobal

        public String nameOfGlobal​(int globalIdx)
        Returns:
        the name of the global with the given index, or null if none is set
      • nameOfElement

        public String nameOfElement​(int elementIdx)
        Returns:
        the name of the element with the given index, or null if none is set
      • nameOfData

        public String nameOfData​(int dataIdx)
        Returns:
        the name of the data segment with the given index, or null if none is set
      • nameOfTag

        public String nameOfTag​(int tagIdx)
        Returns:
        the name of the tag with the given index, or null if none is set
      • addFunctionName

        public String addFunctionName​(int functionIdx,
                                      String name)
        Add a function name to this section.
        Parameters:
        functionIdx - the index of the function to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addLocalName

        public String addLocalName​(int functionIdx,
                                   int localIdx,
                                   String name)
        Add a local name to this section.
        Parameters:
        functionIdx - the index of the function containing the local
        localIdx - the index of the local to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addLabelName

        public String addLabelName​(int functionIdx,
                                   int labelIdx,
                                   String name)
        Add a label name to this section.
        Parameters:
        functionIdx - the index of the function containing the label
        labelIdx - the index of the label to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addTableName

        public String addTableName​(int tableIdx,
                                   String name)
        Add a table name to this section.
        Parameters:
        tableIdx - the index of the table to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addMemoryName

        public String addMemoryName​(int memoryIdx,
                                    String name)
        Add a memory name to this section.
        Parameters:
        memoryIdx - the index of the memory to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addGlobalName

        public String addGlobalName​(int globalIdx,
                                    String name)
        Add a global name to this section.
        Parameters:
        globalIdx - the index of the global to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addElementName

        public String addElementName​(int elementIdx,
                                     String name)
        Add an element name to this section.
        Parameters:
        elementIdx - the index of the element to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addDataName

        public String addDataName​(int dataIdx,
                                  String name)
        Add a data segment name to this section.
        Parameters:
        dataIdx - the index of the data segment to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addTagName

        public String addTagName​(int tagIdx,
                                 String name)
        Add a tag name to this section.
        Parameters:
        tagIdx - the index of the tag to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none