booleans, comparisons, and if/else
This commit is contained in:
@@ -77,6 +77,7 @@ Expr_Kind :: enum u8 {
|
||||
Integer,
|
||||
Float,
|
||||
String,
|
||||
Bool,
|
||||
Array,
|
||||
Struct,
|
||||
None,
|
||||
@@ -99,8 +100,17 @@ Expr_Kind :: enum u8 {
|
||||
Weaken_Slice,
|
||||
Decay_Array_Pointer,
|
||||
Negate,
|
||||
Not,
|
||||
Add,
|
||||
Pointer_Add,
|
||||
Eq,
|
||||
Ne,
|
||||
Lt,
|
||||
Le,
|
||||
Gt,
|
||||
Ge,
|
||||
And,
|
||||
Or,
|
||||
Call,
|
||||
}
|
||||
|
||||
@@ -130,6 +140,7 @@ Stmt_Kind :: enum u8 {
|
||||
Expression,
|
||||
Sink,
|
||||
Trap,
|
||||
If,
|
||||
}
|
||||
|
||||
Stmt :: struct {
|
||||
@@ -138,6 +149,10 @@ Stmt :: struct {
|
||||
local: Local_Id,
|
||||
target: Expr_Id,
|
||||
expr: Expr_Id,
|
||||
// `If` statements use `expr` as the condition and `then_body`/`else_body` as
|
||||
// the branch statement lists.
|
||||
then_body: []Stmt_Id,
|
||||
else_body: []Stmt_Id,
|
||||
diagnostic: source.Diagnostic_Id,
|
||||
}
|
||||
|
||||
@@ -204,6 +219,10 @@ destroy_module :: proc(module: ^Module) {
|
||||
for expr in module.exprs {
|
||||
delete(expr.args, module.allocator)
|
||||
}
|
||||
for statement in module.statements {
|
||||
delete(statement.then_body, module.allocator)
|
||||
delete(statement.else_body, module.allocator)
|
||||
}
|
||||
for function in module.functions {
|
||||
delete(function.link_name, module.allocator)
|
||||
delete(function.params, module.allocator)
|
||||
|
||||
Reference in New Issue
Block a user