Map Bool-shaped things to javascript bool, add if/then and tertiary to code gen

This commit is contained in:
2025-10-20 11:08:12 -07:00
parent e45d194d7f
commit 15b892510e
9 changed files with 68 additions and 15 deletions

View File

@@ -51,10 +51,11 @@ instance HasFC BindInfo where
Tm : U
data Literal = LString String | LInt Int | LChar Char
data Literal = LString String | LInt Int | LChar Char | LBool Bool
instance Show Literal where
show (LString str) = quoteString str
show (LBool b) = if b then "true" else "false"
show (LInt i) = show i
show (LChar c) = "'\{show c}'" -- FIXME single quote
@@ -337,17 +338,21 @@ instance Eq MetaMode where
NoCheck == NoCheck = True
_ == _ = False
data ConInfo = NormalCon | SuccCon | ZeroCon | EnumCon
data ConInfo = NormalCon | SuccCon | ZeroCon | EnumCon | TrueCon | FalseCon
instance Eq ConInfo where
NormalCon == NormalCon = True
SuccCon == SuccCon = True
ZeroCon == ZeroCon = True
EnumCon == EnumCon = True
TrueCon == TrueCon = True
FalseCon == FalseCon = True
_ == _ = False
instance Show ConInfo where
show NormalCon = ""
show FalseCon = "[F]"
show TrueCon = "[T]"
show SuccCon = "[S]"
show ZeroCon = "[Z]"
show EnumCon = "[E]"