1
1
mirror of https://github.com/github/semantic.git synced 2025-01-08 08:30:27 +03:00

Handle all the for statements in a single case.

This commit is contained in:
Rob Rix 2016-09-07 14:19:54 -04:00
parent 7a61659b5c
commit fe7b83663a

View File

@ -49,9 +49,9 @@ termConstructor source sourceSpan name range children
("pair", _) -> S.Fixed children
("if_statement", [ expr, clause1, clause2 ]) -> S.If expr clause1 (Just clause2)
("if_statement", [ expr, clause ]) -> S.If expr clause Nothing
("for_in_statement", _) | Just (exprs, body) <- unsnoc children -> S.For exprs body
("for_of_statement", _) | Just (exprs, body) <- unsnoc children -> S.For exprs body
("for_statement", _) | Just (exprs, body) <- unsnoc children -> S.For exprs body
_ | name `elem` [ "for_statement", "for_of_statement", "for_in_statement" ]
, Just (exprs, body) <- unsnoc children
-> S.For exprs body
("while_statement", [ expr, body ]) -> S.While expr body
("do_statement", [ expr, body ]) -> S.DoWhile expr body
("throw_statement", [ expr ]) -> S.Throw expr