Fixed root_type not accepting namespaced types.

Change-Id: I272f377742cc0a2c1bfccaa641b54eb9a8c762b6
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen 2015-12-09 16:41:12 -08:00
parent c44bc6a719
commit 4dcaec7938
1 changed files with 5 additions and 2 deletions

View File

@ -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)