Fixing type checking

This commit is contained in:
Krzosa Karol
2022-06-06 22:14:30 +02:00
parent d042251c21
commit 729e7aee86
6 changed files with 219 additions and 205 deletions

View File

@@ -564,6 +564,50 @@ ast_package(Token *pos, String name, Array<Ast_Named *> decls){
return result;
}
//-----------------------------------------------------------------------------
// Value
//-----------------------------------------------------------------------------
function Value
value_bool(B32 v){
Value value;
value.bool_val = v;
value.type = untyped_bool;
return value;
}
function Value
value_int(BigInt b){
Value value;
value.big_int_val = b;
value.type = untyped_int;
return value;
}
function Value
value_int(S64 s64){
Value value;
value.type = untyped_int;
bigint_init_signed(&value.big_int_val, s64);
return value;
}
function Value
value_float(F64 b){
Value value;
value.f64_val = b;
value.type = untyped_float;
return value;
}
function Value
value_float(BigInt a){
Value value;
value.f64_val = bigint_as_float(&a);
value.type = untyped_float;
return value;
}
//-----------------------------------------------------------------------------
// Utillities
//-----------------------------------------------------------------------------