cons/nil for pair/unit in scheme backend
This commit is contained in:
@@ -146,12 +146,6 @@ compileTerm tm@(App _ _ _) = case funArgs tm of
|
||||
if length' qs == length' args
|
||||
then pure $ CConstr tag nm.baseName args' qs NilCon
|
||||
else apply nm args' arity
|
||||
-- REVIEW Slower for JS, faster for scheme. (2.88 vs 3.01)
|
||||
-- but all of the "JS" diff is code gen?
|
||||
-- Just (DCon tag info qs _) =>
|
||||
-- if length' qs == length' args
|
||||
-- then pure $ CConstr tag nm.baseName args' qs info
|
||||
-- else apply nm args' arity
|
||||
_ => apply nm args' arity
|
||||
-- REVIEW maybe we want a different constructor for non-Ref applications?
|
||||
(t, args) => do
|
||||
|
||||
@@ -415,11 +415,14 @@ populateConInfo entries =
|
||||
-- Boolean
|
||||
| Just (a :: b :: Nil) => (setInfo a FalseCon :: setInfo b TrueCon :: Nil)
|
||||
| Just entries => entries in
|
||||
let (a :: b :: Nil) = entries | _ => entries in
|
||||
fromMaybe entries $ checkNat entries <|> checkCons entries
|
||||
-- let (Nothing) = checkNat entries | Just entries => entries in
|
||||
-- let (Nothing) = checkNat entries | Just entries => entries in
|
||||
-- entries
|
||||
case entries of
|
||||
a :: Nil => case countFields a of
|
||||
0 => setInfo a NilCon :: Nil
|
||||
2 => setInfo a ConsCon :: Nil
|
||||
_ => entries
|
||||
a :: b :: Nil =>
|
||||
fromMaybe entries $ checkNat entries <|> checkCons entries
|
||||
_ => entries
|
||||
where
|
||||
countFields : TopEntry → Int
|
||||
countFields (MkEntry fc name type def eflags) = go type
|
||||
|
||||
Reference in New Issue
Block a user