diff --git a/src/ID.cc b/src/ID.cc index 95da8e6568..e39de42804 100644 --- a/src/ID.cc +++ b/src/ID.cc @@ -114,7 +114,6 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export) offset = 0; infer_return_type = false; - weak_ref = false; SetLocationInfo(&start_location, &end_location); } @@ -122,9 +121,6 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export) ID::~ID() { delete [] name; - - if ( weak_ref ) - val.release(); } std::string ID::ModuleName() const @@ -139,17 +135,12 @@ void ID::SetType(IntrusivePtr t) void ID::ClearVal() { - if ( weak_ref ) - val.release(); + val = nullptr; } -void ID::SetVal(IntrusivePtr v, bool arg_weak_ref) +void ID::SetVal(IntrusivePtr v) { - if ( weak_ref ) - val.release(); - val = std::move(v); - weak_ref = arg_weak_ref; Modified(); #ifdef DEBUG diff --git a/src/ID.h b/src/ID.h index efd3aa655a..a051a9a47c 100644 --- a/src/ID.h +++ b/src/ID.h @@ -67,15 +67,7 @@ public: void MakeType() { is_type = true; } - // If weak_ref is false, the Val is assumed to be already ref'ed - // and will be deref'ed when the ID is deleted. - // - // If weak_ref is true, we store the Val but don't ref/deref it. - // That means that when the ID becomes the only one holding a - // reference to the Val, the Val will be destroyed (naturally, - // you have to take care that it will not be accessed via - // the ID afterwards). - void SetVal(IntrusivePtr v, bool weak_ref = false); + void SetVal(IntrusivePtr v); void SetVal(IntrusivePtr v, init_class c); void SetVal(IntrusivePtr ev, init_class c); @@ -153,7 +145,6 @@ protected: IDScope scope; bool is_export; bool infer_return_type; - bool weak_ref; IntrusivePtr type; bool is_const, is_enum_const, is_type, is_option; int offset;