* Get type index from type key. * @param typeKey The type key. * @returns The corresponding type index.
(
typeKey: string
)
| 1717 | * @returns The corresponding type index. |
| 1718 | */ |
| 1719 | typeKey2Index( |
| 1720 | typeKey: string |
| 1721 | ): number { |
| 1722 | const stack = this.lib.getOrAllocCallStack(); |
| 1723 | const typeKeyOffset = stack.allocByteArrayForString(typeKey); |
| 1724 | const outOffset = stack.allocPtrArray(1); |
| 1725 | const outPtr = stack.ptrFromOffset(outOffset); |
| 1726 | |
| 1727 | stack.commitToWasmMemory(outOffset); |
| 1728 | this.lib.checkCall( |
| 1729 | (this.lib.exports.TVMFFITypeKeyToIndex as ctypes.FTVMFFITypeKeyToIndex)( |
| 1730 | stack.ptrFromOffset(typeKeyOffset), |
| 1731 | outPtr |
| 1732 | ) |
| 1733 | ); |
| 1734 | const typeIndex = this.memory.loadU32(outPtr); |
| 1735 | this.lib.recycleCallStack(stack); |
| 1736 | return typeIndex; |
| 1737 | } |
| 1738 | |
| 1739 | /** |
| 1740 | * Register an object constructor. |
no test coverage detected