chore: remove trailing whitespace from README.md formatting
This commit is contained in:
@@ -118,6 +118,27 @@ bool rava_type_is_reference(RavaType_t *type) {
|
||||
type->kind == RAVA_TYPE_NULL;
|
||||
}
|
||||
|
||||
static RavaTypeKind_e _get_wrapper_primitive(RavaType_t *type) {
|
||||
if (type->kind != RAVA_TYPE_CLASS || !type->data.class_type.class_name) {
|
||||
return RAVA_TYPE_UNKNOWN;
|
||||
}
|
||||
const char *name = type->data.class_type.class_name;
|
||||
if (strcmp(name, "Integer") == 0) return RAVA_TYPE_INT;
|
||||
if (strcmp(name, "Long") == 0) return RAVA_TYPE_LONG;
|
||||
if (strcmp(name, "Double") == 0) return RAVA_TYPE_DOUBLE;
|
||||
if (strcmp(name, "Float") == 0) return RAVA_TYPE_FLOAT;
|
||||
if (strcmp(name, "Boolean") == 0) return RAVA_TYPE_BOOLEAN;
|
||||
if (strcmp(name, "Character") == 0) return RAVA_TYPE_CHAR;
|
||||
if (strcmp(name, "Byte") == 0) return RAVA_TYPE_BYTE;
|
||||
if (strcmp(name, "Short") == 0) return RAVA_TYPE_SHORT;
|
||||
return RAVA_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
static bool _is_wrapper_for_primitive(RavaType_t *wrapper, RavaType_t *primitive) {
|
||||
RavaTypeKind_e wk = _get_wrapper_primitive(wrapper);
|
||||
return wk != RAVA_TYPE_UNKNOWN && wk == primitive->kind;
|
||||
}
|
||||
|
||||
bool rava_type_equals(RavaType_t *a, RavaType_t *b) {
|
||||
if (!a || !b) return false;
|
||||
if (a->kind != b->kind) return false;
|
||||
@@ -149,6 +170,14 @@ bool rava_type_is_assignable_to(RavaType_t *from, RavaType_t *to) {
|
||||
return from_rank <= to_rank;
|
||||
}
|
||||
|
||||
if (rava_type_is_primitive(from) && _is_wrapper_for_primitive(to, from)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rava_type_is_primitive(to) && _is_wrapper_for_primitive(from, to)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user