MCPcopy Create free account
hub / github.com/WebAssembly/wabt / ReadTextModule

Method ReadTextModule

src/tools/spectest-interp.cc:1448–1471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1446}
1447
1448wabt::Result CommandRunner::ReadTextModule(std::string_view module_filename,
1449 const std::string& header,
1450 bool validate) {
1451 std::vector<uint8_t> file_data;
1452 wabt::Result result = ReadFile(module_filename, &file_data);
1453 Errors errors;
1454 std::unique_ptr<WastLexer> lexer = WastLexer::CreateBufferLexer(
1455 module_filename, file_data.data(), file_data.size(), &errors);
1456 if (Succeeded(result)) {
1457 std::unique_ptr<wabt::Module> module;
1458 WastParseOptions options(s_features);
1459 result = ParseWatModule(lexer.get(), &module, &errors, &options);
1460
1461 if (validate && Succeeded(result)) {
1462 result =
1463 ValidateModule(module.get(), &errors, ValidateOptions{s_features});
1464 }
1465 }
1466
1467 auto line_finder = lexer->MakeLineFinder();
1468 FormatErrorsToFile(errors, Location::Type::Text, line_finder.get(), stdout,
1469 header, PrintHeader::Once);
1470 return result;
1471}
1472
1473interp::Module::Ptr CommandRunner::ReadModule(std::string_view module_filename,
1474 Errors* errors) {

Callers

nothing calls this directly

Calls 9

ReadFileFunction · 0.85
SucceededFunction · 0.85
ParseWatModuleFunction · 0.85
ValidateModuleFunction · 0.85
FormatErrorsToFileFunction · 0.85
dataMethod · 0.80
MakeLineFinderMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected