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

Function FormatErrorsToString

src/error-formatter.cc:85–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83} // End of anonymous namespace
84
85std::string FormatErrorsToString(const Errors& errors,
86 Location::Type location_type,
87 LexerSourceLineFinder* line_finder,
88 const Color& color,
89 const std::string& header,
90 PrintHeader print_header,
91 int source_line_max_length) {
92 std::string result;
93 for (const auto& error : errors) {
94 if (!header.empty()) {
95 switch (print_header) {
96 case PrintHeader::Never:
97 break;
98 case PrintHeader::Once:
99 print_header = PrintHeader::Never;
100 [[fallthrough]];
101 case PrintHeader::Always:
102 result += header;
103 result += ":\n";
104 break;
105 }
106 }
107
108 int indent = header.empty() ? 0 : 2;
109
110 result += FormatError(error, location_type, color, line_finder,
111 source_line_max_length, indent);
112 }
113 return result;
114}
115
116void FormatErrorsToFile(const Errors& errors,
117 Location::Type location_type,

Callers 4

FormatErrorsToFileFunction · 0.85
ReadModuleMethod · 0.85
wabt_format_text_errorsFunction · 0.85

Calls 2

FormatErrorFunction · 0.85
emptyMethod · 0.45

Tested by 1

ReadModuleMethod · 0.68