1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

match less

This commit is contained in:
joshvera 2016-10-31 21:19:56 -04:00
parent 95037e1b75
commit 3b3515ccff

View File

@ -49,13 +49,14 @@ termConstructor source sourceSpan name range children = case (name, children) of
where where
toVarAssignment constSpec = do toVarAssignment constSpec = do
assignment <- case toList (unwrap constSpec) of assignment <- case toList (unwrap constSpec) of
[idList, _, exprs] -> do idList : rest -> do
identifier' <- case toList (unwrap idList) of identifier' <- case toList (unwrap idList) of
(id : _) -> case toList (unwrap id) of id : _ -> case toList (unwrap id) of
(id : _) -> pure id id : _ -> pure id
_ -> withCategory Error (S.Error [constSpec]) _ -> withCategory Error (S.Error [constSpec])
_ -> withCategory Error (S.Error [constSpec]) _ -> withCategory Error (S.Error [constSpec])
withDefaultInfo $ S.VarAssignment identifier' exprs rest' <- withDefaultInfo (S.Indexed rest)
withDefaultInfo $ S.VarAssignment identifier' rest'
_ -> withCategory Error (S.Error [constSpec]) _ -> withCategory Error (S.Error [constSpec])
withDefaultInfo $ S.VarDecl assignment withDefaultInfo $ S.VarDecl assignment
(_, []) -> withDefaultInfo . S.Leaf $ toText (slice range source) (_, []) -> withDefaultInfo . S.Leaf $ toText (slice range source)