Branch data Line data Source code
1 : : // Copyright (C) 2020-2024 Free Software Foundation, Inc.
2 : :
3 : : // This file is part of GCC.
4 : :
5 : : // GCC is free software; you can redistribute it and/or modify it under
6 : : // the terms of the GNU General Public License as published by the Free
7 : : // Software Foundation; either version 3, or (at your option) any later
8 : : // version.
9 : :
10 : : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 : : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 : : // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 : : // for more details.
14 : :
15 : : // You should have received a copy of the GNU General Public License
16 : : // along with GCC; see the file COPYING3. If not see
17 : : // <http://www.gnu.org/licenses/>.
18 : :
19 : : #include "rust-hir-expr.h"
20 : : #include "rust-hir-map.h"
21 : : #include "optional.h"
22 : : #include "rust-operators.h"
23 : : #include "rust-hir-stmt.h"
24 : :
25 : : namespace Rust {
26 : : namespace HIR {
27 : :
28 : 140184 : Expr::Expr (Analysis::NodeMapping mappings, AST::AttrVec outer_attribs)
29 : 140184 : : outer_attrs (std::move (outer_attribs)), mappings (std::move (mappings))
30 : 140184 : {}
31 : :
32 : 111965 : ExprWithoutBlock::ExprWithoutBlock (Analysis::NodeMapping mappings,
33 : 0 : AST::AttrVec outer_attribs)
34 : 111965 : : Expr (std::move (mappings), std::move (outer_attribs))
35 : 111965 : {}
36 : :
37 : 30 : LoopLabel::LoopLabel (Analysis::NodeMapping mapping, Lifetime loop_label,
38 : 30 : location_t locus)
39 : 30 : : label (std::move (loop_label)), locus (locus), mappings (mapping)
40 : 30 : {}
41 : :
42 : 28219 : ExprWithBlock::ExprWithBlock (Analysis::NodeMapping mappings,
43 : 0 : AST::AttrVec outer_attrs)
44 : 28219 : : Expr (std::move (mappings), std::move (outer_attrs))
45 : 28219 : {}
46 : :
47 : 1211 : LiteralExpr::LiteralExpr (Analysis::NodeMapping mappings,
48 : : std::string value_as_string, Literal::LitType type,
49 : : PrimitiveCoreType type_hint, location_t locus,
50 : 1211 : AST::AttrVec outer_attrs)
51 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attrs)),
52 : 1211 : literal (std::move (value_as_string), type, type_hint), locus (locus)
53 : 1211 : {}
54 : :
55 : 18050 : LiteralExpr::LiteralExpr (Analysis::NodeMapping mappings, Literal literal,
56 : 18050 : location_t locus, AST::AttrVec outer_attrs)
57 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attrs)),
58 : 18050 : literal (std::move (literal)), locus (locus)
59 : 18050 : {}
60 : :
61 : 20693 : OperatorExpr::OperatorExpr (Analysis::NodeMapping mappings,
62 : : std::unique_ptr<Expr> main_or_left_expr,
63 : 0 : AST::AttrVec outer_attribs, location_t locus)
64 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
65 : 20693 : locus (locus), main_or_left_expr (std::move (main_or_left_expr))
66 : 20693 : {}
67 : :
68 : 12711 : OperatorExpr::OperatorExpr (OperatorExpr const &other)
69 : 12711 : : ExprWithoutBlock (other), locus (other.locus),
70 : 12711 : main_or_left_expr (other.main_or_left_expr->clone_expr ())
71 : 12711 : {}
72 : :
73 : : OperatorExpr &
74 : 0 : OperatorExpr::operator= (OperatorExpr const &other)
75 : : {
76 : 0 : ExprWithoutBlock::operator= (other);
77 : 0 : main_or_left_expr = other.main_or_left_expr->clone_expr ();
78 : 0 : locus = other.locus;
79 : : // outer_attrs = other.outer_attrs;
80 : :
81 : 0 : return *this;
82 : : }
83 : :
84 : 1948 : BorrowExpr::BorrowExpr (Analysis::NodeMapping mappings,
85 : : std::unique_ptr<Expr> borrow_lvalue, Mutability mut,
86 : 1948 : bool raw, AST::AttrVec outer_attribs, location_t locus)
87 : : : OperatorExpr (std::move (mappings), std::move (borrow_lvalue),
88 : : std::move (outer_attribs), locus),
89 : 1948 : mut (mut), raw (raw)
90 : 1948 : {}
91 : :
92 : 3893 : DereferenceExpr::DereferenceExpr (Analysis::NodeMapping mappings,
93 : : std::unique_ptr<Expr> deref_lvalue,
94 : 3893 : AST::AttrVec outer_attribs, location_t locus)
95 : : : OperatorExpr (std::move (mappings), std::move (deref_lvalue),
96 : 3893 : std::move (outer_attribs), locus)
97 : 3893 : {}
98 : :
99 : 0 : ErrorPropagationExpr::ErrorPropagationExpr (
100 : : Analysis::NodeMapping mappings, std::unique_ptr<Expr> potential_error_value,
101 : 0 : AST::AttrVec outer_attribs, location_t locus)
102 : : : OperatorExpr (std::move (mappings), std::move (potential_error_value),
103 : 0 : std::move (outer_attribs), locus)
104 : 0 : {}
105 : :
106 : 512 : NegationExpr::NegationExpr (Analysis::NodeMapping mappings,
107 : : std::unique_ptr<Expr> negated_value,
108 : : ExprType expr_kind, AST::AttrVec outer_attribs,
109 : 512 : location_t locus)
110 : : : OperatorExpr (std::move (mappings), std::move (negated_value),
111 : : std::move (outer_attribs), locus),
112 : 512 : expr_type (expr_kind)
113 : 512 : {}
114 : :
115 : 3301 : ArithmeticOrLogicalExpr::ArithmeticOrLogicalExpr (
116 : : Analysis::NodeMapping mappings, std::unique_ptr<Expr> left_value,
117 : 3301 : std::unique_ptr<Expr> right_value, ExprType expr_kind, location_t locus)
118 : 3301 : : OperatorExpr (std::move (mappings), std::move (left_value), AST::AttrVec (),
119 : : locus),
120 : 3301 : expr_type (expr_kind), right_expr (std::move (right_value))
121 : 3301 : {}
122 : :
123 : 48 : ArithmeticOrLogicalExpr::ArithmeticOrLogicalExpr (
124 : 48 : ArithmeticOrLogicalExpr const &other)
125 : 48 : : OperatorExpr (other), expr_type (other.expr_type),
126 : 48 : right_expr (other.right_expr->clone_expr ())
127 : 48 : {}
128 : :
129 : : ArithmeticOrLogicalExpr &
130 : 0 : ArithmeticOrLogicalExpr::operator= (ArithmeticOrLogicalExpr const &other)
131 : : {
132 : 0 : OperatorExpr::operator= (other);
133 : : // main_or_left_expr = other.main_or_left_expr->clone_expr();
134 : 0 : right_expr = other.right_expr->clone_expr ();
135 : 0 : expr_type = other.expr_type;
136 : :
137 : 0 : return *this;
138 : : }
139 : :
140 : 2667 : ComparisonExpr::ComparisonExpr (Analysis::NodeMapping mappings,
141 : : std::unique_ptr<Expr> left_value,
142 : : std::unique_ptr<Expr> right_value,
143 : 2667 : ExprType comparison_kind, location_t locus)
144 : 2667 : : OperatorExpr (std::move (mappings), std::move (left_value), AST::AttrVec (),
145 : : locus),
146 : 2667 : expr_type (comparison_kind), right_expr (std::move (right_value))
147 : 2667 : {}
148 : :
149 : 0 : ComparisonExpr::ComparisonExpr (ComparisonExpr const &other)
150 : 0 : : OperatorExpr (other), expr_type (other.expr_type),
151 : 0 : right_expr (other.right_expr->clone_expr ())
152 : 0 : {}
153 : :
154 : : ComparisonExpr &
155 : 0 : ComparisonExpr::operator= (ComparisonExpr const &other)
156 : : {
157 : 0 : OperatorExpr::operator= (other);
158 : : // main_or_left_expr = other.main_or_left_expr->clone_expr();
159 : 0 : right_expr = other.right_expr->clone_expr ();
160 : 0 : expr_type = other.expr_type;
161 : : // outer_attrs = other.outer_attrs;
162 : :
163 : 0 : return *this;
164 : : }
165 : :
166 : 384 : LazyBooleanExpr::LazyBooleanExpr (Analysis::NodeMapping mappings,
167 : : std::unique_ptr<Expr> left_bool_expr,
168 : : std::unique_ptr<Expr> right_bool_expr,
169 : 384 : ExprType expr_kind, location_t locus)
170 : : : OperatorExpr (std::move (mappings), std::move (left_bool_expr),
171 : 384 : AST::AttrVec (), locus),
172 : 384 : expr_type (expr_kind), right_expr (std::move (right_bool_expr))
173 : 384 : {}
174 : :
175 : 0 : LazyBooleanExpr::LazyBooleanExpr (LazyBooleanExpr const &other)
176 : 0 : : OperatorExpr (other), expr_type (other.expr_type),
177 : 0 : right_expr (other.right_expr->clone_expr ())
178 : 0 : {}
179 : :
180 : : LazyBooleanExpr &
181 : 0 : LazyBooleanExpr::operator= (LazyBooleanExpr const &other)
182 : : {
183 : 0 : OperatorExpr::operator= (other);
184 : : // main_or_left_expr = other.main_or_left_expr->clone_expr();
185 : 0 : right_expr = other.right_expr->clone_expr ();
186 : 0 : expr_type = other.expr_type;
187 : :
188 : 0 : return *this;
189 : : }
190 : :
191 : 4876 : TypeCastExpr::TypeCastExpr (Analysis::NodeMapping mappings,
192 : : std::unique_ptr<Expr> expr_to_cast,
193 : : std::unique_ptr<Type> type_to_cast_to,
194 : 4876 : location_t locus)
195 : : : OperatorExpr (std::move (mappings), std::move (expr_to_cast),
196 : 4876 : AST::AttrVec (), locus),
197 : 4876 : type_to_convert_to (std::move (type_to_cast_to))
198 : 4876 : {}
199 : :
200 : 0 : TypeCastExpr::TypeCastExpr (TypeCastExpr const &other)
201 : : : OperatorExpr (other),
202 : 0 : type_to_convert_to (other.type_to_convert_to->clone_type ())
203 : 0 : {}
204 : :
205 : : TypeCastExpr &
206 : 0 : TypeCastExpr::operator= (TypeCastExpr const &other)
207 : : {
208 : 0 : OperatorExpr::operator= (other);
209 : : // main_or_left_expr = other.main_or_left_expr->clone_expr();
210 : 0 : type_to_convert_to = other.type_to_convert_to->clone_type ();
211 : :
212 : 0 : return *this;
213 : : }
214 : :
215 : 2473 : AssignmentExpr::AssignmentExpr (Analysis::NodeMapping mappings,
216 : : std::unique_ptr<Expr> value_to_assign_to,
217 : : std::unique_ptr<Expr> value_to_assign,
218 : 2473 : location_t locus)
219 : : : OperatorExpr (std::move (mappings), std::move (value_to_assign_to),
220 : 2473 : AST::AttrVec (), locus),
221 : 2473 : right_expr (std::move (value_to_assign))
222 : 2473 : {}
223 : :
224 : 0 : AssignmentExpr::AssignmentExpr (AssignmentExpr const &other)
225 : 0 : : OperatorExpr (other), right_expr (other.right_expr->clone_expr ())
226 : 0 : {}
227 : :
228 : : AssignmentExpr &
229 : 0 : AssignmentExpr::operator= (AssignmentExpr const &other)
230 : : {
231 : 0 : OperatorExpr::operator= (other);
232 : : // main_or_left_expr = other.main_or_left_expr->clone_expr();
233 : 0 : right_expr = other.right_expr->clone_expr ();
234 : : // outer_attrs = other.outer_attrs;
235 : :
236 : 0 : return *this;
237 : : }
238 : :
239 : 639 : CompoundAssignmentExpr::CompoundAssignmentExpr (
240 : : Analysis::NodeMapping mappings, std::unique_ptr<Expr> value_to_assign_to,
241 : 639 : std::unique_ptr<Expr> value_to_assign, ExprType expr_kind, location_t locus)
242 : : : OperatorExpr (std::move (mappings), std::move (value_to_assign_to),
243 : 639 : AST::AttrVec (), locus),
244 : 639 : expr_type (expr_kind), right_expr (std::move (value_to_assign))
245 : 639 : {}
246 : :
247 : 0 : CompoundAssignmentExpr::CompoundAssignmentExpr (
248 : 0 : CompoundAssignmentExpr const &other)
249 : 0 : : OperatorExpr (other), expr_type (other.expr_type),
250 : 0 : right_expr (other.right_expr->clone_expr ())
251 : 0 : {}
252 : :
253 : : CompoundAssignmentExpr &
254 : 0 : CompoundAssignmentExpr::operator= (CompoundAssignmentExpr const &other)
255 : : {
256 : 0 : OperatorExpr::operator= (other);
257 : : // main_or_left_expr = other.main_or_left_expr->clone_expr();
258 : 0 : right_expr = other.right_expr->clone_expr ();
259 : 0 : expr_type = other.expr_type;
260 : : // outer_attrs = other.outer_attrs;
261 : :
262 : 0 : return *this;
263 : : }
264 : :
265 : 290 : GroupedExpr::GroupedExpr (Analysis::NodeMapping mappings,
266 : : std::unique_ptr<Expr> parenthesised_expr,
267 : : AST::AttrVec inner_attribs,
268 : 290 : AST::AttrVec outer_attribs, location_t locus)
269 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
270 : : WithInnerAttrs (std::move (inner_attribs)),
271 : 290 : expr_in_parens (std::move (parenthesised_expr)), locus (locus)
272 : 290 : {}
273 : :
274 : 0 : GroupedExpr::GroupedExpr (GroupedExpr const &other)
275 : 0 : : ExprWithoutBlock (other), WithInnerAttrs (other.inner_attrs),
276 : 0 : expr_in_parens (other.expr_in_parens->clone_expr ()), locus (other.locus)
277 : 0 : {}
278 : :
279 : : GroupedExpr &
280 : 0 : GroupedExpr::operator= (GroupedExpr const &other)
281 : : {
282 : 0 : ExprWithoutBlock::operator= (other);
283 : 0 : inner_attrs = other.inner_attrs;
284 : 0 : expr_in_parens = other.expr_in_parens->clone_expr ();
285 : 0 : locus = other.locus;
286 : : // outer_attrs = other.outer_attrs;
287 : :
288 : 0 : return *this;
289 : : }
290 : :
291 : 259 : ArrayElemsValues::ArrayElemsValues (Analysis::NodeMapping mappings,
292 : 259 : std::vector<std::unique_ptr<Expr>> elems)
293 : 259 : : ArrayElems (mappings), values (std::move (elems))
294 : 259 : {}
295 : :
296 : 0 : ArrayElemsValues::ArrayElemsValues (ArrayElemsValues const &other)
297 : 0 : : ArrayElems (other)
298 : : {
299 : 0 : values.reserve (other.values.size ());
300 : 0 : for (const auto &e : other.values)
301 : 0 : values.push_back (e->clone_expr ());
302 : 0 : }
303 : :
304 : : ArrayElemsValues &
305 : 0 : ArrayElemsValues::operator= (ArrayElemsValues const &other)
306 : : {
307 : 0 : values.reserve (other.values.size ());
308 : 0 : for (const auto &e : other.values)
309 : 0 : values.push_back (e->clone_expr ());
310 : :
311 : 0 : return *this;
312 : : }
313 : :
314 : 116 : ArrayElemsCopied::ArrayElemsCopied (Analysis::NodeMapping mappings,
315 : : std::unique_ptr<Expr> copied_elem,
316 : 116 : std::unique_ptr<Expr> copy_amount)
317 : 116 : : ArrayElems (mappings), elem_to_copy (std::move (copied_elem)),
318 : 116 : num_copies (std::move (copy_amount))
319 : 116 : {}
320 : :
321 : 0 : ArrayElemsCopied::ArrayElemsCopied (ArrayElemsCopied const &other)
322 : 0 : : ArrayElems (other), elem_to_copy (other.elem_to_copy->clone_expr ()),
323 : 0 : num_copies (other.num_copies->clone_expr ())
324 : 0 : {}
325 : :
326 : : ArrayElemsCopied &
327 : 0 : ArrayElemsCopied::operator= (ArrayElemsCopied const &other)
328 : : {
329 : 0 : elem_to_copy = other.elem_to_copy->clone_expr ();
330 : 0 : num_copies = other.num_copies->clone_expr ();
331 : :
332 : 0 : return *this;
333 : : }
334 : :
335 : 375 : ArrayExpr::ArrayExpr (Analysis::NodeMapping mappings,
336 : : std::unique_ptr<ArrayElems> array_elems,
337 : : AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
338 : 375 : location_t locus)
339 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
340 : : WithInnerAttrs (std::move (inner_attribs)),
341 : 375 : internal_elements (std::move (array_elems)), locus (locus)
342 : 375 : {}
343 : :
344 : 0 : ArrayExpr::ArrayExpr (ArrayExpr const &other)
345 : 0 : : ExprWithoutBlock (other), WithInnerAttrs (other.inner_attrs),
346 : 0 : locus (other.locus)
347 : : {
348 : 0 : if (other.has_array_elems ())
349 : 0 : internal_elements = other.internal_elements->clone_array_elems ();
350 : 0 : }
351 : :
352 : : ArrayExpr &
353 : 0 : ArrayExpr::operator= (ArrayExpr const &other)
354 : : {
355 : 0 : ExprWithoutBlock::operator= (other);
356 : 0 : inner_attrs = other.inner_attrs;
357 : 0 : if (other.has_array_elems ())
358 : 0 : internal_elements = other.internal_elements->clone_array_elems ();
359 : 0 : locus = other.locus;
360 : : // outer_attrs = other.outer_attrs;
361 : :
362 : 0 : return *this;
363 : : }
364 : :
365 : 213 : ArrayIndexExpr::ArrayIndexExpr (Analysis::NodeMapping mappings,
366 : : std::unique_ptr<Expr> array_expr,
367 : : std::unique_ptr<Expr> array_index_expr,
368 : 213 : AST::AttrVec outer_attribs, location_t locus)
369 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
370 : 213 : array_expr (std::move (array_expr)),
371 : 213 : index_expr (std::move (array_index_expr)), locus (locus)
372 : 213 : {}
373 : :
374 : 0 : ArrayIndexExpr::ArrayIndexExpr (ArrayIndexExpr const &other)
375 : 0 : : ExprWithoutBlock (other), array_expr (other.array_expr->clone_expr ()),
376 : 0 : index_expr (other.index_expr->clone_expr ()), locus (other.locus)
377 : 0 : {}
378 : :
379 : : ArrayIndexExpr &
380 : 0 : ArrayIndexExpr::operator= (ArrayIndexExpr const &other)
381 : : {
382 : 0 : ExprWithoutBlock::operator= (other);
383 : 0 : array_expr = other.array_expr->clone_expr ();
384 : 0 : index_expr = other.index_expr->clone_expr ();
385 : : // outer_attrs = other.outer_attrs;
386 : 0 : locus = other.locus;
387 : :
388 : 0 : return *this;
389 : : }
390 : :
391 : 549 : TupleExpr::TupleExpr (Analysis::NodeMapping mappings,
392 : : std::vector<std::unique_ptr<Expr>> tuple_elements,
393 : : AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
394 : 549 : location_t locus)
395 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
396 : : WithInnerAttrs (std::move (inner_attribs)),
397 : 549 : tuple_elems (std::move (tuple_elements)), locus (locus)
398 : 549 : {}
399 : :
400 : 0 : TupleExpr::TupleExpr (TupleExpr const &other)
401 : 0 : : ExprWithoutBlock (other), WithInnerAttrs (other.inner_attrs),
402 : 0 : locus (other.locus)
403 : : {
404 : 0 : tuple_elems.reserve (other.tuple_elems.size ());
405 : 0 : for (const auto &e : other.tuple_elems)
406 : 0 : tuple_elems.push_back (e->clone_expr ());
407 : 0 : }
408 : :
409 : : TupleExpr &
410 : 0 : TupleExpr::operator= (TupleExpr const &other)
411 : : {
412 : 0 : ExprWithoutBlock::operator= (other);
413 : 0 : inner_attrs = other.inner_attrs;
414 : 0 : locus = other.locus;
415 : :
416 : 0 : tuple_elems.reserve (other.tuple_elems.size ());
417 : 0 : for (const auto &e : other.tuple_elems)
418 : 0 : tuple_elems.push_back (e->clone_expr ());
419 : :
420 : 0 : return *this;
421 : : }
422 : :
423 : 895 : TupleIndexExpr::TupleIndexExpr (Analysis::NodeMapping mappings,
424 : : std::unique_ptr<Expr> tuple_expr,
425 : : TupleIndex index, AST::AttrVec outer_attribs,
426 : 895 : location_t locus)
427 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
428 : 895 : tuple_expr (std::move (tuple_expr)), tuple_index (index), locus (locus)
429 : 895 : {}
430 : :
431 : 0 : TupleIndexExpr::TupleIndexExpr (TupleIndexExpr const &other)
432 : 0 : : ExprWithoutBlock (other), tuple_expr (other.tuple_expr->clone_expr ()),
433 : 0 : tuple_index (other.tuple_index), locus (other.locus)
434 : 0 : {}
435 : :
436 : : TupleIndexExpr &
437 : 0 : TupleIndexExpr::operator= (TupleIndexExpr const &other)
438 : : {
439 : 0 : ExprWithoutBlock::operator= (other);
440 : 0 : tuple_expr = other.tuple_expr->clone_expr ();
441 : 0 : tuple_index = other.tuple_index;
442 : 0 : locus = other.locus;
443 : : // outer_attrs = other.outer_attrs;
444 : :
445 : 0 : return *this;
446 : : }
447 : :
448 : 1390 : StructExpr::StructExpr (Analysis::NodeMapping mappings,
449 : : PathInExpression struct_path,
450 : 0 : AST::AttrVec outer_attribs)
451 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
452 : 1390 : struct_name (std::move (struct_path))
453 : 1390 : {}
454 : :
455 : 1390 : StructExprStruct::StructExprStruct (Analysis::NodeMapping mappings,
456 : : PathInExpression struct_path,
457 : : AST::AttrVec inner_attribs,
458 : : AST::AttrVec outer_attribs,
459 : 68 : location_t locus)
460 : : : StructExpr (std::move (mappings), std::move (struct_path),
461 : : std::move (outer_attribs)),
462 : 1390 : WithInnerAttrs (std::move (inner_attribs)), locus (locus)
463 : 1390 : {}
464 : :
465 : 63 : StructBase::StructBase (std::unique_ptr<Expr> base_struct_ptr)
466 : 63 : : base_struct (std::move (base_struct_ptr))
467 : 63 : {}
468 : :
469 : 0 : StructBase::StructBase (StructBase const &other)
470 : : {
471 : : /* HACK: gets around base_struct pointer being null (e.g. if no struct base
472 : : * exists) */
473 : 0 : if (other.base_struct != nullptr)
474 : 0 : other.base_struct->clone_expr ();
475 : 0 : }
476 : :
477 : : StructBase &
478 : 0 : StructBase::operator= (StructBase const &other)
479 : : {
480 : 0 : base_struct = other.base_struct->clone_expr ();
481 : :
482 : 0 : return *this;
483 : : }
484 : :
485 : 2895 : StructExprField::StructExprField (Analysis::NodeMapping mapping,
486 : 2895 : location_t locus)
487 : 2895 : : mappings (mapping), locus (locus)
488 : 2895 : {}
489 : :
490 : 216 : StructExprFieldIdentifier::StructExprFieldIdentifier (
491 : 216 : Analysis::NodeMapping mapping, Identifier field_identifier, location_t locus)
492 : 216 : : StructExprField (mapping, locus), field_name (std::move (field_identifier))
493 : 216 : {}
494 : :
495 : 2679 : StructExprFieldWithVal::StructExprFieldWithVal (
496 : : Analysis::NodeMapping mapping, std::unique_ptr<Expr> field_value,
497 : 2679 : location_t locus)
498 : 2679 : : StructExprField (mapping, locus), value (std::move (field_value))
499 : 2679 : {}
500 : :
501 : 0 : StructExprFieldWithVal::StructExprFieldWithVal (
502 : 0 : StructExprFieldWithVal const &other)
503 : 0 : : StructExprField (other.mappings, other.locus),
504 : 0 : value (other.value->clone_expr ())
505 : 0 : {}
506 : :
507 : : StructExprFieldWithVal &
508 : 0 : StructExprFieldWithVal::operator= (StructExprFieldWithVal const &other)
509 : : {
510 : 0 : value = other.value->clone_expr ();
511 : 0 : mappings = other.mappings;
512 : 0 : locus = other.locus;
513 : :
514 : 0 : return *this;
515 : : }
516 : :
517 : 2635 : StructExprFieldIdentifierValue::StructExprFieldIdentifierValue (
518 : : Analysis::NodeMapping mapping, Identifier field_identifier,
519 : 2635 : std::unique_ptr<Expr> field_value, location_t locus)
520 : : : StructExprFieldWithVal (mapping, std::move (field_value), locus),
521 : 2635 : field_name (std::move (field_identifier))
522 : 2635 : {}
523 : :
524 : 44 : StructExprFieldIndexValue::StructExprFieldIndexValue (
525 : : Analysis::NodeMapping mapping, TupleIndex tuple_index,
526 : 44 : std::unique_ptr<Expr> field_value, location_t locus)
527 : : : StructExprFieldWithVal (mapping, std::move (field_value), locus),
528 : 44 : index (tuple_index)
529 : 44 : {}
530 : :
531 : 1322 : StructExprStructFields::StructExprStructFields (
532 : : Analysis::NodeMapping mappings, PathInExpression struct_path,
533 : : std::vector<std::unique_ptr<StructExprField>> expr_fields, location_t locus,
534 : : tl::optional<std::unique_ptr<StructBase>> base_struct,
535 : : AST::AttrVec inner_attribs = AST::AttrVec (),
536 : 1322 : AST::AttrVec outer_attribs = AST::AttrVec ())
537 : : : StructExprStruct (std::move (mappings), std::move (struct_path),
538 : : std::move (inner_attribs), std::move (outer_attribs),
539 : : locus),
540 : 1322 : fields (std::move (expr_fields)), struct_base (std::move (base_struct))
541 : 1322 : {}
542 : :
543 : 0 : StructExprStructFields::StructExprStructFields (
544 : 0 : StructExprStructFields const &other)
545 : : : StructExprStruct (other),
546 : 0 : struct_base (other.has_struct_base ()
547 : 0 : ? tl::optional<std::unique_ptr<StructBase>> (
548 : 0 : std::make_unique<StructBase> (*other.struct_base.value ()))
549 : : : tl::nullopt),
550 : 0 : union_index (other.union_index)
551 : : {
552 : 0 : fields.reserve (other.fields.size ());
553 : 0 : for (const auto &e : other.fields)
554 : 0 : fields.push_back (e->clone_struct_expr_field ());
555 : 0 : }
556 : :
557 : : StructExprStructFields &
558 : 0 : StructExprStructFields::operator= (StructExprStructFields const &other)
559 : : {
560 : 0 : StructExprStruct::operator= (other);
561 : 0 : struct_base = other.has_struct_base ()
562 : 0 : ? tl::optional<std::unique_ptr<StructBase>> (
563 : 0 : std::make_unique<StructBase> (*other.struct_base.value ()))
564 : 0 : : tl::nullopt;
565 : 0 : union_index = other.union_index;
566 : :
567 : 0 : fields.reserve (other.fields.size ());
568 : 0 : for (const auto &e : other.fields)
569 : 0 : fields.push_back (e->clone_struct_expr_field ());
570 : :
571 : 0 : return *this;
572 : : }
573 : :
574 : 0 : StructExprStructBase::StructExprStructBase (Analysis::NodeMapping mappings,
575 : : PathInExpression struct_path,
576 : : StructBase base_struct,
577 : : AST::AttrVec inner_attribs,
578 : : AST::AttrVec outer_attribs,
579 : 0 : location_t locus)
580 : : : StructExprStruct (std::move (mappings), std::move (struct_path),
581 : : std::move (inner_attribs), std::move (outer_attribs),
582 : : locus),
583 : 0 : struct_base (std::move (base_struct))
584 : 0 : {}
585 : :
586 : 10880 : CallExpr::CallExpr (Analysis::NodeMapping mappings,
587 : : std::unique_ptr<Expr> function_expr,
588 : : std::vector<std::unique_ptr<Expr>> function_params,
589 : 10880 : AST::AttrVec outer_attribs, location_t locus)
590 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
591 : 10880 : function (std::move (function_expr)), params (std::move (function_params)),
592 : 10880 : locus (locus)
593 : 10880 : {}
594 : :
595 : 8 : CallExpr::CallExpr (CallExpr const &other)
596 : 16 : : ExprWithoutBlock (other), function (other.function->clone_expr ()),
597 : 8 : locus (other.locus)
598 : : /*, params(other.params),*/ {
599 : 8 : params.reserve (other.params.size ());
600 : 8 : for (const auto &e : other.params)
601 : 0 : params.push_back (e->clone_expr ());
602 : 8 : }
603 : :
604 : : CallExpr &
605 : 0 : CallExpr::operator= (CallExpr const &other)
606 : : {
607 : 0 : ExprWithoutBlock::operator= (other);
608 : 0 : function = other.function->clone_expr ();
609 : 0 : locus = other.locus;
610 : : // params = other.params;
611 : : // outer_attrs = other.outer_attrs;
612 : :
613 : 0 : params.reserve (other.params.size ());
614 : 0 : for (const auto &e : other.params)
615 : 0 : params.push_back (e->clone_expr ());
616 : :
617 : 0 : return *this;
618 : : }
619 : :
620 : 2963 : MethodCallExpr::MethodCallExpr (
621 : : Analysis::NodeMapping mappings, std::unique_ptr<Expr> call_receiver,
622 : : PathExprSegment method_path, std::vector<std::unique_ptr<Expr>> method_params,
623 : 2963 : AST::AttrVec outer_attribs, location_t locus)
624 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
625 : 2963 : receiver (std::move (call_receiver)), method_name (std::move (method_path)),
626 : 2963 : params (std::move (method_params)), locus (locus)
627 : 2963 : {}
628 : :
629 : 0 : MethodCallExpr::MethodCallExpr (MethodCallExpr const &other)
630 : 0 : : ExprWithoutBlock (other), receiver (other.receiver->clone_expr ()),
631 : 0 : method_name (other.method_name), locus (other.locus)
632 : : /*, params(other.params),*/ {
633 : 0 : params.reserve (other.params.size ());
634 : 0 : for (const auto &e : other.params)
635 : 0 : params.push_back (e->clone_expr ());
636 : 0 : }
637 : :
638 : : MethodCallExpr &
639 : 0 : MethodCallExpr::operator= (MethodCallExpr const &other)
640 : : {
641 : 0 : ExprWithoutBlock::operator= (other);
642 : 0 : receiver = other.receiver->clone_expr ();
643 : 0 : method_name = other.method_name;
644 : 0 : locus = other.locus;
645 : : // params = other.params;
646 : : // outer_attrs = other.outer_attrs;
647 : :
648 : 0 : params.reserve (other.params.size ());
649 : 0 : for (const auto &e : other.params)
650 : 0 : params.push_back (e->clone_expr ());
651 : :
652 : 0 : return *this;
653 : : }
654 : :
655 : 5548 : FieldAccessExpr::FieldAccessExpr (Analysis::NodeMapping mappings,
656 : : std::unique_ptr<Expr> field_access_receiver,
657 : : Identifier field_name,
658 : 5548 : AST::AttrVec outer_attribs, location_t locus)
659 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
660 : 5548 : receiver (std::move (field_access_receiver)),
661 : 5548 : field (std::move (field_name)), locus (locus)
662 : 5548 : {}
663 : :
664 : 0 : FieldAccessExpr::FieldAccessExpr (FieldAccessExpr const &other)
665 : 0 : : ExprWithoutBlock (other), receiver (other.receiver->clone_expr ()),
666 : 0 : field (other.field), locus (other.locus)
667 : 0 : {}
668 : :
669 : : FieldAccessExpr &
670 : 0 : FieldAccessExpr::operator= (FieldAccessExpr const &other)
671 : : {
672 : 0 : ExprWithoutBlock::operator= (other);
673 : 0 : receiver = other.receiver->clone_expr ();
674 : 0 : field = other.field;
675 : 0 : locus = other.locus;
676 : : // outer_attrs = other.outer_attrs;
677 : :
678 : 0 : return *this;
679 : : }
680 : :
681 : 60 : ClosureParam::ClosureParam (std::unique_ptr<Pattern> param_pattern,
682 : : location_t locus, std::unique_ptr<Type> param_type,
683 : 60 : std::vector<AST::Attribute> outer_attrs)
684 : 60 : : outer_attrs (std::move (outer_attrs)), pattern (std::move (param_pattern)),
685 : 60 : type (std::move (param_type)), locus (locus)
686 : 60 : {}
687 : :
688 : 0 : ClosureParam::ClosureParam (ClosureParam const &other)
689 : 0 : : pattern (other.pattern->clone_pattern ())
690 : : {
691 : : // guard to protect from null pointer dereference
692 : 0 : if (other.pattern != nullptr)
693 : 0 : pattern = other.pattern->clone_pattern ();
694 : 0 : if (other.type != nullptr)
695 : 0 : type = other.type->clone_type ();
696 : 0 : }
697 : :
698 : : ClosureParam &
699 : 0 : ClosureParam::operator= (ClosureParam const &other)
700 : : {
701 : 0 : outer_attrs = other.outer_attrs;
702 : :
703 : : // guard to protect from null pointer dereference
704 : 0 : if (other.pattern != nullptr)
705 : 0 : pattern = other.pattern->clone_pattern ();
706 : : else
707 : 0 : pattern = nullptr;
708 : 0 : if (other.type != nullptr)
709 : 0 : type = other.type->clone_type ();
710 : : else
711 : 0 : type = nullptr;
712 : :
713 : 0 : return *this;
714 : : }
715 : :
716 : 63 : ClosureExpr::ClosureExpr (Analysis::NodeMapping mappings,
717 : : std::vector<ClosureParam> closure_params,
718 : : std::unique_ptr<Type> closure_return_type,
719 : : std::unique_ptr<Expr> closure_expr, bool has_move,
720 : 63 : AST::AttrVec outer_attribs, location_t locus)
721 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
722 : 63 : has_move (has_move), params (std::move (closure_params)), locus (locus),
723 : 63 : return_type (std::move (closure_return_type)),
724 : 63 : expr (std::move (closure_expr))
725 : 63 : {}
726 : :
727 : 0 : ClosureExpr::ClosureExpr (ClosureExpr const &other)
728 : 0 : : ExprWithoutBlock (other.get_mappings (), other.get_outer_attrs ())
729 : : {
730 : 0 : return_type
731 : 0 : = other.has_return_type () ? other.return_type->clone_type () : nullptr;
732 : 0 : expr = other.expr->clone_expr ();
733 : 0 : params = other.params;
734 : 0 : has_move = other.has_move;
735 : 0 : }
736 : :
737 : : ClosureExpr &
738 : 0 : ClosureExpr::operator= (ClosureExpr const &other)
739 : : {
740 : 0 : mappings = other.mappings;
741 : 0 : return_type
742 : 0 : = other.has_return_type () ? other.return_type->clone_type () : nullptr;
743 : 0 : expr = other.expr->clone_expr ();
744 : 0 : params = other.params;
745 : 0 : has_move = other.has_move;
746 : :
747 : 0 : return *this;
748 : : }
749 : :
750 : 21339 : BlockExpr::BlockExpr (Analysis::NodeMapping mappings,
751 : : std::vector<std::unique_ptr<Stmt>> block_statements,
752 : : std::unique_ptr<Expr> block_expr, bool tail_reachable,
753 : : AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
754 : : tl::optional<LoopLabel> label, location_t start_locus,
755 : 21339 : location_t end_locus)
756 : : : ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
757 : : WithInnerAttrs (std::move (inner_attribs)),
758 : 21339 : statements (std::move (block_statements)), expr (std::move (block_expr)),
759 : 21339 : tail_reachable (tail_reachable), label (std::move (label)),
760 : 21339 : start_locus (start_locus), end_locus (end_locus)
761 : 21339 : {}
762 : :
763 : 41 : BlockExpr::BlockExpr (BlockExpr const &other)
764 : : : ExprWithBlock (other), /*statements(other.statements),*/
765 : 41 : WithInnerAttrs (other.inner_attrs), label (other.label),
766 : 41 : start_locus (other.start_locus), end_locus (other.end_locus)
767 : : {
768 : : // guard to protect from null pointer dereference
769 : 41 : if (other.expr != nullptr)
770 : 40 : expr = other.expr->clone_expr ();
771 : :
772 : 41 : statements.reserve (other.statements.size ());
773 : 58 : for (const auto &e : other.statements)
774 : 17 : statements.push_back (e->clone_stmt ());
775 : 41 : }
776 : :
777 : : BlockExpr &
778 : 0 : BlockExpr::operator= (BlockExpr const &other)
779 : : {
780 : 0 : ExprWithBlock::operator= (other);
781 : : // statements = other.statements;
782 : 0 : expr = other.expr->clone_expr ();
783 : 0 : inner_attrs = other.inner_attrs;
784 : 0 : start_locus = other.end_locus;
785 : 0 : end_locus = other.end_locus;
786 : : // outer_attrs = other.outer_attrs;
787 : :
788 : 0 : statements.reserve (other.statements.size ());
789 : 0 : for (const auto &e : other.statements)
790 : 0 : statements.push_back (e->clone_stmt ());
791 : :
792 : 0 : return *this;
793 : : }
794 : :
795 : 599 : AnonConst::AnonConst (Analysis::NodeMapping mappings,
796 : 599 : std::unique_ptr<Expr> &&expr, location_t locus)
797 : 599 : : ExprWithBlock (std::move (mappings), {}), locus (locus),
798 : 599 : kind (Kind::Explicit), expr (std::move (expr))
799 : : {
800 : 599 : rust_assert (this->expr.value ());
801 : 599 : }
802 : :
803 : 4 : AnonConst::AnonConst (Analysis::NodeMapping mappings, location_t locus)
804 : 4 : : ExprWithBlock (std::move (mappings), {}), locus (locus),
805 : 4 : kind (Kind::DeferredInference), expr (tl::nullopt)
806 : 4 : {}
807 : :
808 : 7 : AnonConst::AnonConst (const AnonConst &other)
809 : 7 : : ExprWithBlock (other), locus (other.locus), kind (other.kind)
810 : : {
811 : 7 : if (other.expr)
812 : 7 : expr = other.expr.value ()->clone_expr ();
813 : 7 : }
814 : :
815 : : AnonConst
816 : 0 : AnonConst::operator= (const AnonConst &other)
817 : : {
818 : 0 : ExprWithBlock::operator= (other);
819 : :
820 : 0 : locus = other.locus;
821 : 0 : kind = other.kind;
822 : :
823 : 0 : if (other.expr)
824 : 0 : expr = other.expr.value ()->clone_expr ();
825 : :
826 : 0 : return *this;
827 : : }
828 : :
829 : 7 : ConstBlock::ConstBlock (Analysis::NodeMapping mappings, AnonConst &&expr,
830 : 7 : location_t locus, AST::AttrVec outer_attrs)
831 : : : ExprWithBlock (std::move (mappings), std::move (outer_attrs)),
832 : 7 : expr (std::move (expr)), locus (locus)
833 : 7 : {}
834 : :
835 : 0 : ConstBlock::ConstBlock (const ConstBlock &other)
836 : 0 : : ExprWithBlock (other), expr (other.expr), locus (other.locus)
837 : 0 : {}
838 : :
839 : : ConstBlock
840 : 0 : ConstBlock::operator= (const ConstBlock &other)
841 : : {
842 : 0 : ExprWithBlock::operator= (other);
843 : :
844 : 0 : expr = other.expr;
845 : 0 : locus = other.locus;
846 : :
847 : 0 : return *this;
848 : : }
849 : :
850 : 9 : ContinueExpr::ContinueExpr (Analysis::NodeMapping mappings, location_t locus,
851 : : tl::optional<Lifetime> label,
852 : 9 : AST::AttrVec outer_attribs)
853 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
854 : 9 : label (std::move (label)), locus (locus)
855 : 9 : {}
856 : :
857 : 77 : BreakExpr::BreakExpr (Analysis::NodeMapping mappings, location_t locus,
858 : : tl::optional<Lifetime> break_label,
859 : : std::unique_ptr<Expr> expr_in_break,
860 : 77 : AST::AttrVec outer_attribs)
861 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
862 : 154 : label (std::move (break_label)), break_expr (std::move (expr_in_break)),
863 : 77 : locus (locus)
864 : 77 : {}
865 : :
866 : 0 : BreakExpr::BreakExpr (BreakExpr const &other)
867 : 0 : : ExprWithoutBlock (other), label (other.label), locus (other.locus)
868 : : {
869 : : // guard to protect from null pointer dereference
870 : 0 : if (other.break_expr != nullptr)
871 : 0 : break_expr = other.break_expr->clone_expr ();
872 : 0 : }
873 : :
874 : : BreakExpr &
875 : 0 : BreakExpr::operator= (BreakExpr const &other)
876 : : {
877 : 0 : ExprWithoutBlock::operator= (other);
878 : 0 : label = other.label;
879 : 0 : break_expr = other.break_expr->clone_expr ();
880 : 0 : locus = other.locus;
881 : : // outer_attrs = other.outer_attrs;
882 : :
883 : 0 : return *this;
884 : : }
885 : :
886 : 87 : RangeExpr::RangeExpr (Analysis::NodeMapping mappings, location_t locus)
887 : 87 : : ExprWithoutBlock (std::move (mappings), AST::AttrVec ()), locus (locus)
888 : 87 : {}
889 : :
890 : 66 : RangeFromToExpr::RangeFromToExpr (Analysis::NodeMapping mappings,
891 : : std::unique_ptr<Expr> range_from,
892 : : std::unique_ptr<Expr> range_to,
893 : 66 : location_t locus)
894 : 66 : : RangeExpr (std::move (mappings), locus), from (std::move (range_from)),
895 : 66 : to (std::move (range_to))
896 : 66 : {}
897 : :
898 : 0 : RangeFromToExpr::RangeFromToExpr (RangeFromToExpr const &other)
899 : 0 : : RangeExpr (other), from (other.from->clone_expr ()),
900 : 0 : to (other.to->clone_expr ())
901 : 0 : {}
902 : :
903 : : RangeFromToExpr &
904 : 0 : RangeFromToExpr::operator= (RangeFromToExpr const &other)
905 : : {
906 : 0 : RangeExpr::operator= (other);
907 : 0 : from = other.from->clone_expr ();
908 : 0 : to = other.to->clone_expr ();
909 : :
910 : 0 : return *this;
911 : : }
912 : :
913 : 7 : RangeFromExpr::RangeFromExpr (Analysis::NodeMapping mappings,
914 : : std::unique_ptr<Expr> range_from,
915 : 7 : location_t locus)
916 : 7 : : RangeExpr (std::move (mappings), locus), from (std::move (range_from))
917 : 7 : {}
918 : :
919 : 0 : RangeFromExpr::RangeFromExpr (RangeFromExpr const &other)
920 : 0 : : RangeExpr (other), from (other.from->clone_expr ())
921 : 0 : {}
922 : :
923 : : RangeFromExpr &
924 : 0 : RangeFromExpr::operator= (RangeFromExpr const &other)
925 : : {
926 : 0 : RangeExpr::operator= (other);
927 : 0 : from = other.from->clone_expr ();
928 : :
929 : 0 : return *this;
930 : : }
931 : :
932 : 7 : RangeToExpr::RangeToExpr (Analysis::NodeMapping mappings,
933 : 7 : std::unique_ptr<Expr> range_to, location_t locus)
934 : 7 : : RangeExpr (std::move (mappings), locus), to (std::move (range_to))
935 : 7 : {}
936 : :
937 : 0 : RangeToExpr::RangeToExpr (RangeToExpr const &other)
938 : 0 : : RangeExpr (other), to (other.to->clone_expr ())
939 : 0 : {}
940 : :
941 : : RangeToExpr &
942 : 0 : RangeToExpr::operator= (RangeToExpr const &other)
943 : : {
944 : 0 : RangeExpr::operator= (other);
945 : 0 : to = other.to->clone_expr ();
946 : :
947 : 0 : return *this;
948 : : }
949 : :
950 : 0 : RangeFullExpr::RangeFullExpr (Analysis::NodeMapping mappings, location_t locus)
951 : 0 : : RangeExpr (std::move (mappings), locus)
952 : 0 : {}
953 : :
954 : 7 : RangeFromToInclExpr::RangeFromToInclExpr (Analysis::NodeMapping mappings,
955 : : std::unique_ptr<Expr> range_from,
956 : : std::unique_ptr<Expr> range_to,
957 : 7 : location_t locus)
958 : 7 : : RangeExpr (std::move (mappings), locus), from (std::move (range_from)),
959 : 7 : to (std::move (range_to))
960 : 7 : {}
961 : :
962 : 0 : RangeFromToInclExpr::RangeFromToInclExpr (RangeFromToInclExpr const &other)
963 : 0 : : RangeExpr (other), from (other.from->clone_expr ()),
964 : 0 : to (other.to->clone_expr ())
965 : 0 : {}
966 : :
967 : : RangeFromToInclExpr &
968 : 0 : RangeFromToInclExpr::operator= (RangeFromToInclExpr const &other)
969 : : {
970 : 0 : RangeExpr::operator= (other);
971 : 0 : from = other.from->clone_expr ();
972 : 0 : to = other.to->clone_expr ();
973 : :
974 : 0 : return *this;
975 : : }
976 : :
977 : 0 : RangeToInclExpr::RangeToInclExpr (Analysis::NodeMapping mappings,
978 : : std::unique_ptr<Expr> range_to,
979 : 0 : location_t locus)
980 : 0 : : RangeExpr (std::move (mappings), locus), to (std::move (range_to))
981 : 0 : {}
982 : :
983 : 0 : RangeToInclExpr::RangeToInclExpr (RangeToInclExpr const &other)
984 : 0 : : RangeExpr (other), to (other.to->clone_expr ())
985 : 0 : {}
986 : :
987 : : RangeToInclExpr &
988 : 0 : RangeToInclExpr::operator= (RangeToInclExpr const &other)
989 : : {
990 : 0 : RangeExpr::operator= (other);
991 : 0 : to = other.to->clone_expr ();
992 : :
993 : 0 : return *this;
994 : : }
995 : :
996 : 495 : ReturnExpr::ReturnExpr (Analysis::NodeMapping mappings, location_t locus,
997 : : std::unique_ptr<Expr> returned_expr,
998 : 495 : AST::AttrVec outer_attribs)
999 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
1000 : 495 : return_expr (std::move (returned_expr)), locus (locus)
1001 : 495 : {}
1002 : :
1003 : 0 : ReturnExpr::ReturnExpr (ReturnExpr const &other)
1004 : 0 : : ExprWithoutBlock (other), locus (other.locus)
1005 : : {
1006 : : // guard to protect from null pointer dereference
1007 : 0 : if (other.return_expr != nullptr)
1008 : 0 : return_expr = other.return_expr->clone_expr ();
1009 : 0 : }
1010 : :
1011 : : ReturnExpr &
1012 : 0 : ReturnExpr::operator= (ReturnExpr const &other)
1013 : : {
1014 : 0 : ExprWithoutBlock::operator= (other);
1015 : 0 : return_expr = other.return_expr->clone_expr ();
1016 : 0 : locus = other.locus;
1017 : : // outer_attrs = other.outer_attrs;
1018 : :
1019 : 0 : return *this;
1020 : : }
1021 : :
1022 : 3429 : UnsafeBlockExpr::UnsafeBlockExpr (Analysis::NodeMapping mappings,
1023 : : std::unique_ptr<BlockExpr> block_expr,
1024 : 3429 : AST::AttrVec outer_attribs, location_t locus)
1025 : : : ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
1026 : 3429 : expr (std::move (block_expr)), locus (locus)
1027 : 3429 : {}
1028 : :
1029 : 0 : UnsafeBlockExpr::UnsafeBlockExpr (UnsafeBlockExpr const &other)
1030 : 0 : : ExprWithBlock (other), expr (other.expr->clone_block_expr ()),
1031 : 0 : locus (other.locus)
1032 : 0 : {}
1033 : :
1034 : : UnsafeBlockExpr &
1035 : 0 : UnsafeBlockExpr::operator= (UnsafeBlockExpr const &other)
1036 : : {
1037 : 0 : ExprWithBlock::operator= (other);
1038 : 0 : expr = other.expr->clone_block_expr ();
1039 : 0 : locus = other.locus;
1040 : : // outer_attrs = other.outer_attrs;
1041 : :
1042 : 0 : return *this;
1043 : : }
1044 : :
1045 : 176 : BaseLoopExpr::BaseLoopExpr (Analysis::NodeMapping mappings,
1046 : : std::unique_ptr<BlockExpr> loop_block,
1047 : : location_t locus,
1048 : : tl::optional<LoopLabel> loop_label,
1049 : 0 : AST::AttrVec outer_attribs)
1050 : : : ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
1051 : 352 : loop_label (std::move (loop_label)), loop_block (std::move (loop_block)),
1052 : 176 : locus (locus)
1053 : 176 : {}
1054 : :
1055 : 0 : BaseLoopExpr::BaseLoopExpr (BaseLoopExpr const &other)
1056 : 0 : : ExprWithBlock (other), loop_label (other.loop_label),
1057 : 0 : loop_block (other.loop_block->clone_block_expr ()), locus (other.locus)
1058 : 0 : {}
1059 : :
1060 : : BaseLoopExpr &
1061 : 0 : BaseLoopExpr::operator= (BaseLoopExpr const &other)
1062 : : {
1063 : 0 : ExprWithBlock::operator= (other);
1064 : 0 : loop_block = other.loop_block->clone_block_expr ();
1065 : 0 : loop_label = other.loop_label;
1066 : 0 : locus = other.locus;
1067 : : // outer_attrs = other.outer_attrs;
1068 : :
1069 : 0 : return *this;
1070 : : }
1071 : :
1072 : 110 : LoopExpr::LoopExpr (Analysis::NodeMapping mappings,
1073 : : std::unique_ptr<BlockExpr> loop_block, location_t locus,
1074 : : tl::optional<LoopLabel> loop_label,
1075 : 110 : AST::AttrVec outer_attribs)
1076 : : : BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
1077 : 138 : std::move (loop_label), std::move (outer_attribs))
1078 : 110 : {}
1079 : :
1080 : 66 : WhileLoopExpr::WhileLoopExpr (Analysis::NodeMapping mappings,
1081 : : std::unique_ptr<Expr> loop_condition,
1082 : : std::unique_ptr<BlockExpr> loop_block,
1083 : : location_t locus,
1084 : : tl::optional<LoopLabel> loop_label,
1085 : 66 : AST::AttrVec outer_attribs)
1086 : : : BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
1087 : : std::move (loop_label), std::move (outer_attribs)),
1088 : 68 : condition (std::move (loop_condition))
1089 : 66 : {}
1090 : :
1091 : 0 : WhileLoopExpr::WhileLoopExpr (WhileLoopExpr const &other)
1092 : 0 : : BaseLoopExpr (other), condition (other.condition->clone_expr ())
1093 : 0 : {}
1094 : :
1095 : : WhileLoopExpr &
1096 : 0 : WhileLoopExpr::operator= (WhileLoopExpr const &other)
1097 : : {
1098 : 0 : BaseLoopExpr::operator= (other);
1099 : 0 : condition = other.condition->clone_expr ();
1100 : : // loop_block = other.loop_block->clone_block_expr();
1101 : : // loop_label = other.loop_label;
1102 : : // outer_attrs = other.outer_attrs;
1103 : :
1104 : 0 : return *this;
1105 : : }
1106 : :
1107 : 0 : WhileLetLoopExpr::WhileLetLoopExpr (
1108 : : Analysis::NodeMapping mappings,
1109 : : std::vector<std::unique_ptr<Pattern>> match_arm_patterns,
1110 : : std::unique_ptr<Expr> condition, std::unique_ptr<BlockExpr> loop_block,
1111 : : location_t locus, tl::optional<LoopLabel> loop_label,
1112 : 0 : AST::AttrVec outer_attribs)
1113 : : : BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
1114 : : std::move (loop_label), std::move (outer_attribs)),
1115 : 0 : match_arm_patterns (std::move (match_arm_patterns)),
1116 : 0 : condition (std::move (condition))
1117 : 0 : {}
1118 : :
1119 : 0 : WhileLetLoopExpr::WhileLetLoopExpr (WhileLetLoopExpr const &other)
1120 : : : BaseLoopExpr (other),
1121 : 0 : /*match_arm_patterns(other.match_arm_patterns),*/ condition (
1122 : 0 : other.condition->clone_expr ())
1123 : : {
1124 : 0 : match_arm_patterns.reserve (other.match_arm_patterns.size ());
1125 : 0 : for (const auto &e : other.match_arm_patterns)
1126 : 0 : match_arm_patterns.push_back (e->clone_pattern ());
1127 : 0 : }
1128 : :
1129 : : WhileLetLoopExpr &
1130 : 0 : WhileLetLoopExpr::operator= (WhileLetLoopExpr const &other)
1131 : : {
1132 : 0 : BaseLoopExpr::operator= (other);
1133 : : // match_arm_patterns = other.match_arm_patterns;
1134 : 0 : condition = other.condition->clone_expr ();
1135 : : // loop_block = other.loop_block->clone_block_expr();
1136 : : // loop_label = other.loop_label;
1137 : : // outer_attrs = other.outer_attrs;
1138 : :
1139 : 0 : match_arm_patterns.reserve (other.match_arm_patterns.size ());
1140 : 0 : for (const auto &e : other.match_arm_patterns)
1141 : 0 : match_arm_patterns.push_back (e->clone_pattern ());
1142 : :
1143 : 0 : return *this;
1144 : : }
1145 : :
1146 : 1645 : IfExpr::IfExpr (Analysis::NodeMapping mappings, std::unique_ptr<Expr> condition,
1147 : 441 : std::unique_ptr<BlockExpr> if_block, location_t locus)
1148 : 1645 : : ExprWithBlock (std::move (mappings), AST::AttrVec ()),
1149 : 1645 : condition (std::move (condition)), if_block (std::move (if_block)),
1150 : 1645 : locus (locus)
1151 : 1645 : {}
1152 : :
1153 : 0 : IfExpr::IfExpr (IfExpr const &other)
1154 : 0 : : ExprWithBlock (other), condition (other.condition->clone_expr ()),
1155 : 0 : if_block (other.if_block->clone_block_expr ()), locus (other.locus)
1156 : 0 : {}
1157 : :
1158 : : IfExpr &
1159 : 0 : IfExpr::operator= (IfExpr const &other)
1160 : : {
1161 : 0 : ExprWithBlock::operator= (other);
1162 : 0 : condition = other.condition->clone_expr ();
1163 : 0 : if_block = other.if_block->clone_block_expr ();
1164 : 0 : locus = other.locus;
1165 : :
1166 : 0 : return *this;
1167 : : }
1168 : :
1169 : 1204 : IfExprConseqElse::IfExprConseqElse (Analysis::NodeMapping mappings,
1170 : : std::unique_ptr<Expr> condition,
1171 : : std::unique_ptr<BlockExpr> if_block,
1172 : : std::unique_ptr<ExprWithBlock> else_block,
1173 : 1204 : location_t locus)
1174 : : : IfExpr (std::move (mappings), std::move (condition), std::move (if_block),
1175 : : locus),
1176 : 1204 : else_block (std::move (else_block))
1177 : 1204 : {}
1178 : :
1179 : 0 : IfExprConseqElse::IfExprConseqElse (IfExprConseqElse const &other)
1180 : 0 : : IfExpr (other), else_block (other.else_block->clone_expr_with_block ())
1181 : 0 : {}
1182 : :
1183 : : IfExprConseqElse &
1184 : 0 : IfExprConseqElse::operator= (IfExprConseqElse const &other)
1185 : : {
1186 : 0 : IfExpr::operator= (other);
1187 : : // condition = other.condition->clone_expr();
1188 : : // if_block = other.if_block->clone_block_expr();
1189 : 0 : else_block = other.else_block->clone_expr_with_block ();
1190 : :
1191 : 0 : return *this;
1192 : : }
1193 : :
1194 : 2323 : MatchArm::MatchArm (std::vector<std::unique_ptr<Pattern>> match_arm_patterns,
1195 : : location_t locus, std::unique_ptr<Expr> guard_expr,
1196 : 2323 : AST::AttrVec outer_attrs)
1197 : 2323 : : outer_attrs (std::move (outer_attrs)),
1198 : 2323 : match_arm_patterns (std::move (match_arm_patterns)),
1199 : 2323 : guard_expr (std::move (guard_expr)), locus (locus)
1200 : 2323 : {}
1201 : :
1202 : 3146 : MatchArm::MatchArm (MatchArm const &other) : outer_attrs (other.outer_attrs)
1203 : : {
1204 : : // guard to protect from null pointer dereference
1205 : 3146 : if (other.guard_expr != nullptr)
1206 : 0 : guard_expr = other.guard_expr->clone_expr ();
1207 : :
1208 : 3146 : match_arm_patterns.reserve (other.match_arm_patterns.size ());
1209 : 6292 : for (const auto &e : other.match_arm_patterns)
1210 : 3146 : match_arm_patterns.push_back (e->clone_pattern ());
1211 : :
1212 : 3146 : locus = other.locus;
1213 : 3146 : }
1214 : :
1215 : : MatchArm &
1216 : 0 : MatchArm::operator= (MatchArm const &other)
1217 : : {
1218 : 0 : outer_attrs = other.outer_attrs;
1219 : :
1220 : 0 : if (other.guard_expr != nullptr)
1221 : 0 : guard_expr = other.guard_expr->clone_expr ();
1222 : :
1223 : 0 : match_arm_patterns.clear ();
1224 : 0 : match_arm_patterns.reserve (other.match_arm_patterns.size ());
1225 : 0 : for (const auto &e : other.match_arm_patterns)
1226 : 0 : match_arm_patterns.push_back (e->clone_pattern ());
1227 : :
1228 : 0 : return *this;
1229 : : }
1230 : :
1231 : 2323 : MatchCase::MatchCase (Analysis::NodeMapping mappings, MatchArm arm,
1232 : 2323 : std::unique_ptr<Expr> expr)
1233 : 2323 : : mappings (mappings), arm (std::move (arm)), expr (std::move (expr))
1234 : 2323 : {}
1235 : :
1236 : 0 : MatchCase::MatchCase (const MatchCase &other)
1237 : 0 : : mappings (other.mappings), arm (other.arm), expr (other.expr->clone_expr ())
1238 : 0 : {}
1239 : :
1240 : : MatchCase &
1241 : 0 : MatchCase::operator= (const MatchCase &other)
1242 : : {
1243 : 0 : mappings = other.mappings;
1244 : 0 : arm = other.arm;
1245 : 0 : expr = other.expr->clone_expr ();
1246 : :
1247 : 0 : return *this;
1248 : : }
1249 : :
1250 : 1020 : MatchExpr::MatchExpr (Analysis::NodeMapping mappings,
1251 : : std::unique_ptr<Expr> branch_value,
1252 : : std::vector<MatchCase> match_arms,
1253 : : AST::AttrVec inner_attrs, AST::AttrVec outer_attrs,
1254 : 1020 : location_t locus)
1255 : : : ExprWithBlock (std::move (mappings), std::move (outer_attrs)),
1256 : : WithInnerAttrs (std::move (inner_attrs)),
1257 : 1020 : branch_value (std::move (branch_value)),
1258 : 1020 : match_arms (std::move (match_arms)), locus (locus)
1259 : 1020 : {}
1260 : :
1261 : 0 : MatchExpr::MatchExpr (MatchExpr const &other)
1262 : 0 : : ExprWithBlock (other), WithInnerAttrs (other.inner_attrs),
1263 : 0 : branch_value (other.branch_value->clone_expr ()),
1264 : 0 : match_arms (other.match_arms), locus (other.locus)
1265 : : {
1266 : : /*match_arms.reserve (other.match_arms.size ());
1267 : : for (const auto &e : other.match_arms)
1268 : : match_arms.push_back (e->clone_match_case ());*/
1269 : 0 : }
1270 : :
1271 : : MatchExpr &
1272 : 0 : MatchExpr::operator= (MatchExpr const &other)
1273 : : {
1274 : 0 : ExprWithBlock::operator= (other);
1275 : 0 : branch_value = other.branch_value->clone_expr ();
1276 : 0 : inner_attrs = other.inner_attrs;
1277 : 0 : match_arms = other.match_arms;
1278 : : // outer_attrs = other.outer_attrs;
1279 : 0 : locus = other.locus;
1280 : :
1281 : : /*match_arms.reserve (other.match_arms.size ());
1282 : : for (const auto &e : other.match_arms)
1283 : : match_arms.push_back (e->clone_match_case ());*/
1284 : :
1285 : 0 : return *this;
1286 : : }
1287 : :
1288 : 0 : AwaitExpr::AwaitExpr (Analysis::NodeMapping mappings,
1289 : : std::unique_ptr<Expr> awaited_expr,
1290 : 0 : AST::AttrVec outer_attrs, location_t locus)
1291 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attrs)),
1292 : 0 : awaited_expr (std::move (awaited_expr)), locus (locus)
1293 : 0 : {}
1294 : :
1295 : 0 : AwaitExpr::AwaitExpr (AwaitExpr const &other)
1296 : 0 : : ExprWithoutBlock (other), awaited_expr (other.awaited_expr->clone_expr ()),
1297 : 0 : locus (other.locus)
1298 : 0 : {}
1299 : :
1300 : : AwaitExpr &
1301 : 0 : AwaitExpr::operator= (AwaitExpr const &other)
1302 : : {
1303 : 0 : ExprWithoutBlock::operator= (other);
1304 : 0 : awaited_expr = other.awaited_expr->clone_expr ();
1305 : 0 : locus = other.locus;
1306 : :
1307 : 0 : return *this;
1308 : : }
1309 : :
1310 : 0 : AsyncBlockExpr::AsyncBlockExpr (Analysis::NodeMapping mappings,
1311 : : std::unique_ptr<BlockExpr> block_expr,
1312 : : bool has_move, AST::AttrVec outer_attrs,
1313 : 0 : location_t locus)
1314 : : : ExprWithBlock (std::move (mappings), std::move (outer_attrs)),
1315 : 0 : has_move (has_move), block_expr (std::move (block_expr)), locus (locus)
1316 : 0 : {}
1317 : :
1318 : 0 : AsyncBlockExpr::AsyncBlockExpr (AsyncBlockExpr const &other)
1319 : 0 : : ExprWithBlock (other), has_move (other.has_move),
1320 : 0 : block_expr (other.block_expr->clone_block_expr ()), locus (other.locus)
1321 : 0 : {}
1322 : :
1323 : : AsyncBlockExpr &
1324 : 0 : AsyncBlockExpr::operator= (AsyncBlockExpr const &other)
1325 : : {
1326 : 0 : ExprWithBlock::operator= (other);
1327 : 0 : has_move = other.has_move;
1328 : 0 : block_expr = other.block_expr->clone_block_expr ();
1329 : 0 : locus = other.locus;
1330 : :
1331 : 0 : return *this;
1332 : : }
1333 : :
1334 : 653 : OperatorExprMeta::OperatorExprMeta (HIR::CompoundAssignmentExpr &expr)
1335 : 653 : : node_mappings (expr.get_mappings ()),
1336 : 653 : lvalue_mappings (expr.get_expr ().get_mappings ()),
1337 : 653 : rvalue_mappings (expr.get_rhs ().get_mappings ()), locus (expr.get_locus ())
1338 : 653 : {}
1339 : :
1340 : 3467 : OperatorExprMeta::OperatorExprMeta (HIR::ArithmeticOrLogicalExpr &expr)
1341 : 3467 : : node_mappings (expr.get_mappings ()),
1342 : 3467 : lvalue_mappings (expr.get_expr ().get_mappings ()),
1343 : 3467 : rvalue_mappings (expr.get_rhs ().get_mappings ()), locus (expr.get_locus ())
1344 : 3467 : {}
1345 : :
1346 : 526 : OperatorExprMeta::OperatorExprMeta (HIR::NegationExpr &expr)
1347 : 526 : : node_mappings (expr.get_mappings ()),
1348 : 526 : lvalue_mappings (expr.get_expr ().get_mappings ()),
1349 : 526 : rvalue_mappings (Analysis::NodeMapping::get_error ()),
1350 : 526 : locus (expr.get_locus ())
1351 : 526 : {}
1352 : :
1353 : 3942 : OperatorExprMeta::OperatorExprMeta (HIR::DereferenceExpr &expr)
1354 : 3942 : : node_mappings (expr.get_mappings ()),
1355 : 3942 : lvalue_mappings (expr.get_expr ().get_mappings ()),
1356 : 3942 : rvalue_mappings (Analysis::NodeMapping::get_error ()),
1357 : 3942 : locus (expr.get_locus ())
1358 : 3942 : {}
1359 : :
1360 : 127 : OperatorExprMeta::OperatorExprMeta (HIR::ArrayIndexExpr &expr)
1361 : 127 : : node_mappings (expr.get_mappings ()),
1362 : 127 : lvalue_mappings (expr.get_array_expr ().get_mappings ()),
1363 : 127 : rvalue_mappings (expr.get_index_expr ().get_mappings ()),
1364 : 127 : locus (expr.get_locus ())
1365 : 127 : {}
1366 : :
1367 : 3505 : OperatorExprMeta::OperatorExprMeta (HIR::ComparisonExpr &expr)
1368 : 3505 : : node_mappings (expr.get_mappings ()),
1369 : 3505 : lvalue_mappings (expr.get_expr ().get_mappings ()),
1370 : 3505 : rvalue_mappings (expr.get_rhs ().get_mappings ()), locus (expr.get_locus ())
1371 : 3505 : {}
1372 : :
1373 : 10 : InlineAsmOperand::In::In (
1374 : : const tl::optional<struct AST::InlineAsmRegOrRegClass> ®,
1375 : 10 : std::unique_ptr<Expr> expr)
1376 : 10 : : reg (reg), expr (std::move (expr))
1377 : : {
1378 : 10 : rust_assert (this->expr != nullptr);
1379 : 10 : }
1380 : :
1381 : 48 : InlineAsmOperand::In::In (const struct In &other)
1382 : : {
1383 : 48 : reg = other.reg;
1384 : :
1385 : 48 : expr = other.expr->clone_expr ();
1386 : 48 : }
1387 : :
1388 : : InlineAsmOperand::In
1389 : 0 : InlineAsmOperand::In::operator= (const struct In &other)
1390 : : {
1391 : 0 : reg = other.reg;
1392 : 0 : expr = other.expr->clone_expr ();
1393 : :
1394 : 0 : return *this;
1395 : : }
1396 : :
1397 : 17 : InlineAsmOperand::Out::Out (
1398 : : tl::optional<struct AST::InlineAsmRegOrRegClass> ®, bool late,
1399 : 17 : std::unique_ptr<Expr> expr)
1400 : 17 : : reg (reg), late (late), expr (std::move (expr))
1401 : : {
1402 : 17 : rust_assert (this->expr != nullptr);
1403 : 17 : }
1404 : :
1405 : 69 : InlineAsmOperand::Out::Out (const struct Out &other)
1406 : : {
1407 : 69 : reg = other.reg;
1408 : 69 : late = other.late;
1409 : 69 : expr = other.expr->clone_expr ();
1410 : 69 : }
1411 : :
1412 : : InlineAsmOperand::Out
1413 : 0 : InlineAsmOperand::Out::operator= (const struct Out &other)
1414 : : {
1415 : 0 : reg = other.reg;
1416 : 0 : late = other.late;
1417 : 0 : expr = other.expr->clone_expr ();
1418 : 0 : return *this;
1419 : : }
1420 : :
1421 : 0 : InlineAsmOperand::InOut::InOut (
1422 : : tl::optional<struct AST::InlineAsmRegOrRegClass> ®, bool late,
1423 : 0 : std::unique_ptr<Expr> expr)
1424 : 0 : : reg (reg), late (late), expr (std::move (expr))
1425 : : {
1426 : 0 : rust_assert (this->expr != nullptr);
1427 : 0 : }
1428 : :
1429 : 0 : InlineAsmOperand::InOut::InOut (const struct InOut &other)
1430 : : {
1431 : 0 : reg = other.reg;
1432 : 0 : late = other.late;
1433 : 0 : expr = other.expr->clone_expr ();
1434 : 0 : }
1435 : :
1436 : : InlineAsmOperand::InOut
1437 : 0 : InlineAsmOperand::InOut::operator= (const struct InOut &other)
1438 : : {
1439 : 0 : reg = other.reg;
1440 : 0 : late = other.late;
1441 : 0 : expr = other.expr->clone_expr ();
1442 : :
1443 : 0 : return *this;
1444 : : }
1445 : :
1446 : 2 : InlineAsmOperand::SplitInOut::SplitInOut (
1447 : : tl::optional<struct AST::InlineAsmRegOrRegClass> ®, bool late,
1448 : 2 : std::unique_ptr<Expr> in_expr, std::unique_ptr<Expr> out_expr)
1449 : 2 : : reg (reg), late (late), in_expr (std::move (in_expr)),
1450 : 2 : out_expr (std::move (out_expr))
1451 : : {
1452 : 2 : rust_assert (this->in_expr != nullptr);
1453 : 2 : rust_assert (this->out_expr != nullptr);
1454 : 2 : }
1455 : :
1456 : 8 : InlineAsmOperand::SplitInOut::SplitInOut (const struct SplitInOut &other)
1457 : : {
1458 : 8 : reg = other.reg;
1459 : 8 : late = other.late;
1460 : 8 : in_expr = other.in_expr->clone_expr ();
1461 : 8 : out_expr = other.out_expr->clone_expr ();
1462 : 8 : }
1463 : :
1464 : : InlineAsmOperand::SplitInOut
1465 : 0 : InlineAsmOperand::SplitInOut::operator= (const struct SplitInOut &other)
1466 : : {
1467 : 0 : reg = other.reg;
1468 : 0 : late = other.late;
1469 : 0 : in_expr = other.in_expr->clone_expr ();
1470 : 0 : out_expr = other.out_expr->clone_expr ();
1471 : :
1472 : 0 : return *this;
1473 : : }
1474 : :
1475 : 0 : InlineAsmOperand::Sym::Sym (std::unique_ptr<Expr> expr)
1476 : 0 : : expr (std::move (expr))
1477 : : {
1478 : 0 : rust_assert (this->expr != nullptr);
1479 : 0 : }
1480 : :
1481 : 0 : InlineAsmOperand::Sym::Sym (const struct Sym &other)
1482 : : {
1483 : 0 : expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
1484 : 0 : }
1485 : :
1486 : : InlineAsmOperand::Sym
1487 : 0 : InlineAsmOperand::Sym::operator= (const struct Sym &other)
1488 : : {
1489 : 0 : expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
1490 : 0 : return *this;
1491 : : }
1492 : :
1493 : 0 : InlineAsmOperand::Label::Label (tl::optional<std::string> label_name,
1494 : 0 : std::unique_ptr<Expr> expr)
1495 : 0 : : expr (std::move (expr))
1496 : : {
1497 : 0 : rust_assert (this->expr != nullptr);
1498 : 0 : if (label_name.has_value ())
1499 : 0 : this->label_name = label_name.value ();
1500 : 0 : }
1501 : :
1502 : 0 : InlineAsmOperand::Label::Label (const struct Label &other)
1503 : : {
1504 : 0 : expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
1505 : 0 : }
1506 : :
1507 : : InlineAsmOperand::Label
1508 : 0 : InlineAsmOperand::Label::operator= (const struct Label &other)
1509 : : {
1510 : 0 : expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
1511 : 0 : return *this;
1512 : : }
1513 : :
1514 : 27 : InlineAsm::InlineAsm (location_t locus, bool is_global_asm,
1515 : : std::vector<AST::InlineAsmTemplatePiece> template_,
1516 : : std::vector<AST::TupleTemplateStr> template_strs,
1517 : : std::vector<HIR::InlineAsmOperand> operands,
1518 : : std::vector<AST::TupleClobber> clobber_abi,
1519 : : std::set<AST::InlineAsm::Option> options,
1520 : : Analysis::NodeMapping mappings,
1521 : 27 : AST::AttrVec outer_attribs)
1522 : : : ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
1523 : 27 : locus (locus), is_global_asm (is_global_asm),
1524 : 27 : template_ (std::move (template_)),
1525 : 27 : template_strs (std::move (template_strs)), operands (std::move (operands)),
1526 : 27 : clobber_abi (std::move (clobber_abi)), options (std::move (options))
1527 : 27 : {}
1528 : :
1529 : : OffsetOf &
1530 : 0 : OffsetOf::operator= (const OffsetOf &other)
1531 : : {
1532 : 0 : ExprWithoutBlock::operator= (other);
1533 : :
1534 : 0 : type = other.type->clone_type ();
1535 : 0 : field = other.field;
1536 : 0 : loc = other.loc;
1537 : :
1538 : 0 : return *this;
1539 : : }
1540 : :
1541 : : ExprWithoutBlock *
1542 : 0 : OffsetOf::clone_expr_without_block_impl () const
1543 : : {
1544 : 0 : return new OffsetOf (*this);
1545 : : }
1546 : :
1547 : : std::string
1548 : 0 : OffsetOf::as_string () const
1549 : : {
1550 : 0 : return "OffsetOf(" + type->as_string () + ", " + field.as_string () + ")";
1551 : : }
1552 : :
1553 : : void
1554 : 44 : OffsetOf::accept_vis (HIRExpressionVisitor &vis)
1555 : : {
1556 : 44 : vis.visit (*this);
1557 : 44 : }
1558 : :
1559 : : void
1560 : 59 : OffsetOf::accept_vis (HIRFullVisitor &vis)
1561 : : {
1562 : 59 : vis.visit (*this);
1563 : 59 : }
1564 : :
1565 : : } // namespace HIR
1566 : : } // namespace Rust
|