Skip to content

Commit

Permalink
Avoid assignment in condition
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Aug 19, 2024
1 parent 8266d2f commit 977ac57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions src/compiler/MethodGenerationContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@ int64_t IndexOf(std::vector<Variable>& 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;
}
Expand Down

0 comments on commit 977ac57

Please sign in to comment.