2 * Abstract Syntax Tree Node for a Member Value of an Annotation
5 #include "ast_annotation_member.h"
10 #include "ast_enum_val.h"
12 AST_Decl::NodeType
const AST_Annotation_Member::NT
=
13 AST_Decl::NT_annotation_member
;
15 AST_Annotation_Member::AST_Annotation_Member (
16 AST_Expression::ExprType expr_type
, AST_Type
*type
, UTL_ScopedName
*name
)
17 : AST_Decl (NT
, name
),
18 AST_Field (type
, name
, vis_NA
),
19 expr_type_ (expr_type
),
24 AST_Annotation_Member::AST_Annotation_Member (
25 AST_Decl::NodeType nt
,
26 AST_Expression::ExprType expr_type
, AST_Type
*type
, UTL_ScopedName
*name
)
27 : AST_Decl (nt
, name
),
28 AST_Field (nt
, type
, name
, vis_NA
),
29 expr_type_ (expr_type
),
34 AST_Annotation_Member::AST_Annotation_Member (
36 AST_Annotation_Member
*other
)
37 : AST_Decl (name
, dynamic_cast<AST_Decl
*>(other
)),
38 AST_Field (name
, dynamic_cast<AST_Field
*>(other
)),
39 expr_type_ (other
->expr_type ()),
40 value_ (other
->value () ?
41 new AST_Expression (other
->value (), other
->expr_type ()) : 0)
45 AST_Annotation_Member::~AST_Annotation_Member ()
51 AST_Annotation_Member::destroy ()
57 AST_Field::destroy ();
60 IMPL_NARROW_FROM_DECL (AST_Annotation_Member
);
61 IMPL_NARROW_FROM_SCOPE (AST_Annotation_Member
);
64 AST_Annotation_Member::dump (ACE_OSTREAM_TYPE
&o
)
67 if (field_type () && value_
)
69 dump_i (o
, " default ");
70 if (field_type ()->node_type () == AST_Decl::NT_enum
)
72 dynamic_cast<AST_Enum
*> (field_type ())->
73 lookup_by_value (value_
)->name ()->dump (o
);
83 AST_Annotation_Member::value ()
89 AST_Annotation_Member::value (AST_Expression
*value
)
100 AST_Expression::ExprType
101 AST_Annotation_Member::expr_type ()
107 AST_Annotation_Member::invalid_value ()
109 return !value () || !value ()->ev ();