mirror of https://github.com/zachjs/sv2v.git
nicer error message for missing struct fields
This commit is contained in:
parent
89e4f2a248
commit
086826714d
|
|
@ -446,7 +446,10 @@ convertAsgn structs types (lhs, expr) =
|
||||||
-- lookup the range of a field in its unstructured type
|
-- lookup the range of a field in its unstructured type
|
||||||
lookupUnstructRange :: TypeFunc -> Identifier -> Range
|
lookupUnstructRange :: TypeFunc -> Identifier -> Range
|
||||||
lookupUnstructRange structTf fieldName =
|
lookupUnstructRange structTf fieldName =
|
||||||
fieldRangeMap Map.! fieldName
|
case Map.lookup fieldName fieldRangeMap of
|
||||||
|
Nothing -> error $ "field '" ++ fieldName ++
|
||||||
|
"' not found in struct: " ++ show structTf
|
||||||
|
Just r -> r
|
||||||
where fieldRangeMap = Map.map fst $ snd $ structs Map.! structTf
|
where fieldRangeMap = Map.map fst $ snd $ structs Map.! structTf
|
||||||
|
|
||||||
-- lookup the type of a field in the given field list
|
-- lookup the type of a field in the given field list
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue