@@ -38,7 +38,7 @@ class alias_declaration;
3838#line 884 "reflect.h2"
3939class value_member_info ;
4040
41- #line 1382 "reflect.h2"
41+ #line 1399 "reflect.h2"
4242}
4343
4444}
@@ -731,7 +731,14 @@ auto print(cpp2::in<meta::type_declaration> t) -> void;
731731//
732732auto maker (meta::type_declaration& t) -> void;
733733
734- #line 1275 "reflect.h2"
734+ #line 1274 "reflect.h2"
735+ // -----------------------------------------------------------------------
736+ //
737+ // generate_expressions - adds expression syntax
738+ //
739+ auto generate_binary_expression (meta::type_declaration& t) -> void;
740+
741+ #line 1289 "reflect.h2"
735742// -----------------------------------------------------------------------
736743//
737744// apply_metafunctions
@@ -742,7 +749,7 @@ auto maker(meta::type_declaration& t) -> void;
742749 auto const & error
743750 ) -> bool;
744751
745- #line 1382 "reflect.h2"
752+ #line 1399 "reflect.h2"
746753}
747754
748755}
@@ -1784,7 +1791,18 @@ auto maker(meta::type_declaration& t) -> void
17841791 CPP2_UFCS (add_declaration, t, " make_" + cpp2::to_string (CPP2_UFCS_0 (name, t)) + " : (args...: _) -> _ = { return " + cpp2::to_string (CPP2_UFCS_0 (name, t)) + " (args...); }" );
17851792}
17861793
1787- #line 1279 "reflect.h2"
1794+ #line 1278 "reflect.h2"
1795+ auto generate_binary_expression (meta::type_declaration& t) -> void
1796+ {
1797+
1798+ std::string op_name {CPP2_UFCS (substr, CPP2_UFCS_0 (name, t), 8 )}; // Skip 'Operator'
1799+
1800+ CPP2_UFCS (add_declaration, t, cpp2::to_string (op_name) + " : <A, B> (arg_a: Expression<A>, arg_b: Expression<B>) -> _ = BinaryExpression<A, B, " + cpp2::to_string (CPP2_UFCS_0 (name, t)) + " >(arg_a, arg_b);" );
1801+ CPP2_UFCS (add_declaration, t, cpp2::to_string (op_name) + " : <A> (arg_a: Expression<A>, arg_b: double) -> _ = BinaryExpression<A, Constant<double>, " + cpp2::to_string (CPP2_UFCS_0 (name, t)) + " >(arg_a, Constant<double>(arg_b));" );
1802+ CPP2_UFCS (add_declaration, t, cpp2::to_string (std::move (op_name)) + " : <B> (arg_a: double, arg_b: Expression<B>) -> _ = BinaryExpression<Constant<double>, B, " + cpp2::to_string (CPP2_UFCS_0 (name, t)) + " >(Constant<double>(arg_a), arg_b);" );
1803+ }
1804+
1805+ #line 1293 "reflect.h2"
17881806[[nodiscard]] auto apply_metafunctions (
17891807 declaration_node& n,
17901808 type_declaration& rtype,
@@ -1868,11 +1886,14 @@ auto maker(meta::type_declaration& t) -> void
18681886 else {if (name == " maker" ) {
18691887 maker (rtype);
18701888 }
1889+ else {if (name == " generate_binary_expression" ) {
1890+ generate_binary_expression (rtype);
1891+ }
18711892 else {
18721893 error (" unrecognized metafunction name: " + name);
18731894 error (" (temporary alpha limitation) currently the supported names are: interface, polymorphic_base, ordered, weakly_ordered, partially_ordered, copyable, basic_value, value, weakly_ordered_value, partially_ordered_value, struct, enum, flag_enum, union, print" );
18741895 return false ;
1875- }}}}}}}}}}}}}}}}
1896+ }}}}}}}}}}}}}}}}}
18761897
18771898 if ((
18781899 !(CPP2_UFCS_0 (empty, args))
@@ -1887,7 +1908,7 @@ auto maker(meta::type_declaration& t) -> void
18871908 return true ;
18881909}
18891910
1890- #line 1382 "reflect.h2"
1911+ #line 1399 "reflect.h2"
18911912}
18921913
18931914}
0 commit comments