diff options
Diffstat (limited to 'src/binary-reader-logging.cc')
-rw-r--r-- | src/binary-reader-logging.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc index 8f1cbb1c..801b96b0 100644 --- a/src/binary-reader-logging.cc +++ b/src/binary-reader-logging.cc @@ -99,6 +99,16 @@ void BinaryReaderLogging::LogTypes(TypeVector& types) { LogTypes(types.size(), types.data()); } +void BinaryReaderLogging::LogField(TypeMut field) { + if (field.mutable_) { + LOGF_NOINDENT("(mut "); + } + LogType(field.type); + if (field.mutable_) { + LOGF_NOINDENT(")"); + } +} + bool BinaryReaderLogging::OnError(const Error& error) { return reader_->OnError(error); } @@ -149,13 +159,7 @@ Result BinaryReaderLogging::OnStructType(Index index, LOGF("OnStructType(index: %" PRIindex ", fields: ", index); LOGF_NOINDENT("["); for (Index i = 0; i < field_count; ++i) { - if (fields[i].mutable_) { - LOGF_NOINDENT("(mut "); - } - LogType(fields[i].type); - if (fields[i].mutable_) { - LOGF_NOINDENT(")"); - } + LogField(fields[i]); if (i != field_count - 1) { LOGF_NOINDENT(", "); } @@ -164,6 +168,13 @@ Result BinaryReaderLogging::OnStructType(Index index, return reader_->OnStructType(index, field_count, fields); } +Result BinaryReaderLogging::OnArrayType(Index index, TypeMut field) { + LOGF("OnArrayType(index: %" PRIindex ", field: ", index); + LogField(field); + LOGF_NOINDENT(")\n"); + return reader_->OnArrayType(index, field); +} + Result BinaryReaderLogging::OnImport(Index index, ExternalKind kind, string_view module_name, |