Emit the correct Alias on the key (#908) (#929)

This commit is contained in:
Chen
2020-07-28 02:49:04 +08:00
committed by GitHub
parent 1c9abc8fa4
commit 98acc5a887
4 changed files with 30 additions and 0 deletions

View File

@@ -504,6 +504,9 @@ void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
if (m_stream.comment())
m_stream << "\n";
m_stream << IndentTo(lastIndent);
if (m_pState->HasAlias()) {
m_stream << " ";
}
m_stream << ":";
}
@@ -643,6 +646,9 @@ void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
if (!m_pState->HasBegunNode()) {
if (m_pState->HasAlias()) {
m_stream << " ";
}
m_stream << ":";
}
@@ -864,6 +870,8 @@ Emitter& Emitter::Write(const _Alias& alias) {
StartedScalar();
m_pState->SetAlias();
return *this;
}