diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-05-24 22:40:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-24 22:40:47 +0200 |
commit | b09ed500201042f1abb888a31aba3ab3b007a83e (patch) | |
tree | 83cb02fb472ef2510d347f7de2b34e1d14d0976c | |
parent | 331657c38bad463c156d4a3a20b74ada2dbdf3ff (diff) | |
parent | ebcfe284751deff4105c68b1d92511ace1a25665 (diff) |
Merge pull request #29145 from GodotExplorer/gdscript-extend-fix
Fix parse error when inherits from subclass of named classes
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index de15f939ce..1c22c4af3c 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -5248,6 +5248,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) { if (base_script.is_valid()) { String ident = base; + Ref<GDScript> find_subclass = base_script; for (int i = extend_iter; i < p_class->extends_class.size(); i++) { @@ -5257,7 +5258,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) { if (base_script->get_subclasses().has(subclass)) { - base_script = base_script->get_subclasses()[subclass]; + find_subclass = base_script->get_subclasses()[subclass]; } else if (base_script->get_constants().has(subclass)) { Ref<GDScript> new_base_class = base_script->get_constants()[subclass]; @@ -5265,7 +5266,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) { _set_error("Constant is not a class: " + ident, p_class->line); return; } - base_script = new_base_class; + find_subclass = new_base_class; } else { _set_error("Could not find subclass: " + ident, p_class->line); @@ -5273,7 +5274,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) { } } - script = base_script; + script = find_subclass; } else if (!base_class) { |