Parse guard statements like regular conditionals
I just learned that these two pieces of code are not the same:
def test if result = calculate_result return result end ... end
def test return result if result = calculate_result ... end
The second one will give this unhelpful error message:
NameError: undefined local variable or method `result' for main:Object Did you mean? result
I think this is confusing, especially since tools like RuboCop sometimes encourage users to change conditionals to inline ones ("guard statements"). I'd like to propose that Ruby be changed to treat these as the same.