Browse Source

feat: makeInherit时检查是否可被继承

SongZihuan 3 years ago
parent
commit
ec984ee7f3
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/core/object.c

+ 3 - 0
src/core/object.c

@@ -134,6 +134,9 @@ af_Object *getBelongObject(af_Object *object){
 }
 
 af_Inherit *makeInherit(af_Object *obj) {
+    if (!obj->data->allow_inherit)
+        return NULL;
+
     obj_getShareVarSpace *func = findAPI("obj_getShareVarSpace", obj->data->api);
     af_VarSpace *vs = NULL;
     if (func == NULL || (vs = func(obj)) == NULL)