// result: (FALSE) not found or failed in type checking (TRUE:) success BOOL cl_get_class_field(sCLClass* klass, char* field_name, sCLClass* field_class, MVALUE* result) { sCLField* field; CLObject object; CLObject type_object; sCLClass* klass2; field = get_field(klass, field_name, TRUE); if(field == NULL || (field->mFlags & CL_STATIC_FIELD) == 0) { return FALSE; } object = get_object_from_mvalue(field->uValue.mStaticField); type_object = CLOBJECT_HEADER(object)->mType; klass2 = CLTYPEOBJECT(type_object)->mClass; /// type checking /// if(object && substitution_posibility_of_class(field_class, klass2)) { (*result).mObjectValue.mValue = object; } else { return FALSE; } return TRUE; }
static CLObject create_null_object_for_new(CLObject type_object, sVMInfo* info) { CLObject obj; obj = create_null_object(); CLOBJECT_HEADER(obj)->mType = type_object; return obj; }
static CLObject create_bool_object_for_new(CLObject type_object, sVMInfo* info) { CLObject self; self = create_bool_object(0); push_object(self, info); CLOBJECT_HEADER(self)->mType = type_object; pop_object(info); return self; }
static CLObject create_range_object_for_new(CLObject type_object, sVMInfo* info) { CLObject self; CLObject head_object; CLObject tail_object; head_object = create_int_object(0); push_object(head_object, info); tail_object = create_int_object(0); push_object(tail_object, info); self = create_range_object(type_object, head_object, tail_object); CLOBJECT_HEADER(self)->mType = type_object; pop_object(info); pop_object(info); return self; }
// result: (FALSE) not found or failed in type checking (TRUE:) success BOOL cl_get_array_element(CLObject array, int index, sCLClass* element_class, MVALUE* result) { CLObject object; CLObject type; sCLClass* klass; if(index < 0 || index >= CLARRAY(array)->mLen) { return FALSE; } object = get_object_from_mvalue(CLARRAY_ITEMS2(array, index)); type = CLOBJECT_HEADER(object)->mType; klass = CLTYPEOBJECT(type)->mClass; /// type checking /// if(object && substitution_posibility_of_class(element_class, klass)) { (*result).mObjectValue.mValue = object; } else { return FALSE; } return TRUE; }