@@ -38,7 +38,7 @@ class alias_declaration;
38
38
#line 884 "reflect.h2"
39
39
class value_member_info ;
40
40
41
- #line 1382 "reflect.h2"
41
+ #line 1399 "reflect.h2"
42
42
}
43
43
44
44
}
@@ -731,7 +731,14 @@ auto print(cpp2::in<meta::type_declaration> t) -> void;
731
731
//
732
732
auto maker (meta::type_declaration& t) -> void;
733
733
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"
735
742
// -----------------------------------------------------------------------
736
743
//
737
744
// apply_metafunctions
@@ -742,7 +749,7 @@ auto maker(meta::type_declaration& t) -> void;
742
749
auto const & error
743
750
) -> bool;
744
751
745
- #line 1382 "reflect.h2"
752
+ #line 1399 "reflect.h2"
746
753
}
747
754
748
755
}
@@ -1784,7 +1791,18 @@ auto maker(meta::type_declaration& t) -> void
1784
1791
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...); }" );
1785
1792
}
1786
1793
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"
1788
1806
[[nodiscard]] auto apply_metafunctions (
1789
1807
declaration_node& n,
1790
1808
type_declaration& rtype,
@@ -1868,11 +1886,14 @@ auto maker(meta::type_declaration& t) -> void
1868
1886
else {if (name == " maker" ) {
1869
1887
maker (rtype);
1870
1888
}
1889
+ else {if (name == " generate_binary_expression" ) {
1890
+ generate_binary_expression (rtype);
1891
+ }
1871
1892
else {
1872
1893
error (" unrecognized metafunction name: " + name);
1873
1894
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" );
1874
1895
return false ;
1875
- }}}}}}}}}}}}}}}}
1896
+ }}}}}}}}}}}}}}}}}
1876
1897
1877
1898
if ((
1878
1899
!(CPP2_UFCS_0 (empty, args))
@@ -1887,7 +1908,7 @@ auto maker(meta::type_declaration& t) -> void
1887
1908
return true ;
1888
1909
}
1889
1910
1890
- #line 1382 "reflect.h2"
1911
+ #line 1399 "reflect.h2"
1891
1912
}
1892
1913
1893
1914
}
0 commit comments