Skip to content

Commit 505d7d8

Browse files
committed
Merge pull request godotengine#87688 from AThousandShips/what_is_this
Remove unnecessary `this->` expressions
2 parents bf69417 + 1c4e17e commit 505d7d8

39 files changed

Lines changed: 160 additions & 160 deletions

core/math/convex_hull.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,31 +344,31 @@ class ConvexHullInternal {
344344
Rational128(int64_t p_value) {
345345
if (p_value > 0) {
346346
sign = 1;
347-
this->numerator = p_value;
347+
numerator = p_value;
348348
} else if (p_value < 0) {
349349
sign = -1;
350-
this->numerator = -p_value;
350+
numerator = -p_value;
351351
} else {
352352
sign = 0;
353-
this->numerator = (uint64_t)0;
353+
numerator = (uint64_t)0;
354354
}
355-
this->denominator = (uint64_t)1;
355+
denominator = (uint64_t)1;
356356
is_int_64 = true;
357357
}
358358

359359
Rational128(const Int128 &p_numerator, const Int128 &p_denominator) {
360360
sign = p_numerator.get_sign();
361361
if (sign >= 0) {
362-
this->numerator = p_numerator;
362+
numerator = p_numerator;
363363
} else {
364-
this->numerator = -p_numerator;
364+
numerator = -p_numerator;
365365
}
366366
int32_t dsign = p_denominator.get_sign();
367367
if (dsign >= 0) {
368-
this->denominator = p_denominator;
368+
denominator = p_denominator;
369369
} else {
370370
sign = -sign;
371-
this->denominator = -p_denominator;
371+
denominator = -p_denominator;
372372
}
373373
is_int_64 = false;
374374
}

core/math/vector2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Vector2 Vector2::slide(const Vector2 &p_normal) const {
164164
#ifdef MATH_CHECKS
165165
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 " + p_normal.operator String() + "must be normalized.");
166166
#endif
167-
return *this - p_normal * this->dot(p_normal);
167+
return *this - p_normal * dot(p_normal);
168168
}
169169

170170
Vector2 Vector2::bounce(const Vector2 &p_normal) const {
@@ -175,7 +175,7 @@ Vector2 Vector2::reflect(const Vector2 &p_normal) const {
175175
#ifdef MATH_CHECKS
176176
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 " + p_normal.operator String() + "must be normalized.");
177177
#endif
178-
return 2.0f * p_normal * this->dot(p_normal) - *this;
178+
return 2.0f * p_normal * dot(p_normal) - *this;
179179
}
180180

181181
bool Vector2::is_equal_approx(const Vector2 &p_v) const {

core/math/vector3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Vector3 Vector3::octahedron_decode(const Vector2 &p_oct) {
109109

110110
Vector2 Vector3::octahedron_tangent_encode(const float sign) const {
111111
const float bias = 1.0f / 32767.0f;
112-
Vector2 res = this->octahedron_encode();
112+
Vector2 res = octahedron_encode();
113113
res.y = MAX(res.y, bias);
114114
res.y = res.y * 0.5f + 0.5f;
115115
res.y = sign >= 0.0f ? res.y : 1 - res.y;

core/math/vector3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ Vector3 Vector3::slide(const Vector3 &p_normal) const {
514514
#ifdef MATH_CHECKS
515515
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 " + p_normal.operator String() + " must be normalized.");
516516
#endif
517-
return *this - p_normal * this->dot(p_normal);
517+
return *this - p_normal * dot(p_normal);
518518
}
519519

520520
Vector3 Vector3::bounce(const Vector3 &p_normal) const {
@@ -525,7 +525,7 @@ Vector3 Vector3::reflect(const Vector3 &p_normal) const {
525525
#ifdef MATH_CHECKS
526526
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 " + p_normal.operator String() + " must be normalized.");
527527
#endif
528-
return 2.0f * p_normal * this->dot(p_normal) - *this;
528+
return 2.0f * p_normal * dot(p_normal) - *this;
529529
}
530530

531531
#endif // VECTOR3_H

core/object/message_queue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
#ifdef DEV_ENABLED
4141
// Includes safety checks to ensure that a queue set as a thread singleton override
4242
// is only ever called from the thread it was set for.
43-
#define LOCK_MUTEX \
44-
if (this != MessageQueue::thread_singleton) { \
45-
DEV_ASSERT(!this->is_current_thread_override); \
46-
mutex.lock(); \
47-
} else { \
48-
DEV_ASSERT(this->is_current_thread_override); \
43+
#define LOCK_MUTEX \
44+
if (this != MessageQueue::thread_singleton) { \
45+
DEV_ASSERT(!is_current_thread_override); \
46+
mutex.lock(); \
47+
} else { \
48+
DEV_ASSERT(is_current_thread_override); \
4949
}
5050
#else
5151
#define LOCK_MUTEX \

core/string/translation_po.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ void TranslationPO::print_translation_map() {
4141
return;
4242
}
4343

44-
file->store_line("NPlural : " + String::num_int64(this->get_plural_forms()));
45-
file->store_line("Plural rule : " + this->get_plural_rule());
44+
file->store_line("NPlural : " + String::num_int64(get_plural_forms()));
45+
file->store_line("Plural rule : " + get_plural_rule());
4646
file->store_line("");
4747

4848
List<StringName> context_l;

core/string/ustring.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void String::copy_from(const char *p_cstr) {
302302

303303
resize(len + 1); // include 0
304304

305-
char32_t *dst = this->ptrw();
305+
char32_t *dst = ptrw();
306306

307307
for (size_t i = 0; i <= len; i++) {
308308
#if CHAR_MIN == 0
@@ -339,7 +339,7 @@ void String::copy_from(const char *p_cstr, const int p_clip_to) {
339339

340340
resize(len + 1); // include 0
341341

342-
char32_t *dst = this->ptrw();
342+
char32_t *dst = ptrw();
343343

344344
for (int i = 0; i < len; i++) {
345345
#if CHAR_MIN == 0
@@ -1043,7 +1043,7 @@ String String::_camelcase_to_underscore() const {
10431043
String new_string;
10441044
int start_index = 0;
10451045

1046-
for (int i = 1; i < this->size(); i++) {
1046+
for (int i = 1; i < size(); i++) {
10471047
bool is_prev_upper = is_ascii_upper_case(cstr[i - 1]);
10481048
bool is_prev_lower = is_ascii_lower_case(cstr[i - 1]);
10491049
bool is_prev_digit = is_digit(cstr[i - 1]);
@@ -1053,7 +1053,7 @@ String String::_camelcase_to_underscore() const {
10531053
bool is_curr_digit = is_digit(cstr[i]);
10541054

10551055
bool is_next_lower = false;
1056-
if (i + 1 < this->size()) {
1056+
if (i + 1 < size()) {
10571057
is_next_lower = is_ascii_lower_case(cstr[i + 1]);
10581058
}
10591059

@@ -1063,17 +1063,17 @@ String String::_camelcase_to_underscore() const {
10631063
const bool cond_d = (is_prev_upper || is_prev_lower) && is_curr_digit; // A2, a2
10641064

10651065
if (cond_a || cond_b || cond_c || cond_d) {
1066-
new_string += this->substr(start_index, i - start_index) + "_";
1066+
new_string += substr(start_index, i - start_index) + "_";
10671067
start_index = i;
10681068
}
10691069
}
10701070

1071-
new_string += this->substr(start_index, this->size() - start_index);
1071+
new_string += substr(start_index, size() - start_index);
10721072
return new_string.to_lower();
10731073
}
10741074

10751075
String String::capitalize() const {
1076-
String aux = this->_camelcase_to_underscore().replace("_", " ").strip_edges();
1076+
String aux = _camelcase_to_underscore().replace("_", " ").strip_edges();
10771077
String cap;
10781078
for (int i = 0; i < aux.get_slice_count(" "); i++) {
10791079
String slice = aux.get_slicec(' ', i);
@@ -1090,19 +1090,19 @@ String String::capitalize() const {
10901090
}
10911091

10921092
String String::to_camel_case() const {
1093-
String s = this->to_pascal_case();
1093+
String s = to_pascal_case();
10941094
if (!s.is_empty()) {
10951095
s[0] = _find_lower(s[0]);
10961096
}
10971097
return s;
10981098
}
10991099

11001100
String String::to_pascal_case() const {
1101-
return this->capitalize().replace(" ", "");
1101+
return capitalize().replace(" ", "");
11021102
}
11031103

11041104
String String::to_snake_case() const {
1105-
return this->_camelcase_to_underscore().replace(" ", "_").strip_edges();
1105+
return _camelcase_to_underscore().replace(" ", "_").strip_edges();
11061106
}
11071107

11081108
String String::get_with_code_lines() const {
@@ -1185,7 +1185,7 @@ String String::get_slicec(char32_t p_splitter, int p_slice) const {
11851185
return String();
11861186
}
11871187

1188-
const char32_t *c = this->ptr();
1188+
const char32_t *c = ptr();
11891189
int i = 0;
11901190
int prev = 0;
11911191
int count = 0;
@@ -3516,7 +3516,7 @@ bool String::matchn(const String &p_wildcard) const {
35163516
}
35173517

35183518
String String::format(const Variant &values, const String &placeholder) const {
3519-
String new_string = String(this->ptr());
3519+
String new_string = String(ptr());
35203520

35213521
if (values.get_type() == Variant::ARRAY) {
35223522
Array values_arr = values;
@@ -4467,7 +4467,7 @@ bool String::is_valid_float() const {
44674467

44684468
String String::path_to_file(const String &p_path) const {
44694469
// Don't get base dir for src, this is expected to be a dir already.
4470-
String src = this->replace("\\", "/");
4470+
String src = replace("\\", "/");
44714471
String dst = p_path.replace("\\", "/").get_base_dir();
44724472
String rel = src.path_to(dst);
44734473
if (rel == dst) { // failed
@@ -4478,7 +4478,7 @@ String String::path_to_file(const String &p_path) const {
44784478
}
44794479

44804480
String String::path_to(const String &p_path) const {
4481-
String src = this->replace("\\", "/");
4481+
String src = replace("\\", "/");
44824482
String dst = p_path.replace("\\", "/");
44834483
if (!src.ends_with("/")) {
44844484
src += "/";

core/variant/dictionary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void Dictionary::clear() {
251251
void Dictionary::merge(const Dictionary &p_dictionary, bool p_overwrite) {
252252
for (const KeyValue<Variant, Variant> &E : p_dictionary._p->variant_map) {
253253
if (p_overwrite || !has(E.key)) {
254-
this->operator[](E.key) = E.value;
254+
operator[](E.key) = E.value;
255255
}
256256
}
257257
}

core/variant/variant.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,53 +1246,53 @@ void Variant::zero() {
12461246
case NIL:
12471247
break;
12481248
case BOOL:
1249-
this->_data._bool = false;
1249+
_data._bool = false;
12501250
break;
12511251
case INT:
1252-
this->_data._int = 0;
1252+
_data._int = 0;
12531253
break;
12541254
case FLOAT:
1255-
this->_data._float = 0;
1255+
_data._float = 0;
12561256
break;
12571257

12581258
case VECTOR2:
1259-
*reinterpret_cast<Vector2 *>(this->_data._mem) = Vector2();
1259+
*reinterpret_cast<Vector2 *>(_data._mem) = Vector2();
12601260
break;
12611261
case VECTOR2I:
1262-
*reinterpret_cast<Vector2i *>(this->_data._mem) = Vector2i();
1262+
*reinterpret_cast<Vector2i *>(_data._mem) = Vector2i();
12631263
break;
12641264
case RECT2:
1265-
*reinterpret_cast<Rect2 *>(this->_data._mem) = Rect2();
1265+
*reinterpret_cast<Rect2 *>(_data._mem) = Rect2();
12661266
break;
12671267
case RECT2I:
1268-
*reinterpret_cast<Rect2i *>(this->_data._mem) = Rect2i();
1268+
*reinterpret_cast<Rect2i *>(_data._mem) = Rect2i();
12691269
break;
12701270
case VECTOR3:
1271-
*reinterpret_cast<Vector3 *>(this->_data._mem) = Vector3();
1271+
*reinterpret_cast<Vector3 *>(_data._mem) = Vector3();
12721272
break;
12731273
case VECTOR3I:
1274-
*reinterpret_cast<Vector3i *>(this->_data._mem) = Vector3i();
1274+
*reinterpret_cast<Vector3i *>(_data._mem) = Vector3i();
12751275
break;
12761276
case VECTOR4:
1277-
*reinterpret_cast<Vector4 *>(this->_data._mem) = Vector4();
1277+
*reinterpret_cast<Vector4 *>(_data._mem) = Vector4();
12781278
break;
12791279
case VECTOR4I:
1280-
*reinterpret_cast<Vector4i *>(this->_data._mem) = Vector4i();
1280+
*reinterpret_cast<Vector4i *>(_data._mem) = Vector4i();
12811281
break;
12821282
case PLANE:
1283-
*reinterpret_cast<Plane *>(this->_data._mem) = Plane();
1283+
*reinterpret_cast<Plane *>(_data._mem) = Plane();
12841284
break;
12851285
case QUATERNION:
1286-
*reinterpret_cast<Quaternion *>(this->_data._mem) = Quaternion();
1286+
*reinterpret_cast<Quaternion *>(_data._mem) = Quaternion();
12871287
break;
12881288

12891289
case COLOR:
1290-
*reinterpret_cast<Color *>(this->_data._mem) = Color();
1290+
*reinterpret_cast<Color *>(_data._mem) = Color();
12911291
break;
12921292

12931293
default:
12941294
Type prev_type = type;
1295-
this->clear();
1295+
clear();
12961296
if (type != prev_type) {
12971297
// clear() changes type to NIL, so it needs to be restored.
12981298
Callable::CallError ce;

core/variant/variant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class Variant {
176176
struct PackedArrayRefBase {
177177
SafeRefCount refcount;
178178
_FORCE_INLINE_ PackedArrayRefBase *reference() {
179-
if (this->refcount.ref()) {
179+
if (refcount.ref()) {
180180
return this;
181181
} else {
182182
return nullptr;

0 commit comments

Comments
 (0)