@@ -2859,6 +2859,7 @@ class ExternalItem : public Node
2859
2859
{
2860
2860
Static,
2861
2861
Function,
2862
+ Type,
2862
2863
};
2863
2864
2864
2865
virtual ~ExternalItem () {}
@@ -3084,11 +3085,13 @@ class ExternalFunctionItem : public ExternalItem
3084
3085
3085
3086
// Copy constructor with clone
3086
3087
ExternalFunctionItem (ExternalFunctionItem const &other)
3087
- : ExternalItem (other), return_type (other.return_type->clone_type ()),
3088
- where_clause (other.where_clause),
3088
+ : ExternalItem (other), where_clause (other.where_clause),
3089
3089
function_params (other.function_params),
3090
3090
has_variadics (other.has_variadics)
3091
3091
{
3092
+ if (other.return_type )
3093
+ return_type = other.return_type ->clone_type ();
3094
+
3092
3095
generic_params.reserve (other.generic_params .size ());
3093
3096
for (const auto &e : other.generic_params )
3094
3097
generic_params.push_back (e->clone_generic_param ());
@@ -3098,11 +3101,14 @@ class ExternalFunctionItem : public ExternalItem
3098
3101
ExternalFunctionItem &operator = (ExternalFunctionItem const &other)
3099
3102
{
3100
3103
ExternalItem::operator = (other);
3101
- return_type = other. return_type -> clone_type ();
3104
+
3102
3105
where_clause = other.where_clause ;
3103
3106
function_params = other.function_params ;
3104
3107
has_variadics = other.has_variadics ;
3105
3108
3109
+ if (other.return_type )
3110
+ return_type = other.return_type ->clone_type ();
3111
+
3106
3112
generic_params.reserve (other.generic_params .size ());
3107
3113
for (const auto &e : other.generic_params )
3108
3114
generic_params.push_back (e->clone_generic_param ());
@@ -3144,6 +3150,33 @@ class ExternalFunctionItem : public ExternalItem
3144
3150
}
3145
3151
};
3146
3152
3153
+ class ExternalTypeItem : public ExternalItem
3154
+ {
3155
+ ExternalTypeItem (Analysis::NodeMapping mappings, Identifier item_name,
3156
+ Visibility vis, AST::AttrVec outer_attrs, location_t locus)
3157
+ : ExternalItem (std::move (mappings), std::move (item_name),
3158
+ std::move (vis), std::move (outer_attrs), locus)
3159
+ {}
3160
+
3161
+ ExternalTypeItem (ExternalTypeItem const &other) : ExternalItem (other) {}
3162
+
3163
+ ExternalTypeItem (ExternalTypeItem &&other) = default;
3164
+ ExternalTypeItem &operator = (ExternalTypeItem &&other) = default ;
3165
+
3166
+ std::string as_string () const override ;
3167
+
3168
+ void accept_vis (HIRFullVisitor &vis) override ;
3169
+ void accept_vis (HIRExternalItemVisitor &vis) override ;
3170
+
3171
+ ExternKind get_extern_kind () override { return ExternKind::Type; }
3172
+
3173
+ protected:
3174
+ ExternalTypeItem *clone_external_item_impl () const override
3175
+ {
3176
+ return new ExternalTypeItem (*this );
3177
+ }
3178
+ };
3179
+
3147
3180
// An extern block HIR node
3148
3181
class ExternBlock : public VisItem , public WithInnerAttrs
3149
3182
{
0 commit comments