1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 12:51:52 +03:00

Error if for statements don't match expected shape

This commit is contained in:
Timothy Clem 2016-10-31 13:47:51 -07:00
parent 4f3e5fa069
commit ada47c7208

View File

@ -92,7 +92,10 @@ termConstructor source sourceSpan name range children
S.Indexed _ -> S.Export Nothing (toList (unwrap statements))
_ -> S.Export (Just statements) []
("export_statement", _ ) -> S.Error children
_ | name `elem` forStatements, Just (exprs, body) <- unsnoc children -> S.For exprs body
-- _ | name `elem` forStatements, Just (exprs, body) <- unsnoc children -> S.For exprs body
_ | name `elem` forStatements -> case unsnoc children of
Just (exprs, body) -> S.For exprs body
_ -> S.Error children
_ | name `elem` operators -> S.Operator children
_ | name `elem` functions -> case children of
[ body ] -> S.AnonymousFunction [] body