Skip to content

Commit a807adf

Browse files
committed
use rvalue references for constructor parameters in various expression structs
NP-1167
1 parent 312aec5 commit a807adf

12 files changed

Lines changed: 13 additions & 13 deletions

File tree

include/cura-formulae-engine/ast/binary_expr/binary_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct BinaryExpr : Expr
1212
ExprPtr lhs;
1313
ExprPtr rhs;
1414

15-
BinaryExpr(ExprPtr lhs, ExprPtr rhs)
15+
BinaryExpr(ExprPtr&& lhs, ExprPtr&& rhs)
1616
: lhs(std::move(lhs))
1717
, rhs(std::move(rhs))
1818
{

include/cura-formulae-engine/ast/condition_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct ConditionExpr final : Expr
1212
ExprPtr condition;
1313
ExprPtr else_expr;
1414

15-
ConditionExpr(ExprPtr then_expr, ExprPtr condition, ExprPtr else_expr)
15+
ConditionExpr(ExprPtr&& then_expr, ExprPtr&& condition, ExprPtr&& else_expr)
1616
: then_expr(std::move(then_expr))
1717
, condition(std::move(condition))
1818
, else_expr(std::move(else_expr))

include/cura-formulae-engine/ast/expr_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct ExprPtr final : Expr
1616

1717
std::unique_ptr<Expr> ptr;
1818

19-
ExprPtr(std::unique_ptr<Expr> ptr)
19+
ExprPtr(std::unique_ptr<Expr>&& ptr)
2020
: ptr(std::move(ptr))
2121
{
2222
}

include/cura-formulae-engine/ast/fn_application_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct FnApplicationExpr final : Expr
2323
std::vector<ExprPtr> args;
2424
std::vector<KeywordArg> kwargs;
2525

26-
FnApplicationExpr(ExprPtr fn, std::vector<ExprPtr>&& args, std::vector<KeywordArg>&& kwargs = {})
26+
FnApplicationExpr(ExprPtr&& fn, std::vector<ExprPtr>&& args, std::vector<KeywordArg>&& kwargs = {})
2727
: fn(std::move(fn))
2828
, args(std::move(args))
2929
, kwargs(std::move(kwargs))

include/cura-formulae-engine/ast/index_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct IndexExpr final : Expr
1919
ExprPtr array;
2020
ExprPtr index;
2121

22-
IndexExpr(ExprPtr array, ExprPtr index)
22+
IndexExpr(ExprPtr&& array, ExprPtr&& index)
2323
: array(std::move(array))
2424
, index(std::move(index))
2525
{

include/cura-formulae-engine/ast/list_comprehension_expr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct ListComprehensionExpr final : Expr
2121
ExprPtr iterable;
2222
std::vector<ExprPtr> conditions;
2323

24-
loop(ExprPtr iterator_key, ExprPtr iterable, std::vector<ExprPtr> conditions)
24+
loop(ExprPtr&& iterator_key, ExprPtr&& iterable, std::vector<ExprPtr>&& conditions)
2525
: iterator_key(std::move(iterator_key))
2626
, iterable(std::move(iterable))
2727
, conditions(std::move(conditions))
@@ -32,7 +32,7 @@ struct ListComprehensionExpr final : Expr
3232
ExprPtr iterator;
3333
std::vector<loop> loops;
3434

35-
ListComprehensionExpr(ExprPtr iterator, std::vector<loop> loops)
35+
ListComprehensionExpr(ExprPtr&& iterator, std::vector<loop>&& loops)
3636
: iterator(std::move(iterator))
3737
, loops(std::move(loops))
3838
{

include/cura-formulae-engine/ast/list_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct ListExpr final : Expr
1313
{
1414
std::vector<ExprPtr> elements;
1515

16-
ListExpr(std::vector<ExprPtr> elements)
16+
ListExpr(std::vector<ExprPtr>&& elements)
1717
: elements(std::move(elements))
1818
{
1919
}

include/cura-formulae-engine/ast/property_access_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct PropertyAccessExpr final : Expr
1313
ExprPtr object;
1414
std::string property;
1515

16-
PropertyAccessExpr(ExprPtr object, std::string property)
16+
PropertyAccessExpr(ExprPtr&& object, std::string&& property)
1717
: object(std::move(object))
1818
, property(std::move(property))
1919
{

include/cura-formulae-engine/ast/slice_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct SliceExpr final : Expr
2323
std::optional<ExprPtr> end_index;
2424
std::optional<ExprPtr> step_size;
2525

26-
SliceExpr(ExprPtr array, std::optional<ExprPtr> start_index, std::optional<ExprPtr> end_index, std::optional<ExprPtr> step_size)
26+
SliceExpr(ExprPtr&& array, std::optional<ExprPtr>&& start_index, std::optional<ExprPtr>&& end_index, std::optional<ExprPtr>&& step_size)
2727
: array(std::move(array))
2828
, start_index(std::move(start_index))
2929
, end_index(std::move(end_index))

include/cura-formulae-engine/ast/tuple_expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct TupleExpr final : Expr
1515
{
1616
std::vector<ExprPtr> elements;
1717

18-
TupleExpr(std::vector<ExprPtr> elements)
18+
TupleExpr(std::vector<ExprPtr>&& elements)
1919
: elements(std::move(elements))
2020
{
2121
}

0 commit comments

Comments
 (0)