Fix CommentedTypeDecl to track whether it's in a record like TypeDecl does.

This commit is contained in:
Jon Siwek 2011-05-12 19:55:26 -05:00
parent da5618b9ba
commit 70e14cb7d5
4 changed files with 14 additions and 4 deletions

View file

@ -848,8 +848,8 @@ void TypeDecl::DescribeReST(ODesc* d) const
} }
CommentedTypeDecl::CommentedTypeDecl(BroType* t, const char* i, CommentedTypeDecl::CommentedTypeDecl(BroType* t, const char* i,
attr_list* attrs, std::list<std::string>* cmnt_list) attr_list* attrs, bool in_record, std::list<std::string>* cmnt_list)
: TypeDecl(t, i, attrs) : TypeDecl(t, i, attrs, in_record)
{ {
comments = cmnt_list; comments = cmnt_list;
} }

View file

@ -420,7 +420,7 @@ public:
class CommentedTypeDecl : public TypeDecl { class CommentedTypeDecl : public TypeDecl {
public: public:
CommentedTypeDecl(BroType* t, const char* i, attr_list* attrs = 0, CommentedTypeDecl(BroType* t, const char* i, attr_list* attrs = 0,
std::list<std::string>* cmnt_list = 0); bool in_record = false, std::list<std::string>* cmnt_list = 0);
virtual ~CommentedTypeDecl(); virtual ~CommentedTypeDecl();
void DescribeReST(ODesc* d) const; void DescribeReST(ODesc* d) const;

View file

@ -936,6 +936,7 @@ type_decl:
if ( generate_documentation ) if ( generate_documentation )
{ {
// TypeDecl ctor deletes the attr list, so make a copy
attr_list* a = $5; attr_list* a = $5;
attr_list* a_copy = 0; attr_list* a_copy = 0;
@ -947,7 +948,7 @@ type_decl:
} }
last_fake_type_decl = new CommentedTypeDecl( last_fake_type_decl = new CommentedTypeDecl(
$4, $2, a_copy, concat_opt_docs($1, $7)); $4, $2, a_copy, (in_record > 0), concat_opt_docs($1, $7));
} }
$$ = new TypeDecl($4, $2, $5, (in_record > 0)); $$ = new TypeDecl($4, $2, $5, (in_record > 0));

View file

@ -0,0 +1,9 @@
# @TEST-EXEC: bro --doc-scripts %INPUT
type Tag: enum {
SOMETHING
};
type R: record {
field1: set[Tag] &default=set();
};