Merge pull request #5054 from eska014/fix-implicit-extends

Fix implicit GDScript Reference inheritance
This commit is contained in:
Juan Linietsky 2016-06-06 20:08:39 -03:00
commit 5aa4070438
2 changed files with 8 additions and 5 deletions

View File

@ -1588,6 +1588,12 @@ 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;
}

View File

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