| 404 | } |
| 405 | |
| 406 | LogicalResult |
| 407 | serializeFunctionType(FunctionType type, EncodingWriter &writer) { |
| 408 | // Write the function type with tag |
| 409 | writer.writeVarInt(Bytecode::TypeTag::FunctionType); |
| 410 | // Using VarInt for numParams per spec |
| 411 | uint64_t numInputs = type.getNumInputs(); |
| 412 | writer.writeVarInt(numInputs); |
| 413 | // Serialize input types |
| 414 | for (Type input : type.getInputs()) |
| 415 | if (failed(writeTypeIndex(input, writer))) |
| 416 | return failure(); |
| 417 | // Using VarInt for numResults per spec |
| 418 | uint64_t numResults = type.getNumResults(); |
| 419 | writer.writeVarInt(numResults); |
| 420 | // Serialize result types |
| 421 | for (Type result : type.getResults()) |
| 422 | if (failed(writeTypeIndex(result, writer))) |
| 423 | return failure(); |
| 424 | return success(); |
| 425 | } |
| 426 | |
| 427 | // Helper to recursively register dependent types before the main type. |
| 428 | void registerDependentTypes(Type type) { |
nothing calls this directly
no test coverage detected