1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

More comprehensive error handling for uncompilable assignments.

This commit is contained in:
Patrick Thomson 2019-08-27 10:24:59 -04:00
parent e1556cb16b
commit 8a44e901c7

View File

@ -27,13 +27,13 @@ instance (Compile l, Compile r) => Compile (Either l r) where compile = compileS
instance Compile Py.AssertStatement
instance Compile Py.Attribute
-- TODO what is this third field here
instance Compile Py.Assignment where
compile (Py.Assignment (Py.ExpressionList [lhs]) (Just rhs) _) = do
target <- compile lhs
value <- compile rhs
pure (target .= value)
compile (Py.Assignment (Py.ExpressionList hs) _ _) = fail ("too many lhs values: " <> show (length hs))
compile other = fail ("Unhandled assignment case: " <> show other)
instance Compile Py.AugmentedAssignment
instance Compile Py.Await