1
1
mirror of https://github.com/github/semantic.git synced 2025-01-07 16:07:28 +03:00

add error type to introduce locals

This commit is contained in:
Ayman Nadeem 2020-05-13 12:48:22 -04:00
parent 8adc649148
commit ca6581f92d

View File

@ -319,20 +319,25 @@ introduceLocals ::
Has (Writer Tags.Tags) sig m, Has (Writer Tags.Tags) sig m,
Has (State [Text]) sig m Has (State [Text]) sig m
) => ) =>
[ ( (Rb.BlockParameter :+: Rb.DestructuredParameter :+: Rb.HashSplatParameter) [ [Parse.Err
:+: ((Rb.Identifier :+: Rb.KeywordParameter) :+: (Rb.OptionalParameter :+: Rb.SplatParameter)) ((:+:)
) Rb.BlockParameter
Loc (Rb.DestructuredParameter
:+: (Rb.HashSplatParameter
:+: (Rb.Identifier
:+: (Rb.KeywordParameter
:+: (Rb.OptionalParameter :+: Rb.SplatParameter)))))
Loc)]
] -> ] ->
m () m ()
introduceLocals params = for_ params $ \param -> case param of introduceLocals params = for_ params $ \param -> case param of
Prj Rb.BlockParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :) EPrj Rb.BlockParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
Prj Rb.DestructuredParameter {extraChildren} -> introduceLocals extraChildren EPrj Rb.DestructuredParameter {extraChildren} -> introduceLocals extraChildren
Prj Rb.HashSplatParameter {name = Just Rb.Identifier {text = lvar}} -> modify (lvar :) EPrj Rb.HashSplatParameter {name = Just (Parse.Success (Rb.Identifier {text = lvar}))} -> modify (lvar :)
Prj Rb.Identifier {text = lvar} -> modify (lvar :) EPrj Rb.Identifier {text = lvar} -> modify (lvar :)
Prj Rb.KeywordParameter {name = Rb.Identifier {text = lvar}} -> modify (lvar :) EPrj Rb.KeywordParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
Prj Rb.OptionalParameter {name = Rb.Identifier {text = lvar}} -> modify (lvar :) EPrj Rb.OptionalParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
Prj Rb.SplatParameter {name = Just Rb.Identifier {text = lvar}} -> modify (lvar :) EPrj Rb.SplatParameter {name = Just (Parse.Success (Rb.Identifier {text = lvar}))} -> modify (lvar :)
_ -> pure () _ -> pure ()
instance ToTags Rb.MethodParameters where instance ToTags Rb.MethodParameters where