Commit 08682671 by Zachary Snow

nicer error message for missing struct fields

parent 89e4f2a2
...@@ -446,7 +446,10 @@ convertAsgn structs types (lhs, expr) = ...@@ -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
......
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