Fix extends issue, closes #4026

(cherry picked from commit 565bb3afcc)
This commit is contained in:
Juan Linietsky 2016-06-28 10:44:38 -03:00 committed by Rémi Verschelde
parent a2103bac7c
commit dffa1da012
1 changed files with 3 additions and 1 deletions

View File

@ -1470,7 +1470,8 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
String sub = p_class->extends_class[i]; String sub = p_class->extends_class[i];
if (script->subclasses.has(sub)) { if (script->subclasses.has(sub)) {
script=script->subclasses[sub]; Ref<Script> subclass = script->subclasses[sub]; //avoid reference from dissapearing
script=subclass;
} else { } else {
_set_error("Could not find subclass: "+sub,p_class); _set_error("Could not find subclass: "+sub,p_class);
@ -1647,6 +1648,7 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
if (err) if (err)
return err; return err;
p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants
p_script->subclasses.insert(name,subclass); p_script->subclasses.insert(name,subclass);