mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-22 05:34:59 -07:00
Merge tag 'dev-2024-12'
# Conflicts: # vendor/raylib/windows/raylib.dll # vendor/raylib/windows/raylibdll.lib
This commit is contained in:
+47
-1
@@ -2565,6 +2565,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
case BuiltinProc_swizzle: {
|
||||
// swizzle :: proc(v: [N]T, ..int) -> [M]T
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *original_type = operand->type;
|
||||
Type *type = base_type(original_type);
|
||||
i64 max_count = 0;
|
||||
@@ -2922,6 +2926,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
// imag :: proc(x: type) -> float_type
|
||||
|
||||
Operand *x = operand;
|
||||
if (!x->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_type_untyped(x->type)) {
|
||||
if (x->mode == Addressing_Constant) {
|
||||
if (is_type_numeric(x->type)) {
|
||||
@@ -2982,6 +2990,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
// kmag :: proc(x: type) -> float_type
|
||||
|
||||
Operand *x = operand;
|
||||
if (!x->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_type_untyped(x->type)) {
|
||||
if (x->mode == Addressing_Constant) {
|
||||
if (is_type_numeric(x->type)) {
|
||||
@@ -3031,6 +3043,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
case BuiltinProc_conj: {
|
||||
// conj :: proc(x: type) -> type
|
||||
Operand *x = operand;
|
||||
if (!x->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *t = x->type;
|
||||
Type *elem = core_array_type(t);
|
||||
|
||||
@@ -3071,10 +3087,14 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
}
|
||||
|
||||
case BuiltinProc_expand_values: {
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *type = base_type(operand->type);
|
||||
if (!is_type_struct(type) && !is_type_array(type)) {
|
||||
gbString type_str = type_to_string(operand->type);
|
||||
error(call, "Expected a struct or array type, got '%s'", type_str);
|
||||
error(call, "Expected a struct or array type to 'expand_values', got '%s'", type_str);
|
||||
gb_string_free(type_str);
|
||||
return false;
|
||||
}
|
||||
@@ -3110,8 +3130,13 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
check_multi_expr_or_type(c, operand, ce->args[0]);
|
||||
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *original_type = operand->type;
|
||||
Type *type = base_type(operand->type);
|
||||
|
||||
if (operand->mode == Addressing_Type && is_type_enumerated_array(type)) {
|
||||
// Okay
|
||||
} else if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
|
||||
@@ -3184,6 +3209,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ce->args.count <= 1) {
|
||||
error(call, "Too few arguments for 'min', two or more are required");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool all_constant = operand->mode == Addressing_Constant;
|
||||
|
||||
@@ -3278,6 +3307,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
check_multi_expr_or_type(c, operand, ce->args[0]);
|
||||
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *original_type = operand->type;
|
||||
Type *type = base_type(operand->type);
|
||||
|
||||
@@ -3357,6 +3390,11 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
gb_string_free(type_str);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ce->args.count <= 1) {
|
||||
error(call, "Too few arguments for 'max', two or more are required");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool all_constant = operand->mode == Addressing_Constant;
|
||||
|
||||
@@ -3448,6 +3486,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
case BuiltinProc_abs: {
|
||||
// abs :: proc(n: numeric) -> numeric
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(is_type_numeric(operand->type) && !is_type_array(operand->type))) {
|
||||
gbString type_str = type_to_string(operand->type);
|
||||
error(call, "Expected a numeric type to 'abs', got '%s'", type_str);
|
||||
@@ -3503,6 +3545,10 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
case BuiltinProc_clamp: {
|
||||
// clamp :: proc(a, min, max: ordered) -> ordered
|
||||
if (!operand->type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type *type = operand->type;
|
||||
if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
|
||||
gbString type_str = type_to_string(operand->type);
|
||||
|
||||
Reference in New Issue
Block a user