LGTM is reporting a false-positive "Expression has no effect" warning. The expression LGTM is highlighting is this:
The definition of add_global follows right after the constructor:
static auto add_global(std::string var) -> bool {
return variables.insert(std::move(var)).second;
}
The variables variable is a static class variable which is being mutated by this function, which is most definitely an observable side-effect (which is, indeed, observed on parse.yy). There is no other add_global function accessible on this point, and no other variables variable accessible.
Here is the link to the alert page.
LGTM is reporting a false-positive "Expression has no effect" warning. The expression LGTM is highlighting is this:
add_global(varName);The definition of
add_globalfollows right after the constructor:The
variablesvariable is a static class variable which is being mutated by this function, which is most definitely an observable side-effect (which is, indeed, observed on parse.yy). There is no otheradd_globalfunction accessible on this point, and no othervariablesvariable accessible.Here is the link to the alert page.