Skip to content

Commit a4af761

Browse files
committed
fix: update reflect.h
1 parent 982c83e commit a4af761

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

source/reflect.h

+45-45
Original file line numberDiff line numberDiff line change
@@ -729,14 +729,14 @@ namespace meta {
729729
) ->
730730
std::unique_ptr<statement_node>
731731
{
732-
CPP2_UFCS(&,,(push_back),(generated_lines),(,), std::vector<source_line>());
732+
CPP2_UFCS(&,,(push_back),(generated_lines),(), std::vector<source_line>());
733733
auto lines {&CPP2_UFCS(&,,(back),(generated_lines),())};
734734

735735
auto add_line {[&, _1 = lines](cpp2::in<std::string_view> s) -> void{
736-
(void) CPP2_UFCS(&,,(emplace_back),((*cpp2::assert_not_null(_1))),(,), s, source_line::category::cpp2);
736+
(void) CPP2_UFCS(&,,(emplace_back),((*cpp2::assert_not_null(_1))),(), s, source_line::category::cpp2);
737737
}};
738738
{
739-
auto newline_pos = CPP2_UFCS(&,,(find),(source),(,), '\n');
739+
auto newline_pos = CPP2_UFCS(&,,(find),(source),(), '\n');
740740

741741
// First split this string into source_lines
742742
//
@@ -747,9 +747,9 @@ auto newline_pos = CPP2_UFCS(&,,(find),(source),(,), '\n');
747747
{
748748
while( newline_pos!=std::string_view::npos )
749749
{
750-
add_line(CPP2_UFCS(&,,(substr),(source),(,), 0, newline_pos));
751-
CPP2_UFCS(&,,(remove_prefix),(source),(,), newline_pos + 1);
752-
newline_pos = CPP2_UFCS(&,,(find),(source),(,), '\n');
750+
add_line(CPP2_UFCS(&,,(substr),(source),(), 0, newline_pos));
751+
CPP2_UFCS(&,,(remove_prefix),(source),(), newline_pos + 1);
752+
newline_pos = CPP2_UFCS(&,,(find),(source),(), '\n');
753753
}
754754
}
755755
}
@@ -762,15 +762,15 @@ auto newline_pos = CPP2_UFCS(&,,(find),(source),(,), '\n');
762762
// Now lex this source fragment to generate
763763
// a single grammar_map entry, whose .second
764764
// is the vector of tokens
765-
(void) CPP2_UFCS(&,,(emplace_back),(generated_lexers),(,), *cpp2::assert_not_null(errors));
765+
(void) CPP2_UFCS(&,,(emplace_back),(generated_lexers),(), *cpp2::assert_not_null(errors));
766766
auto tokens {&CPP2_UFCS(&,,(back),(generated_lexers),())};
767-
CPP2_UFCS(&,,(lex),((*cpp2::assert_not_null(tokens))),(,), *cpp2::assert_not_null(std::move(lines)), true);
767+
CPP2_UFCS(&,,(lex),((*cpp2::assert_not_null(tokens))),(), *cpp2::assert_not_null(std::move(lines)), true);
768768

769769
cpp2::Default.expects(std::ssize(CPP2_UFCS(&,,(get_map),((*cpp2::assert_not_null(tokens))),()))==1, "");
770770

771771
// Now parse this single declaration from
772772
// the lexed tokens
773-
return CPP2_UFCS(&,,(parse_one_declaration),(parser),(,),
773+
return CPP2_UFCS(&,,(parse_one_declaration),(parser),(),
774774
(*cpp2::assert_not_null(CPP2_UFCS(&,,(begin),(CPP2_UFCS(&,,(get_map),(*cpp2::assert_not_null(std::move(tokens))),())),()))).second,
775775
*cpp2::assert_not_null(generated_tokens)
776776
);
@@ -799,7 +799,7 @@ auto newline_pos = CPP2_UFCS(&,,(find),(source),(,), '\n');
799799
if (!(CPP2_UFCS(&,,(empty),(meta_function_name),()))) {
800800
message = "while applying @" + meta_function_name + " - " + message;
801801
}
802-
(void) CPP2_UFCS(&,,(emplace_back),((*cpp2::assert_not_null(errors))),(,), position(), std::move(message));
802+
(void) CPP2_UFCS(&,,(emplace_back),((*cpp2::assert_not_null(errors))),(), position(), std::move(message));
803803
}
804804

805805
compiler_services::~compiler_services() noexcept{}
@@ -858,7 +858,7 @@ declaration_base::declaration_base(declaration_base const& that)
858858
[[nodiscard]] auto declaration::make_private() -> bool { return CPP2_UFCS(&,,(make_private),((*cpp2::assert_not_null(n))),()); }
859859

860860
[[nodiscard]] auto declaration::has_name() const -> bool { return CPP2_UFCS(&,,(has_name),((*cpp2::assert_not_null(n))),()); }
861-
[[nodiscard]] auto declaration::has_name(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_name),((*cpp2::assert_not_null(n))),(,), s); }
861+
[[nodiscard]] auto declaration::has_name(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_name),((*cpp2::assert_not_null(n))),(), s); }
862862

863863
[[nodiscard]] auto declaration::name() const -> std::string_view{
864864
if (has_name()) {return CPP2_UFCS(&,,(as_string_view),((*cpp2::assert_not_null(CPP2_UFCS(&,,(name),(*cpp2::assert_not_null(n)),())))),()); }
@@ -906,14 +906,14 @@ declaration::declaration(declaration const& that)
906906
cpp2::Default.expects(CPP2_UFCS(&,,(is_function),((*cpp2::assert_not_null(n))),()), "");
907907
}
908908

909-
[[nodiscard]] auto function_declaration::index_of_parameter_named(cpp2::in<std::string_view> s) const -> int { return CPP2_UFCS(&,,(index_of_parameter_named),((*cpp2::assert_not_null(n))),(,), s); }
910-
[[nodiscard]] auto function_declaration::has_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_parameter_named),((*cpp2::assert_not_null(n))),(,), s); }
911-
[[nodiscard]] auto function_declaration::has_in_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_in_parameter_named),((*cpp2::assert_not_null(n))),(,), s); }
912-
[[nodiscard]] auto function_declaration::has_out_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_out_parameter_named),((*cpp2::assert_not_null(n))),(,), s); }
913-
[[nodiscard]] auto function_declaration::has_move_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_move_parameter_named),((*cpp2::assert_not_null(n))),(,), s); }
909+
[[nodiscard]] auto function_declaration::index_of_parameter_named(cpp2::in<std::string_view> s) const -> int { return CPP2_UFCS(&,,(index_of_parameter_named),((*cpp2::assert_not_null(n))),(), s); }
910+
[[nodiscard]] auto function_declaration::has_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_parameter_named),((*cpp2::assert_not_null(n))),(), s); }
911+
[[nodiscard]] auto function_declaration::has_in_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_in_parameter_named),((*cpp2::assert_not_null(n))),(), s); }
912+
[[nodiscard]] auto function_declaration::has_out_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_out_parameter_named),((*cpp2::assert_not_null(n))),(), s); }
913+
[[nodiscard]] auto function_declaration::has_move_parameter_named(cpp2::in<std::string_view> s) const -> bool { return CPP2_UFCS(&,,(has_move_parameter_named),((*cpp2::assert_not_null(n))),(), s); }
914914

915915
[[nodiscard]] auto function_declaration::has_parameter_with_name_and_pass(cpp2::in<std::string_view> s, cpp2::in<passing_style> pass) const -> bool {
916-
return CPP2_UFCS(&,,(has_parameter_with_name_and_pass),((*cpp2::assert_not_null(n))),(,), s, pass); }
916+
return CPP2_UFCS(&,,(has_parameter_with_name_and_pass),((*cpp2::assert_not_null(n))),(), s, pass); }
917917
[[nodiscard]] auto function_declaration::is_function_with_this() const -> bool { return CPP2_UFCS(&,,(is_function_with_this),((*cpp2::assert_not_null(n))),()); }
918918
[[nodiscard]] auto function_declaration::is_virtual() const -> bool { return CPP2_UFCS(&,,(is_virtual_function),((*cpp2::assert_not_null(n))),()); }
919919
[[nodiscard]] auto function_declaration::is_defaultable() const -> bool { return CPP2_UFCS(&,,(is_defaultable_function),((*cpp2::assert_not_null(n))),()); }
@@ -1001,8 +1001,8 @@ declaration::declaration(declaration const& that)
10011001
std::vector<function_declaration>
10021002
{
10031003
std::vector<function_declaration> ret {};
1004-
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(,), declaration_node::functions) ) {
1005-
(void) CPP2_UFCS(&,,(emplace_back),(ret),(,), d, (*this));
1004+
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(), declaration_node::functions) ) {
1005+
(void) CPP2_UFCS(&,,(emplace_back),(ret),(), d, (*this));
10061006
}
10071007
return ret;
10081008
}
@@ -1011,8 +1011,8 @@ declaration::declaration(declaration const& that)
10111011
std::vector<object_declaration>
10121012
{
10131013
std::vector<object_declaration> ret {};
1014-
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(,), declaration_node::objects) ) {
1015-
(void) CPP2_UFCS(&,,(emplace_back),(ret),(,), d, (*this));
1014+
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(), declaration_node::objects) ) {
1015+
(void) CPP2_UFCS(&,,(emplace_back),(ret),(), d, (*this));
10161016
}
10171017
return ret;
10181018
}
@@ -1021,8 +1021,8 @@ declaration::declaration(declaration const& that)
10211021
std::vector<type_declaration>
10221022
{
10231023
std::vector<type_declaration> ret {};
1024-
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(,), declaration_node::types) ) {
1025-
(void) CPP2_UFCS(&,,(emplace_back),(ret),(,), d, (*this));
1024+
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(), declaration_node::types) ) {
1025+
(void) CPP2_UFCS(&,,(emplace_back),(ret),(), d, (*this));
10261026
}
10271027
return ret;
10281028
}
@@ -1031,8 +1031,8 @@ declaration::declaration(declaration const& that)
10311031
std::vector<declaration>
10321032
{
10331033
std::vector<declaration> ret {};
1034-
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(,), declaration_node::all) ) {
1035-
(void) CPP2_UFCS(&,,(emplace_back),(ret),(,), d, (*this));
1034+
for ( auto const& d : CPP2_UFCS(&,,(get_type_scope_declarations),((*cpp2::assert_not_null(n))),(), declaration_node::all) ) {
1035+
(void) CPP2_UFCS(&,,(emplace_back),(ret),(), d, (*this));
10361036
}
10371037
return ret;
10381038
}
@@ -1058,7 +1058,7 @@ declaration::declaration(declaration const& that)
10581058
{
10591059
auto decl {parse_statement(source)};
10601060
if (decl) {
1061-
return CPP2_UFCS(&,,(add_type_member),((*cpp2::assert_not_null(n))),(,), std::move(decl));
1061+
return CPP2_UFCS(&,,(add_type_member),((*cpp2::assert_not_null(n))),(), std::move(decl));
10621062
}
10631063
return false;
10641064
}
@@ -1073,7 +1073,7 @@ declaration::declaration(declaration const& that)
10731073
#line 458 "reflect.h2"
10741074
auto add_virtual_destructor(meta::type_declaration& t) -> void
10751075
{
1076-
CPP2_UFCS(&,,(require),(t),(,), CPP2_UFCS(&,,(add_member),(t),(,), "operator=: (virtual move this) = { }"),
1076+
CPP2_UFCS(&,,(require),(t),(), CPP2_UFCS(&,,(add_member),(t),(), "operator=: (virtual move this) = { }"),
10771077
"could not add virtual destructor");
10781078
}
10791079

@@ -1084,15 +1084,15 @@ auto interface(meta::type_declaration& t) -> void
10841084

10851085
for ( auto& m : CPP2_UFCS(&,,(get_members),(t),()) )
10861086
{
1087-
CPP2_UFCS(&,,(require),(m),(,), !(CPP2_UFCS(&,,(is_object),(m),())),
1087+
CPP2_UFCS(&,,(require),(m),(), !(CPP2_UFCS(&,,(is_object),(m),())),
10881088
"interfaces may not contain data objects");
10891089
if (CPP2_UFCS(&,,(is_function),(m),())) {
10901090
auto mf {CPP2_UFCS(&,,(as_function),(m),())};
1091-
CPP2_UFCS(&,,(require),(mf),(,), !(CPP2_UFCS(&,,(is_copy_or_move),(mf),())),
1091+
CPP2_UFCS(&,,(require),(mf),(), !(CPP2_UFCS(&,,(is_copy_or_move),(mf),())),
10921092
"interfaces may not copy or move; consider a virtual clone() instead");
1093-
CPP2_UFCS(&,,(require),(mf),(,), !(CPP2_UFCS(&,,(has_initializer),(mf),())),
1093+
CPP2_UFCS(&,,(require),(mf),(), !(CPP2_UFCS(&,,(has_initializer),(mf),())),
10941094
"interface functions must not have a function body; remove the '=' initializer");
1095-
CPP2_UFCS(&,,(require),(mf),(,), CPP2_UFCS(&,,(make_public),(mf),()),
1095+
CPP2_UFCS(&,,(require),(mf),(), CPP2_UFCS(&,,(make_public),(mf),()),
10961096
"interface functions must be public");
10971097
CPP2_UFCS(&,,(default_to_virtual),(mf),());
10981098
has_dtor |= CPP2_UFCS(&,,(is_destructor),(mf),());
@@ -1114,11 +1114,11 @@ auto polymorphic_base(meta::type_declaration& t) -> void
11141114
if (CPP2_UFCS(&,,(is_default_access),(mf),())) {
11151115
CPP2_UFCS(&,,(default_to_public),(mf),());
11161116
}
1117-
CPP2_UFCS(&,,(require),(mf),(,), !(CPP2_UFCS(&,,(is_copy_or_move),(mf),())),
1117+
CPP2_UFCS(&,,(require),(mf),(), !(CPP2_UFCS(&,,(is_copy_or_move),(mf),())),
11181118
"polymorphic base types may not copy or move; consider a virtual clone() instead");
11191119
if (CPP2_UFCS(&,,(is_destructor),(mf),())) {
11201120
has_dtor = true;
1121-
CPP2_UFCS(&,,(require),(mf),(,), (CPP2_UFCS(&,,(is_public),(mf),()) && CPP2_UFCS(&,,(is_virtual),(mf),()))
1121+
CPP2_UFCS(&,,(require),(mf),(), (CPP2_UFCS(&,,(is_public),(mf),()) && CPP2_UFCS(&,,(is_virtual),(mf),()))
11221122
|| (CPP2_UFCS(&,,(is_protected),(mf),()) && !(CPP2_UFCS(&,,(is_virtual),(mf),()))),
11231123
"a polymorphic base type destructor must be public and virtual, or protected and nonvirtual");
11241124
}
@@ -1139,18 +1139,18 @@ auto ordered_impl(
11391139

11401140
for ( auto& mf : CPP2_UFCS(&,,(get_member_functions),(t),()) )
11411141
{
1142-
if (CPP2_UFCS(&,,(has_name),(mf),(,), "operator<=>")) {
1142+
if (CPP2_UFCS(&,,(has_name),(mf),(), "operator<=>")) {
11431143
has_spaceship = true;
11441144
auto return_name {CPP2_UFCS(&,,(unnamed_return_type),(mf),())};
1145-
if (CPP2_UFCS(&,,(find),(return_name),(,), ordering)==return_name.npos)
1145+
if (CPP2_UFCS(&,,(find),(return_name),(), ordering)==return_name.npos)
11461146
{
1147-
CPP2_UFCS(&,,(error),(mf),(,), "operator<=> must return std::" + cpp2::as_<std::string>(ordering));
1147+
CPP2_UFCS(&,,(error),(mf),(), "operator<=> must return std::" + cpp2::as_<std::string>(ordering));
11481148
}
11491149
}
11501150
}
11511151

11521152
if (!(std::move(has_spaceship))) {
1153-
CPP2_UFCS(&,,(require),(t),(,), CPP2_UFCS(&,,(add_member),(t),(,), "operator<=>: (this, that) -> std::" + (cpp2::as_<std::string>(ordering)) + ";"),
1153+
CPP2_UFCS(&,,(require),(t),(), CPP2_UFCS(&,,(add_member),(t),(), "operator<=>: (this, that) -> std::" + (cpp2::as_<std::string>(ordering)) + ";"),
11541154
"could not add operator<=> with std::" + (cpp2::as_<std::string>(ordering)));
11551155
}
11561156
}
@@ -1188,10 +1188,10 @@ auto copyable(meta::type_declaration& t) -> void
11881188
|| smfs.inout_this_move_that))
11891189

11901190
{
1191-
CPP2_UFCS(&,,(error),(t),(,), "this type is partially copyable/movable - when you provide any of the more-specific operator= signatures, you must also provide the one with the general signature (out this, that); alternatively, consider removing all the operator= functions and let them all be generated for you with default memberwise semantics");
1191+
CPP2_UFCS(&,,(error),(t),(), "this type is partially copyable/movable - when you provide any of the more-specific operator= signatures, you must also provide the one with the general signature (out this, that); alternatively, consider removing all the operator= functions and let them all be generated for you with default memberwise semantics");
11921192
}
11931193
else {if (!(std::move(smfs).out_this_in_that)) {
1194-
CPP2_UFCS(&,,(require),(t),(,), CPP2_UFCS(&,,(add_member),(t),(,), "operator=: (out this, that) = { }"),
1194+
CPP2_UFCS(&,,(require),(t),(), CPP2_UFCS(&,,(add_member),(t),(), "operator=: (out this, that) = { }"),
11951195
"could not add general operator=:(out this, that)");
11961196
}}
11971197
}
@@ -1204,14 +1204,14 @@ auto basic_value(meta::type_declaration& t) -> void
12041204
auto has_default_ctor {false};
12051205
for ( auto& mf : CPP2_UFCS(&,,(get_member_functions),(t),()) ) {
12061206
has_default_ctor |= CPP2_UFCS(&,,(is_default_constructor),(mf),());
1207-
CPP2_UFCS(&,,(require),(mf),(,), !(CPP2_UFCS(&,,(is_protected),(mf),())) && !(CPP2_UFCS(&,,(is_virtual),(mf),())),
1207+
CPP2_UFCS(&,,(require),(mf),(), !(CPP2_UFCS(&,,(is_protected),(mf),())) && !(CPP2_UFCS(&,,(is_virtual),(mf),())),
12081208
"a value type may not have a protected or virtual function");
1209-
CPP2_UFCS(&,,(require),(mf),(,), !(CPP2_UFCS(&,,(is_destructor),(mf),())) || CPP2_UFCS(&,,(is_public),(mf),()),
1209+
CPP2_UFCS(&,,(require),(mf),(), !(CPP2_UFCS(&,,(is_destructor),(mf),())) || CPP2_UFCS(&,,(is_public),(mf),()),
12101210
"a value type may not have a non-public destructor");
12111211
}
12121212

12131213
if (!(std::move(has_default_ctor))) {
1214-
CPP2_UFCS(&,,(require),(t),(,), CPP2_UFCS(&,,(add_member),(t),(,), "operator=: (out this) = { }"),
1214+
CPP2_UFCS(&,,(require),(t),(), CPP2_UFCS(&,,(add_member),(t),(), "operator=: (out this) = { }"),
12151215
"could not add default constructor");
12161216
}
12171217
}
@@ -1240,13 +1240,13 @@ auto cpp2_struct(meta::type_declaration& t) -> void
12401240
{
12411241
for ( auto& m : CPP2_UFCS(&,,(get_members),(t),()) )
12421242
{
1243-
CPP2_UFCS(&,,(require),(m),(,), CPP2_UFCS(&,,(make_public),(m),()),
1243+
CPP2_UFCS(&,,(require),(m),(), CPP2_UFCS(&,,(make_public),(m),()),
12441244
"all struct members must be public");
12451245
if (CPP2_UFCS(&,,(is_function),(m),())) {
12461246
auto mf {CPP2_UFCS(&,,(as_function),(m),())};
1247-
CPP2_UFCS(&,,(require),(t),(,), !(CPP2_UFCS(&,,(is_virtual),(mf),())),
1247+
CPP2_UFCS(&,,(require),(t),(), !(CPP2_UFCS(&,,(is_virtual),(mf),())),
12481248
"a struct may not have a virtual function");
1249-
CPP2_UFCS(&,,(require),(t),(,), !(CPP2_UFCS(&,,(has_name),(mf),(,), "operator=")),
1249+
CPP2_UFCS(&,,(require),(t),(), !(CPP2_UFCS(&,,(has_name),(mf),(), "operator=")),
12501250
"a struct may not have a user-defined operator=");
12511251
}
12521252
}

0 commit comments

Comments
 (0)