Perl-Critic / PPI

53 stars 44 forks source link

Cast or op #156

Closed moregan closed 7 years ago

moregan commented 9 years ago

Have _cast_or_op rely on looking at prior tokens to determine whether *, %, or & is a cast or an operator. Includes removing a bit of "Obvious GLOB cast" logic that was no longer needed.

Made the handling of , %, and & more similar to each other, including removing a confusing regex in \ handling.

Lots more tests.

wchristian commented 7 years ago

Do you remember what your reasoning in this change was?

 -      return $self->_as_cast_or_op($t) if $self->_is_cast_or_op($char);
 +      return $self->_as_cast_or_op($t) if __is_cast_or_op($char);
moregan commented 7 years ago

It must have been because $self was not used.

wchristian commented 7 years ago

@moregan Ah! Thanks. Usually not a bad idea, but i'll revert that part since i'd like to stick with methods on objects to retain default OO capabilities. (sub-class, override) It's not strictly necessary in this case, but i know i griped enough when other people did stuff like that. :D

wchristian commented 7 years ago

Thanks, this has been cherry-picked and released. :)