瀏覽代碼

Revert "Fix implicit GDScript Reference inheritance"

punto- 9 年之前
父節點
當前提交
86253cbdfe
共有 2 個文件被更改,包括 5 次插入8 次删除
  1. 0 6
      modules/gdscript/gd_compiler.cpp
  2. 5 2
      modules/gdscript/gd_script.cpp

+ 0 - 6
modules/gdscript/gd_compiler.cpp

@@ -1588,12 +1588,6 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa
 		}
 
 
-	} else {
-		// without extends, implicitly extend Reference
-		int native_idx = GDScriptLanguage::get_singleton()->get_global_map()["Reference"];
-		native = GDScriptLanguage::get_singleton()->get_global_array()[native_idx];
-		ERR_FAIL_COND_V(native.is_null(), ERR_BUG);
-		p_script->native=native;
 	}
 
 

+ 5 - 2
modules/gdscript/gd_script.cpp

@@ -145,8 +145,11 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError&
 		_baseptr=_baseptr->_base;
 	}
 
-	ERR_FAIL_COND_V(_baseptr->native.is_null(), Variant());
-	owner=_baseptr->native->instance();
+	if (_baseptr->native.ptr()) {
+		owner=_baseptr->native->instance();
+	} else {
+		owner=memnew( Reference ); //by default, no base means use reference
+	}
 
 	Reference *r=owner->cast_to<Reference>();
 	if (r) {