Commit 180b4ba7 authored by j4cbo's avatar j4cbo

Merge pull request #133 from PSPDFKit-labs/peter/no-shadow-constructor-variables

No shadow constructor variables
parents eacca5ca 67d8c1b9
...@@ -175,9 +175,9 @@ class CppGenerator(spec: Spec) extends Generator(spec) { ...@@ -175,9 +175,9 @@ class CppGenerator(spec: Spec) extends Generator(spec) {
// Constructor. // Constructor.
if(r.fields.nonEmpty) { if(r.fields.nonEmpty) {
w.wl w.wl
writeAlignedCall(w, actualSelf + "(", r.fields, ")", f => marshal.fieldType(f.ty) + " " + idCpp.local(f.ident)) writeAlignedCall(w, actualSelf + "(", r.fields, ")", f => marshal.fieldType(f.ty) + " " + idCpp.local(f.ident) + "_")
w.wl w.wl
val init = (f: Field) => idCpp.field(f.ident) + "(std::move(" + idCpp.local(f.ident) + "))" val init = (f: Field) => idCpp.field(f.ident) + "(std::move(" + idCpp.local(f.ident) + "_))"
w.wl(": " + init(r.fields.head)) w.wl(": " + init(r.fields.head))
r.fields.tail.map(f => ", " + init(f)).foreach(w.wl) r.fields.tail.map(f => ", " + init(f)).foreach(w.wl)
w.wl("{}") w.wl("{}")
......
...@@ -28,34 +28,34 @@ struct AssortedPrimitives final { ...@@ -28,34 +28,34 @@ struct AssortedPrimitives final {
friend bool operator==(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs); friend bool operator==(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs);
friend bool operator!=(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs); friend bool operator!=(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs);
AssortedPrimitives(bool b, AssortedPrimitives(bool b_,
int8_t eight, int8_t eight_,
int16_t sixteen, int16_t sixteen_,
int32_t thirtytwo, int32_t thirtytwo_,
int64_t sixtyfour, int64_t sixtyfour_,
float fthirtytwo, float fthirtytwo_,
double fsixtyfour, double fsixtyfour_,
std::experimental::optional<bool> o_b, std::experimental::optional<bool> o_b_,
std::experimental::optional<int8_t> o_eight, std::experimental::optional<int8_t> o_eight_,
std::experimental::optional<int16_t> o_sixteen, std::experimental::optional<int16_t> o_sixteen_,
std::experimental::optional<int32_t> o_thirtytwo, std::experimental::optional<int32_t> o_thirtytwo_,
std::experimental::optional<int64_t> o_sixtyfour, std::experimental::optional<int64_t> o_sixtyfour_,
std::experimental::optional<float> o_fthirtytwo, std::experimental::optional<float> o_fthirtytwo_,
std::experimental::optional<double> o_fsixtyfour) std::experimental::optional<double> o_fsixtyfour_)
: b(std::move(b)) : b(std::move(b_))
, eight(std::move(eight)) , eight(std::move(eight_))
, sixteen(std::move(sixteen)) , sixteen(std::move(sixteen_))
, thirtytwo(std::move(thirtytwo)) , thirtytwo(std::move(thirtytwo_))
, sixtyfour(std::move(sixtyfour)) , sixtyfour(std::move(sixtyfour_))
, fthirtytwo(std::move(fthirtytwo)) , fthirtytwo(std::move(fthirtytwo_))
, fsixtyfour(std::move(fsixtyfour)) , fsixtyfour(std::move(fsixtyfour_))
, o_b(std::move(o_b)) , o_b(std::move(o_b_))
, o_eight(std::move(o_eight)) , o_eight(std::move(o_eight_))
, o_sixteen(std::move(o_sixteen)) , o_sixteen(std::move(o_sixteen_))
, o_thirtytwo(std::move(o_thirtytwo)) , o_thirtytwo(std::move(o_thirtytwo_))
, o_sixtyfour(std::move(o_sixtyfour)) , o_sixtyfour(std::move(o_sixtyfour_))
, o_fthirtytwo(std::move(o_fthirtytwo)) , o_fthirtytwo(std::move(o_fthirtytwo_))
, o_fsixtyfour(std::move(o_fsixtyfour)) , o_fsixtyfour(std::move(o_fsixtyfour_))
{} {}
}; };
......
...@@ -16,12 +16,12 @@ struct ClientReturnedRecord final { ...@@ -16,12 +16,12 @@ struct ClientReturnedRecord final {
std::string content; std::string content;
std::experimental::optional<std::string> misc; std::experimental::optional<std::string> misc;
ClientReturnedRecord(int64_t record_id, ClientReturnedRecord(int64_t record_id_,
std::string content, std::string content_,
std::experimental::optional<std::string> misc) std::experimental::optional<std::string> misc_)
: record_id(std::move(record_id)) : record_id(std::move(record_id_))
, content(std::move(content)) , content(std::move(content_))
, misc(std::move(misc)) , misc(std::move(misc_))
{} {}
}; };
......
...@@ -41,10 +41,10 @@ struct Constants final { ...@@ -41,10 +41,10 @@ struct Constants final {
int32_t some_integer; int32_t some_integer;
std::string some_string; std::string some_string;
Constants(int32_t some_integer, Constants(int32_t some_integer_,
std::string some_string) std::string some_string_)
: some_integer(std::move(some_integer)) : some_integer(std::move(some_integer_))
, some_string(std::move(some_string)) , some_string(std::move(some_string_))
{} {}
}; };
......
...@@ -20,8 +20,8 @@ struct DateRecord final { ...@@ -20,8 +20,8 @@ struct DateRecord final {
friend bool operator<=(const DateRecord& lhs, const DateRecord& rhs); friend bool operator<=(const DateRecord& lhs, const DateRecord& rhs);
friend bool operator>=(const DateRecord& lhs, const DateRecord& rhs); friend bool operator>=(const DateRecord& lhs, const DateRecord& rhs);
DateRecord(std::chrono::system_clock::time_point created_at) DateRecord(std::chrono::system_clock::time_point created_at_)
: created_at(std::move(created_at)) : created_at(std::move(created_at_))
{} {}
}; };
......
...@@ -21,9 +21,9 @@ struct ExternRecordWithDerivings final { ...@@ -21,9 +21,9 @@ struct ExternRecordWithDerivings final {
friend bool operator<=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs); friend bool operator<=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator>=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs); friend bool operator>=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
ExternRecordWithDerivings(::testsuite::RecordWithDerivings member, ExternRecordWithDerivings(::testsuite::RecordWithDerivings member_,
::testsuite::color e) ::testsuite::color e_)
: member(std::move(member)) : member(std::move(member_))
, e(std::move(e)) , e(std::move(e_))
{} {}
}; };
...@@ -13,8 +13,8 @@ namespace testsuite { ...@@ -13,8 +13,8 @@ namespace testsuite {
struct MapDateRecord final { struct MapDateRecord final {
std::unordered_map<std::string, std::chrono::system_clock::time_point> dates_by_id; std::unordered_map<std::string, std::chrono::system_clock::time_point> dates_by_id;
MapDateRecord(std::unordered_map<std::string, std::chrono::system_clock::time_point> dates_by_id) MapDateRecord(std::unordered_map<std::string, std::chrono::system_clock::time_point> dates_by_id_)
: dates_by_id(std::move(dates_by_id)) : dates_by_id(std::move(dates_by_id_))
{} {}
}; };
......
...@@ -14,8 +14,8 @@ namespace testsuite { ...@@ -14,8 +14,8 @@ namespace testsuite {
struct MapListRecord final { struct MapListRecord final {
std::vector<std::unordered_map<std::string, int64_t>> map_list; std::vector<std::unordered_map<std::string, int64_t>> map_list;
MapListRecord(std::vector<std::unordered_map<std::string, int64_t>> map_list) MapListRecord(std::vector<std::unordered_map<std::string, int64_t>> map_list_)
: map_list(std::move(map_list)) : map_list(std::move(map_list_))
{} {}
}; };
......
...@@ -14,10 +14,10 @@ struct MapRecord final { ...@@ -14,10 +14,10 @@ struct MapRecord final {
std::unordered_map<std::string, int64_t> map; std::unordered_map<std::string, int64_t> map;
std::unordered_map<int32_t, int32_t> imap; std::unordered_map<int32_t, int32_t> imap;
MapRecord(std::unordered_map<std::string, int64_t> map, MapRecord(std::unordered_map<std::string, int64_t> map_,
std::unordered_map<int32_t, int32_t> imap) std::unordered_map<int32_t, int32_t> imap_)
: map(std::move(map)) : map(std::move(map_))
, imap(std::move(imap)) , imap(std::move(imap_))
{} {}
}; };
......
...@@ -13,8 +13,8 @@ namespace testsuite { ...@@ -13,8 +13,8 @@ namespace testsuite {
struct NestedCollection final { struct NestedCollection final {
std::vector<std::unordered_set<std::string>> set_list; std::vector<std::unordered_set<std::string>> set_list;
NestedCollection(std::vector<std::unordered_set<std::string>> set_list) NestedCollection(std::vector<std::unordered_set<std::string>> set_list_)
: set_list(std::move(set_list)) : set_list(std::move(set_list_))
{} {}
}; };
......
...@@ -12,8 +12,8 @@ namespace testsuite { ...@@ -12,8 +12,8 @@ namespace testsuite {
struct PrimitiveList final { struct PrimitiveList final {
std::vector<int64_t> list; std::vector<int64_t> list;
PrimitiveList(std::vector<int64_t> list) PrimitiveList(std::vector<int64_t> list_)
: list(std::move(list)) : list(std::move(list_))
{} {}
}; };
......
...@@ -22,10 +22,10 @@ struct RecordWithDerivings final { ...@@ -22,10 +22,10 @@ struct RecordWithDerivings final {
friend bool operator<=(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs); friend bool operator<=(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs);
friend bool operator>=(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs); friend bool operator>=(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs);
RecordWithDerivings(int32_t key1, RecordWithDerivings(int32_t key1_,
std::string key2) std::string key2_)
: key1(std::move(key1)) : key1(std::move(key1_))
, key2(std::move(key2)) , key2(std::move(key2_))
{} {}
}; };
......
...@@ -20,8 +20,8 @@ struct RecordWithDurationAndDerivings final { ...@@ -20,8 +20,8 @@ struct RecordWithDurationAndDerivings final {
friend bool operator<=(const RecordWithDurationAndDerivings& lhs, const RecordWithDurationAndDerivings& rhs); friend bool operator<=(const RecordWithDurationAndDerivings& lhs, const RecordWithDurationAndDerivings& rhs);
friend bool operator>=(const RecordWithDurationAndDerivings& lhs, const RecordWithDurationAndDerivings& rhs); friend bool operator>=(const RecordWithDurationAndDerivings& lhs, const RecordWithDurationAndDerivings& rhs);
RecordWithDurationAndDerivings(std::chrono::duration<double, std::nano> dt) RecordWithDurationAndDerivings(std::chrono::duration<double, std::nano> dt_)
: dt(std::move(dt)) : dt(std::move(dt_))
{} {}
}; };
......
...@@ -22,10 +22,10 @@ struct RecordWithNestedDerivings final { ...@@ -22,10 +22,10 @@ struct RecordWithNestedDerivings final {
friend bool operator<=(const RecordWithNestedDerivings& lhs, const RecordWithNestedDerivings& rhs); friend bool operator<=(const RecordWithNestedDerivings& lhs, const RecordWithNestedDerivings& rhs);
friend bool operator>=(const RecordWithNestedDerivings& lhs, const RecordWithNestedDerivings& rhs); friend bool operator>=(const RecordWithNestedDerivings& lhs, const RecordWithNestedDerivings& rhs);
RecordWithNestedDerivings(int32_t key, RecordWithNestedDerivings(int32_t key_,
RecordWithDerivings rec) RecordWithDerivings rec_)
: key(std::move(key)) : key(std::move(key_))
, rec(std::move(rec)) , rec(std::move(rec_))
{} {}
}; };
......
...@@ -14,10 +14,10 @@ struct SetRecord final { ...@@ -14,10 +14,10 @@ struct SetRecord final {
std::unordered_set<std::string> set; std::unordered_set<std::string> set;
std::unordered_set<int32_t> iset; std::unordered_set<int32_t> iset;
SetRecord(std::unordered_set<std::string> set, SetRecord(std::unordered_set<std::string> set_,
std::unordered_set<int32_t> iset) std::unordered_set<int32_t> iset_)
: set(std::move(set)) : set(std::move(set_))
, iset(std::move(iset)) , iset(std::move(iset_))
{} {}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment