mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Allow len and cap to return a uint if a type hint is uint to aid people wanting to use unsigned integers
This commit is contained in:
@@ -406,6 +406,16 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
|
|||||||
|
|
||||||
Type *op_type = type_deref(operand->type);
|
Type *op_type = type_deref(operand->type);
|
||||||
Type *type = t_int;
|
Type *type = t_int;
|
||||||
|
if (type_hint != nullptr) {
|
||||||
|
Type *bt = type_hint;
|
||||||
|
// bt = base_type(bt);
|
||||||
|
if (bt == t_int) {
|
||||||
|
type = type_hint;
|
||||||
|
} else if (bt == t_uint) {
|
||||||
|
type = type_hint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AddressingMode mode = Addressing_Invalid;
|
AddressingMode mode = Addressing_Invalid;
|
||||||
ExactValue value = {};
|
ExactValue value = {};
|
||||||
if (is_type_string(op_type) && id == BuiltinProc_len) {
|
if (is_type_string(op_type) && id == BuiltinProc_len) {
|
||||||
|
|||||||
Reference in New Issue
Block a user