mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Construct Try terms
This commit is contained in:
parent
ad9c63ef42
commit
f767ad20db
@ -101,5 +101,13 @@ termConstructor source sourceSpan info = cofree . construct
|
||||
withDefaultInfo $ S.While expr body
|
||||
construct children | DoWhile == (category info), [expr, body] <- children =
|
||||
withDefaultInfo $ S.DoWhile expr body
|
||||
construct children | Try == category info = case children of
|
||||
[body] -> withDefaultInfo $ S.Try body Nothing Nothing
|
||||
[body, catch] | Catch <- category (extract catch) -> withDefaultInfo $ S.Try body (Just catch) Nothing
|
||||
[body, finally] | Finally <- category (extract finally) -> withDefaultInfo $ S.Try body Nothing (Just finally)
|
||||
[body, catch, finally] | Catch <- category (extract catch),
|
||||
Finally <- category (extract finally) ->
|
||||
withDefaultInfo $ S.Try body (Just catch) (Just finally)
|
||||
_ -> S.Error sourceSpan children
|
||||
construct children =
|
||||
withDefaultInfo $ S.Indexed children
|
||||
|
Loading…
Reference in New Issue
Block a user