2025-12-05 00:28:01 +01:00
|
|
|
#include "runtime.h"
|
2025-12-05 01:12:25 +01:00
|
|
|
#include "gc/gc.h"
|
2025-12-05 00:28:01 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
RavaMethodRef_t* rava_method_ref_create(const char *class_name, const char *method_name, bool is_constructor, bool is_static) {
|
2025-12-05 01:12:25 +01:00
|
|
|
RavaMethodRef_t *ref = rava_gc_alloc(sizeof(RavaMethodRef_t), RAVA_GC_TYPE_METHODREF);
|
2025-12-05 00:28:01 +01:00
|
|
|
if (!ref) return NULL;
|
|
|
|
|
|
2025-12-05 01:12:25 +01:00
|
|
|
memset((char*)ref + sizeof(RavaGCHeader_t), 0, sizeof(RavaMethodRef_t) - sizeof(RavaGCHeader_t));
|
|
|
|
|
|
2025-12-05 00:28:01 +01:00
|
|
|
ref->class_name = class_name ? strdup(class_name) : NULL;
|
|
|
|
|
ref->method_name = method_name ? strdup(method_name) : NULL;
|
|
|
|
|
ref->is_constructor = is_constructor;
|
|
|
|
|
ref->is_static = is_static;
|
|
|
|
|
ref->has_target = false;
|
|
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rava_method_ref_destroy(RavaMethodRef_t *ref) {
|
|
|
|
|
if (!ref) return;
|
|
|
|
|
free(ref->class_name);
|
|
|
|
|
free(ref->method_name);
|
|
|
|
|
}
|