From bc13ecac13133b236cd3958a791bb19bac616c9f Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Fri, 10 Jan 2020 15:24:26 -0800 Subject: [PATCH] Track locals in operator assignment --- semantic-ruby/src/Language/Ruby/Tags.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/semantic-ruby/src/Language/Ruby/Tags.hs b/semantic-ruby/src/Language/Ruby/Tags.hs index f133acc72..bc0abad2f 100644 --- a/semantic-ruby/src/Language/Ruby/Tags.hs +++ b/semantic-ruby/src/Language/Ruby/Tags.hs @@ -89,6 +89,8 @@ type family ToTagsInstance t :: Strategy where ToTagsInstance Rb.LambdaParameters = 'Custom ToTagsInstance Rb.BlockParameters = 'Custom ToTagsInstance Rb.Assignment = 'Custom + ToTagsInstance Rb.OperatorAssignment = 'Custom + ToTagsInstance _ = 'Generic @@ -337,6 +339,13 @@ instance ToTagsBy 'Custom Rb.Assignment where Prj Rb.RestAssignment { extraChildren = Just (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Identifier { text })))) } -> modify (text :) _ -> pure () +instance ToTagsBy 'Custom Rb.OperatorAssignment where + tags' t@Rb.OperatorAssignment{ left } = do + case left of + Prj (Rb.Lhs (Prj (Rb.Variable (Prj Rb.Identifier { text })))) -> modify (text :) + _ -> pure () + gtags t + gtags :: ( Has (Reader Source) sig m , Has (Writer Tags.Tags) sig m