booleans, comparisons, and if/else

This commit is contained in:
2026-06-21 20:20:55 +02:00
parent 19e9fbdd4b
commit c90ada608e
13 changed files with 1064 additions and 518 deletions
+11
View File
@@ -40,6 +40,8 @@ C_FLOAT :: Type(26)
C_DOUBLE :: Type(27)
C_LONGDOUBLE :: Type(28)
BOOL :: Type(29)
DYNAMIC_START :: Type(64)
Numeric_Category :: enum u8 {
@@ -236,6 +238,8 @@ kind :: proc(value: Type, store: ^Store = nil) -> Kind {
return .Void
case INT:
return .Int_Constraint
case BOOL:
return .Scalar
}
if value >= I8 && value <= C_LONGDOUBLE {
return .Scalar
@@ -268,6 +272,10 @@ is_void :: proc(value: Type) -> bool {
return value == VOID
}
is_bool :: proc(value: Type) -> bool {
return value == BOOL
}
is_constraint :: proc(value: Type) -> bool {
return value == INT
}
@@ -320,6 +328,8 @@ category :: proc(value: Type, selected := target.DEFAULT) -> Numeric_Category {
bits :: proc(value: Type, selected := target.DEFAULT) -> int {
switch value {
case BOOL:
return 1
case I8, U8:
return 8
case I16, U16:
@@ -945,6 +955,7 @@ name :: proc(value: Type) -> string {
switch value {
case INVALID: return "<invalid>"
case VOID: return "void"
case BOOL: return "bool"
case INT: return "int"
case I8: return "i8"
case I16: return "i16"