(ast, countImportedFunc)
| 132 | * @returns {t.Index} - index |
| 133 | */ |
| 134 | const getNextFuncIndex = (ast, countImportedFunc) => { |
| 135 | const funcSectionMetadata = t.getSectionMetadata(ast, "func"); |
| 136 | |
| 137 | if (funcSectionMetadata === undefined) { |
| 138 | return t.indexLiteral(0 + countImportedFunc); |
| 139 | } |
| 140 | |
| 141 | const vectorOfSize = funcSectionMetadata.vectorOfSize.value; |
| 142 | |
| 143 | return t.indexLiteral(vectorOfSize + countImportedFunc); |
| 144 | }; |
| 145 | |
| 146 | /** |
| 147 | * Creates an init instruction for a global type |