xsawyerx / ref-util-rewriter

Rewrite your code to use Ref::Util
Other
1 stars 2 forks source link

"ARRAY" eq ref $foo #13

Open atoomic opened 5 years ago

atoomic commented 5 years ago

ref $foo eq "ARRAY" is replaced as is_arrayref($foo) but when using the equality check in the reverse way "ARRAY" eq ref $foo, then nothing is replaced

proof in image

> perl -Ilib -MRef::Util::Rewriter -E 'say Ref::Util::Rewriter::rewrite_string( q[ "ARRAY" eq ref $foo ] ); '
 "ARRAY" eq ref $foo

> perl -Ilib -MRef::Util::Rewriter -E 'say Ref::Util::Rewriter::rewrite_string( q[ ref $foo eq "ARRAY" ] ); '
 is_arrayref($foo)
xsawyerx commented 5 years ago

I guess we could do a look-behind if we can't look forward for anything valuable.

I'm not that interested in writing this support right now. I'd rather the code gets cleaned up first.