aboutsummaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_compiler.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-06-28 10:44:38 -0300
committerRémi Verschelde2016-07-08 18:41:37 +0200
commitdffa1da01211b3270f7328cbab9fdffe53f68ac1 (patch)
tree2bb0d62d94b5ede92834f68fe62eacc07f48dc66 /modules/gdscript/gd_compiler.cpp
parenta2103bac7caf0f60495ccce8e499cccdd2cfbb94 (diff)
downloadgodot-dffa1da01211b3270f7328cbab9fdffe53f68ac1.tar.gz
godot-dffa1da01211b3270f7328cbab9fdffe53f68ac1.tar.zst
godot-dffa1da01211b3270f7328cbab9fdffe53f68ac1.zip
Diffstat (limited to 'modules/gdscript/gd_compiler.cpp')
-rw-r--r--modules/gdscript/gd_compiler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index d8c058722..10c54435e 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1470,7 +1470,8 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
String sub = p_class->extends_class[i];
if (script->subclasses.has(sub)) {
- script=script->subclasses[sub];
+ Ref<Script> subclass = script->subclasses[sub]; //avoid reference from dissapearing
+ script=subclass;
} else {
_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)
return err;
+
p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants
p_script->subclasses.insert(name,subclass);