1 #include "fe_home_header.h"
3 #include "global_extern.h"
8 #include "ast_component.h"
9 #include "ast_valuetype.h"
10 #include "ast_param_holder.h"
12 FE_HomeHeader::FE_HomeHeader (UTL_ScopedName
*n
,
13 UTL_ScopedName
*base_home
,
14 UTL_NameList
*supports
,
15 UTL_ScopedName
*managed_component
,
16 UTL_ScopedName
*primary_key
)
17 : FE_ComponentHeader (n
,
24 // No need to call compile_supports(), it got done in
25 // the call to the base class FE_ComponentHeader.
26 this->compile_inheritance (base_home
);
27 this->compile_managed_component (managed_component
);
28 this->compile_primary_key (primary_key
);
31 FE_HomeHeader::~FE_HomeHeader (void)
36 FE_HomeHeader::base_home (void) const
38 return this->base_home_
;
42 FE_HomeHeader::managed_component (void) const
44 return this->managed_component_
;
48 FE_HomeHeader::primary_key (void) const
50 return this->primary_key_
;
54 FE_HomeHeader::compile_inheritance (UTL_ScopedName
*base_home
)
61 UTL_Scope
*s
= idl_global
->scopes ().top_non_null ();
62 AST_Decl
*d
= s
->lookup_by_name (base_home
,
67 idl_global
->err ()->lookup_error (base_home
);
69 // This is probably the result of bad IDL.
70 // We will crash if we continue from here.
74 if (d
->node_type () == AST_Decl::NT_typedef
)
76 d
= dynamic_cast<AST_Typedef
*> (d
)->primitive_base_type ();
79 this->base_home_
= dynamic_cast<AST_Home
*> (d
);
81 if (this->base_home_
== 0)
83 idl_global
->err ()->inheritance_error (this->name (), d
);
88 FE_HomeHeader::compile_managed_component (
89 UTL_ScopedName
*mc_name
)
96 UTL_Scope
*s
= idl_global
->scopes ().top_non_null ();
97 AST_Decl
*d
= s
->lookup_by_name (mc_name
,
102 idl_global
->err ()->lookup_error (mc_name
);
104 // This is probably the result of bad IDL.
105 // We will crash if we continue from here.
109 if (d
->node_type () == AST_Decl::NT_typedef
)
111 d
= dynamic_cast<AST_Typedef
*> (d
)->primitive_base_type ();
114 this->managed_component_
= dynamic_cast<AST_Component
*> (d
);
116 if (this->managed_component_
== 0)
118 idl_global
->err ()->error1 (UTL_Error::EIDL_ILLEGAL_USE
,
124 FE_HomeHeader::compile_primary_key (UTL_ScopedName
*primary_key
)
126 if (primary_key
== 0)
131 UTL_Scope
*s
= idl_global
->scopes ().top_non_null ();
132 AST_Decl
*d
= s
->lookup_by_name (primary_key
,
137 idl_global
->err ()->lookup_error (primary_key
);
139 // This is probably the result of bad IDL.
140 // We will crash if we continue from here.
144 AST_Decl::NodeType nt
= d
->node_type ();
146 if (nt
== AST_Decl::NT_typedef
)
148 d
= dynamic_cast<AST_Typedef
*> (d
)->primitive_base_type ();
151 this->primary_key_
= dynamic_cast<AST_Type
*> (d
);
153 if (this->primary_key_
== 0)
155 idl_global
->err ()->valuetype_expected (d
);
161 case AST_Decl::NT_valuetype
:
163 case AST_Decl::NT_param_holder
:
165 AST_Param_Holder
*ph
=
166 dynamic_cast<AST_Param_Holder
*> (d
);
168 nt
= ph
->info ()->type_
;
170 if (nt
!= AST_Decl::NT_type
171 && nt
!= AST_Decl::NT_valuetype
)
173 idl_global
->err ()->mismatched_template_param (
174 ph
->info ()->name_
.c_str ());
180 idl_global
->err ()->valuetype_expected (d
);