1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 22:28:10 +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 (State [Text]) sig m
) =>
[ ( (Rb.BlockParameter :+: Rb.DestructuredParameter :+: Rb.HashSplatParameter)
:+: ((Rb.Identifier :+: Rb.KeywordParameter) :+: (Rb.OptionalParameter :+: Rb.SplatParameter))
)
Loc
[ [Parse.Err
((:+:)
Rb.BlockParameter
(Rb.DestructuredParameter
:+: (Rb.HashSplatParameter
:+: (Rb.Identifier
:+: (Rb.KeywordParameter
:+: (Rb.OptionalParameter :+: Rb.SplatParameter)))))
Loc)]
] ->
m ()
introduceLocals params = for_ params $ \param -> case param of
Prj Rb.BlockParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
Prj Rb.DestructuredParameter {extraChildren} -> introduceLocals extraChildren
Prj Rb.HashSplatParameter {name = Just Rb.Identifier {text = lvar}} -> modify (lvar :)
Prj Rb.Identifier {text = lvar} -> modify (lvar :)
Prj Rb.KeywordParameter {name = Rb.Identifier {text = lvar}} -> modify (lvar :)
Prj Rb.OptionalParameter {name = Rb.Identifier {text = lvar}} -> modify (lvar :)
Prj Rb.SplatParameter {name = Just Rb.Identifier {text = lvar}} -> modify (lvar :)
EPrj Rb.BlockParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
EPrj Rb.DestructuredParameter {extraChildren} -> introduceLocals extraChildren
EPrj Rb.HashSplatParameter {name = Just (Parse.Success (Rb.Identifier {text = lvar}))} -> modify (lvar :)
EPrj Rb.Identifier {text = lvar} -> modify (lvar :)
EPrj Rb.KeywordParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
EPrj Rb.OptionalParameter {name = Parse.Success (Rb.Identifier {text = lvar})} -> modify (lvar :)
EPrj Rb.SplatParameter {name = Just (Parse.Success (Rb.Identifier {text = lvar}))} -> modify (lvar :)
_ -> pure ()
instance ToTags Rb.MethodParameters where