From c0441e7c7a5c908e2e8e0e6c8ee06bb33b224160 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 21 May 2017 23:32:11 -0400 Subject: [PATCH] YAML fix for last fix --- atdna/main.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/atdna/main.cpp b/atdna/main.cpp index ec3e31a..820bf6b 100644 --- a/atdna/main.cpp +++ b/atdna/main.cpp @@ -102,7 +102,6 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor std::string m_fieldName; std::string m_sizeExpr; std::string m_ioOp; - bool m_isDNAType; bool m_output = true; YAMLFieldNode(Type tp) : m_type(tp) {} @@ -125,17 +124,10 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor out << " }\n"; break; case Type::Value: - if (m_isDNAType) - { - out << " " << m_fieldName << "." << m_ioOp << ";\n"; - } + if (!p) + out << " " << m_fieldName << " = " << m_ioOp << ";\n"; else - { - if (!p) - out << " " << m_fieldName << " = " << m_ioOp << ";\n"; - else - out << " " << m_ioOp << "\n"; - } + out << " " << m_ioOp << "\n"; break; case Type::VectorRefSize: if (!p) @@ -2041,11 +2033,20 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor if (ioOp.empty()) continue; - outputNodes.emplace_back(YAMLFieldNode::Type::Value); - YAMLFieldNode& outNode = outputNodes.back(); - outNode.m_fieldName = fieldName; - outNode.m_isDNAType = isDNAType; - outNode.m_ioOp = ioOp; + if (isDNAType) + { + outputNodes.emplace_back(YAMLFieldNode::Type::Record); + YAMLFieldNode& outNode = outputNodes.back(); + outNode.m_fieldName = fieldName; + outNode.m_fieldNameBare = fieldNameBare; + } + else + { + outputNodes.emplace_back(YAMLFieldNode::Type::Value); + YAMLFieldNode& outNode = outputNodes.back(); + outNode.m_fieldName = fieldName; + outNode.m_ioOp = ioOp; + } } else if (!tsDecl->getName().compare("Vector")) {