From 4dcaec7938e0a9fe9f0451fe296b6151e3554275 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 9 Dec 2015 16:41:12 -0800 Subject: [PATCH] Fixed root_type not accepting namespaced types. Change-Id: I272f377742cc0a2c1bfccaa641b54eb9a8c762b6 Tested: on Linux. --- src/idl_parser.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 663ccd1d2..9b62075de 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -1066,8 +1066,10 @@ void Parser::ParseDecl() { } bool Parser::SetRootType(const char *name) { - root_struct_def_ = structs_.Lookup( - namespaces_.back()->GetFullyQualifiedName(name)); + root_struct_def_ = structs_.Lookup(name); + if (!root_struct_def_) + root_struct_def_ = structs_.Lookup( + namespaces_.back()->GetFullyQualifiedName(name)); return root_struct_def_ != nullptr; } @@ -1440,6 +1442,7 @@ bool Parser::Parse(const char *source, const char **include_paths, Next(); auto root_type = attribute_; Expect(kTokenIdentifier); + ParseNamespacing(&root_type, nullptr); if (!SetRootType(root_type.c_str())) Error("unknown root type: " + root_type); if (root_struct_def_->fixed)