mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-18 20:40:28 +00:00
Basic polymorphic named procedure parameters for procedures and records
This commit is contained in:
@@ -592,6 +592,10 @@ i32 exact_value_order(ExactValue const &v) {
|
||||
return 5;
|
||||
case ExactValue_Pointer:
|
||||
return 6;
|
||||
case ExactValue_Procedure:
|
||||
return 7;
|
||||
// case ExactValue_Compound:
|
||||
// return 8;
|
||||
|
||||
default:
|
||||
GB_PANIC("How'd you get here? Invalid Value.kind");
|
||||
@@ -652,6 +656,9 @@ void match_exact_values(ExactValue *x, ExactValue *y) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ExactValue_Procedure:
|
||||
return;
|
||||
}
|
||||
|
||||
compiler_error("match_exact_values: How'd you get here? Invalid ExactValueKind %d", x->kind);
|
||||
@@ -915,12 +922,23 @@ bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y) {
|
||||
case Token_NotEq: return !are_types_identical(x.value_typeid, y.value_typeid);
|
||||
}
|
||||
break;
|
||||
|
||||
case ExactValue_Procedure:
|
||||
switch (op) {
|
||||
case Token_CmpEq: return are_types_identical(x.value_typeid, y.value_typeid);
|
||||
case Token_NotEq: return !are_types_identical(x.value_typeid, y.value_typeid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
GB_PANIC("Invalid comparison");
|
||||
return false;
|
||||
}
|
||||
|
||||
Entity *strip_entity_wrapping(Ast *expr);
|
||||
Entity *strip_entity_wrapping(Entity *e);
|
||||
|
||||
gbString write_expr_to_string(gbString str, Ast *node);
|
||||
|
||||
gbString write_exact_value_to_string(gbString str, ExactValue const &v, isize string_limit=36) {
|
||||
switch (v.kind) {
|
||||
@@ -956,9 +974,9 @@ gbString write_exact_value_to_string(gbString str, ExactValue const &v, isize st
|
||||
case ExactValue_Pointer:
|
||||
return str;
|
||||
case ExactValue_Compound:
|
||||
return str;
|
||||
return write_expr_to_string(str, v.value_compound);
|
||||
case ExactValue_Procedure:
|
||||
return str;
|
||||
return write_expr_to_string(str, v.value_procedure);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user