diff --git a/.clang-tidy b/.clang-tidy index 06fe2fd9..c009861f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -7,6 +7,7 @@ Checks: '*include*, misc-unused-parameters, bugprone-narrowing-conversions, bugprone-switch-missing-default-case, + bugprone-assignment-in-if-condition, cert-err33-c, readability-suspicious-call-argument, readability-isolate-declaration, diff --git a/src/compiler/MethodGenerationContext.cpp b/src/compiler/MethodGenerationContext.cpp index ea5d2eab..f571dd98 100644 --- a/src/compiler/MethodGenerationContext.cpp +++ b/src/compiler/MethodGenerationContext.cpp @@ -322,8 +322,10 @@ int64_t IndexOf(std::vector& vec, std::string& name) { bool MethodGenerationContext::FindVar(std::string& var, int64_t* index, int* context, bool* isArgument) { - if ((*index = IndexOf(locals, var)) == -1) { - if ((*index = IndexOf(arguments, var)) == -1) { + *index = IndexOf(locals, var); + if (*index == -1) { + *index = IndexOf(arguments, var); + if (*index == -1) { if (outerGenc == nullptr) { return false; }