diff --git a/atdna/main.cpp b/atdna/main.cpp index aec931e..ec3e31a 100644 --- a/atdna/main.cpp +++ b/atdna/main.cpp @@ -102,6 +102,7 @@ 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) {} @@ -124,10 +125,17 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor out << " }\n"; break; case Type::Value: - if (!p) - out << " " << m_fieldName << " = " << m_ioOp << ";\n"; + if (m_isDNAType) + { + out << " " << m_fieldName << "." << m_ioOp << ";\n"; + } else - out << " " << m_ioOp << "\n"; + { + if (!p) + out << " " << m_fieldName << " = " << m_ioOp << ";\n"; + else + out << " " << m_ioOp << "\n"; + } break; case Type::VectorRefSize: if (!p) @@ -1300,10 +1308,17 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor } fileOut << " /* " << fieldName << " */\n"; - if (!p) - fileOut << " " << fieldName << " = " << ioOp << ";\n"; + if (isDNAType) + { + fileOut << " " << fieldName << "." << ioOp << ";\n"; + } else - fileOut << " " << ioOp << "\n"; + { + if (!p) + fileOut << " " << fieldName << " = " << ioOp << ";\n"; + else + fileOut << " " << ioOp << "\n"; + } } else if (!tsDecl->getName().compare("Vector")) { @@ -2029,6 +2044,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor outputNodes.emplace_back(YAMLFieldNode::Type::Value); YAMLFieldNode& outNode = outputNodes.back(); outNode.m_fieldName = fieldName; + outNode.m_isDNAType = isDNAType; outNode.m_ioOp = ioOp; } else if (!tsDecl->getName().compare("Vector"))