9
9
#line 1 "pure2-function-body-reflection.cpp2"
10
10
11
11
#line 2 "pure2-function-body-reflection.cpp2"
12
+ namespace xyzzy {
13
+
14
+ #line 7 "pure2-function-body-reflection.cpp2"
12
15
class test ;
13
16
17
+ #line 81 "pure2-function-body-reflection.cpp2"
18
+ }
19
+
14
20
15
21
// === Cpp2 type definitions and function declarations ===========================
16
22
17
23
#line 1 "pure2-function-body-reflection.cpp2"
18
24
19
25
#line 2 "pure2-function-body-reflection.cpp2"
26
+ namespace xyzzy {
27
+
28
+ // This function will be visible as a namespace member while reflecting on xyzzy::test
29
+ auto sample_function_before_type () -> void;
30
+
20
31
class test
21
32
{
22
33
public: [[nodiscard]] static auto one_liner (cpp2::impl::in<double > a, cpp2::impl::in<double > b, cpp2::impl::in<double > c) -> decltype(auto );
23
34
struct return_list_ret { double r; float s; std::string t; };
24
35
25
36
26
37
27
- #line 6 "pure2-function-body-reflection.cpp2"
38
+ #line 11 "pure2-function-body-reflection.cpp2"
28
39
public: [[nodiscard]] static auto return_list () -> return_list_ret;
29
40
using branches_ret = double ;
30
41
31
42
32
- #line 14 "pure2-function-body-reflection.cpp2"
43
+ #line 19 "pure2-function-body-reflection.cpp2"
33
44
public: [[nodiscard]] static auto branches (cpp2::impl::in<double > a, cpp2::impl::in<double > b, cpp2::impl::in<double > c) -> branches_ret;
34
45
35
- #line 29 "pure2-function-body-reflection.cpp2"
46
+ #line 34 "pure2-function-body-reflection.cpp2"
36
47
public: static auto binary_ops (double & a, cpp2::impl::in<double > b, cpp2::impl::in<double > c) -> void;
37
48
38
- #line 38 "pure2-function-body-reflection.cpp2"
49
+ #line 43 "pure2-function-body-reflection.cpp2"
39
50
public: [[nodiscard]] static auto prefix () -> int;
40
51
41
- #line 48 "pure2-function-body-reflection.cpp2"
52
+ #line 53 "pure2-function-body-reflection.cpp2"
42
53
public: static auto postfix (double & a) -> void;
43
54
44
- #line 54 "pure2-function-body-reflection.cpp2"
55
+ #line 59 "pure2-function-body-reflection.cpp2"
45
56
public: [[nodiscard]] static auto qualified_ids () -> auto;
46
57
47
- #line 60 "pure2-function-body-reflection.cpp2"
58
+ #line 65 "pure2-function-body-reflection.cpp2"
48
59
public: static auto loops () -> void;
49
60
public: test() = default ;
50
61
public: test(test const &) = delete ; /* No 'that' constructor, suppress copy */
51
62
public: auto operator =(test const &) -> void = delete ;
52
63
53
64
54
- #line 71 "pure2-function-body-reflection.cpp2"
65
+ #line 76 "pure2-function-body-reflection.cpp2"
55
66
};
56
67
68
+ // This function will not be visible as a namespace member while reflecting on xyzzy::test
69
+ auto sample_function_after_type () -> void;
70
+
71
+ }
72
+
57
73
auto main () -> int;
58
74
59
75
// === Cpp2 function definitions =================================================
60
76
61
77
#line 1 "pure2-function-body-reflection.cpp2"
62
78
63
- #line 4 "pure2-function-body-reflection.cpp2"
79
+ #line 2 "pure2-function-body-reflection.cpp2"
80
+ namespace xyzzy {
81
+
82
+ #line 5 "pure2-function-body-reflection.cpp2"
83
+ auto sample_function_before_type () -> void{}
84
+
85
+ #line 9 "pure2-function-body-reflection.cpp2"
64
86
[[nodiscard]] auto test::one_liner (cpp2::impl::in<double > a, cpp2::impl::in<double > b, cpp2::impl::in<double > c) -> decltype(auto ) { return (a + c) * b; }
65
87
66
- #line 6 "pure2-function-body-reflection.cpp2"
88
+ #line 11 "pure2-function-body-reflection.cpp2"
67
89
[[nodiscard]] auto test::return_list () -> return_list_ret
68
90
69
91
{
70
92
cpp2::impl::deferred_init<double > r;
71
93
cpp2::impl::deferred_init<float > s;
72
94
cpp2::impl::deferred_init<std::string> t;
73
- #line 9 "pure2-function-body-reflection.cpp2"
95
+ #line 14 "pure2-function-body-reflection.cpp2"
74
96
r.construct (42.0 );
75
97
s.construct (2 .71828f );
76
98
t.construct (" e times pi" );
77
99
return { std::move (r.value ()), std::move (s.value ()), std::move (t.value ()) }; }
78
100
79
- #line 14 "pure2-function-body-reflection.cpp2"
101
+ #line 19 "pure2-function-body-reflection.cpp2"
80
102
[[nodiscard]] auto test::branches (cpp2::impl::in<double > a, cpp2::impl::in<double > b, cpp2::impl::in<double > c) -> branches_ret
81
103
82
104
{
83
105
double r {3.14159 };
84
- #line 17 "pure2-function-body-reflection.cpp2"
106
+ #line 22 "pure2-function-body-reflection.cpp2"
85
107
if (true ) {
86
108
r = r + a;
87
109
}
@@ -94,7 +116,7 @@ auto main() -> int;
94
116
}return r;
95
117
}
96
118
97
- #line 29 "pure2-function-body-reflection.cpp2"
119
+ #line 34 "pure2-function-body-reflection.cpp2"
98
120
auto test::binary_ops (double & a, cpp2::impl::in<double > b, cpp2::impl::in<double > c) -> void
99
121
{
100
122
a -= b * c + (1 << 2 );
@@ -104,7 +126,7 @@ auto main() -> int;
104
126
auto z {5 | 6 };
105
127
}
106
128
107
- #line 38 "pure2-function-body-reflection.cpp2"
129
+ #line 43 "pure2-function-body-reflection.cpp2"
108
130
[[nodiscard]] auto test::prefix () -> int
109
131
{
110
132
auto a {-1 };
@@ -115,21 +137,21 @@ auto main() -> int;
115
137
return cpp2::move (a) + cpp2::move (b);
116
138
}
117
139
118
- #line 48 "pure2-function-body-reflection.cpp2"
140
+ #line 53 "pure2-function-body-reflection.cpp2"
119
141
auto test::postfix (double & a) -> void
120
142
{
121
143
auto ptr {&a};
122
144
--++*cpp2::impl::assert_not_null (cpp2::move (ptr));
123
145
}
124
146
125
- #line 54 "pure2-function-body-reflection.cpp2"
147
+ #line 59 "pure2-function-body-reflection.cpp2"
126
148
[[nodiscard]] auto test::qualified_ids () -> auto
127
149
{
128
150
std::vector<int > v {1 , 2 , 3 };
129
151
return CPP2_UFCS (ssize)(cpp2::move (v));
130
152
}
131
153
132
- #line 60 "pure2-function-body-reflection.cpp2"
154
+ #line 65 "pure2-function-body-reflection.cpp2"
133
155
auto test::loops () -> void
134
156
{
135
157
std::vector v {1 , 2 , 3 };
@@ -142,6 +164,11 @@ auto main() -> int;
142
164
do {std::cout << " plugh\n " ; } while ( false );
143
165
}
144
166
145
- #line 73 "pure2-function-body-reflection.cpp2"
167
+ #line 79 "pure2-function-body-reflection.cpp2"
168
+ auto sample_function_after_type () -> void{}
169
+
170
+ }
171
+
172
+ #line 83 "pure2-function-body-reflection.cpp2"
146
173
auto main () -> int{}
147
174
0 commit comments