Verified Commit 0f167708 authored by Camil Staps's avatar Camil Staps 🚀

Some more fixes for record fields in Idents

parent 926a918c
......@@ -28,6 +28,8 @@ where
, record_fields = union a.record_fields b.record_fields
}
instance idents Idents where idents _ id = id
instance idents [t] | idents t
where
idents c xs = removeLocalGlobals
......@@ -79,12 +81,12 @@ where
PE_List pes -> idents c pes
PE_Ident id -> idents c id
PE_Basic b -> idents c b
PE_Bound _ -> zero
PE_Bound b -> src + idents c b.bind_dst + {zero & locals=src.record_fields}
with src = idents c b.bind_src
PE_Lambda _ args rhs _ -> noLocals (idents ICPattern args + idents ICExpression rhs)
PE_Tuple es -> idents c es
PE_Record init _ fields -> idents c init + idents c [f.bind_dst \\ f <- fields] + idents c [f.bind_src \\ f <- fields]
PE_ArrayPattern _ -> abort "idents PE_ArrayPattern\n"
//(PE_ArrayPattern ![ElemAssignment]
PE_ArrayPattern eas -> foldr (\x -> (+) (idents c x.bind_src + idents c x.bind_dst)) zero eas
PE_UpdateComprehension base (PE_Update _ sels new) _ qs -> noLocals (idents ICExpression [base,new] + idents ICExpression sels + idents ICPattern qs)
PE_ArrayDenot _ es -> idents c es
PE_Selection _ e s -> idents c e + idents c s
......
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