Skip to content

Commit 24c684b

Browse files
committed
fix(reflect): actually return the parent
1 parent 7f41437 commit 24c684b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

source/reflect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ declaration_base::declaration_base(declaration_base const& that)
940940
[[nodiscard]] auto declaration::as_type() const& -> type_declaration { return type_declaration(n, (*this)); }
941941
[[nodiscard]] auto declaration::as_alias() const& -> alias_declaration { return alias_declaration(n, (*this)); }
942942

943-
[[nodiscard]] auto declaration::get_parent() const& -> declaration { return declaration(n, (*this)); }
943+
[[nodiscard]] auto declaration::get_parent() const& -> declaration { return declaration((*cpp2::assert_not_null(n)).parent_declaration, (*this)); }
944944

945945
[[nodiscard]] auto declaration::parent_is_function() const& -> bool { return CPP2_UFCS_0(parent_is_function, (*cpp2::assert_not_null(n))); }
946946
[[nodiscard]] auto declaration::parent_is_object() const& -> bool { return CPP2_UFCS_0(parent_is_object, (*cpp2::assert_not_null(n))); }

source/reflect.h2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ declaration: @polymorphic_base @copyable type =
272272
as_type : (this) -> type_declaration = type_declaration(n, this);
273273
as_alias : (this) -> alias_declaration = alias_declaration(n, this);
274274

275-
get_parent : (this) -> declaration = declaration(n, this);
275+
get_parent : (this) -> declaration = declaration(n*.parent_declaration, this);
276276

277277
parent_is_function : (this) -> bool = n*.parent_is_function();
278278
parent_is_object : (this) -> bool = n*.parent_is_object();

0 commit comments

Comments
 (0)