Commit 4bc3eb8d by Zachary Snow

more gracefully unknown type handling in Struct conversion

parent bddb8cea
...@@ -128,12 +128,16 @@ convertAsgn structs types (lhs, expr) = ...@@ -128,12 +128,16 @@ convertAsgn structs types (lhs, expr) =
Nothing -> (Implicit [], LHSIdent x) Nothing -> (Implicit [], LHSIdent x)
Just t -> (t, LHSIdent x) Just t -> (t, LHSIdent x)
convertLHS (LHSBit l e) = convertLHS (LHSBit l e) =
(tf $ tail rs, LHSBit l' e) if null rs
then (Implicit [], LHSBit l' e)
else (tf $ tail rs, LHSBit l' e)
where where
(t, l') = convertLHS l (t, l') = convertLHS l
(tf, rs) = typeRanges t (tf, rs) = typeRanges t
convertLHS (LHSRange l r ) = convertLHS (LHSRange l r ) =
(tf rs', LHSRange l' r) if null rs
then (Implicit [], LHSRange l' r)
else (tf rs', LHSRange l' r)
where where
(t, l') = convertLHS l (t, l') = convertLHS l
(tf, rs) = typeRanges t (tf, rs) = typeRanges t
...@@ -150,6 +154,7 @@ convertAsgn structs types (lhs, expr) = ...@@ -150,6 +154,7 @@ convertAsgn structs types (lhs, expr) =
hi' = BinOp Add base $ BinOp Sub hi lo hi' = BinOp Add base $ BinOp Sub hi lo
lo' = base lo' = base
tr = (simplify hi', simplify lo') tr = (simplify hi', simplify lo')
Implicit _ -> (Implicit [], LHSDot l' x)
_ -> error $ "convertLHS encountered dot for bad type: " ++ show (t, l, x) _ -> error $ "convertLHS encountered dot for bad type: " ++ show (t, l, x)
where where
(t, l') = convertLHS l (t, l') = convertLHS l
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment