Jelajahi Sumber

GDSCript: Fix cyclic class dependency detection

George Marques 7 tahun lalu
induk
melakukan
d97624e295
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      modules/gdscript/gdscript_compiler.cpp

+ 4 - 2
modules/gdscript/gdscript_compiler.cpp

@@ -1994,8 +1994,11 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, GDScript *p_owner
 		p_script->_signals[name] = p_class->_signals[i].arguments;
 	}
 
-	if (!p_class->owner) {
+	if (p_class->owner) {
 		parsed_classes.insert(p_class->name);
+		if (parsing_classes.has(p_class->name)) {
+			parsing_classes.erase(p_class->name);
+		}
 	}
 
 	//parse sub-classes
@@ -2011,7 +2014,6 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, GDScript *p_owner
 			Error err = _parse_class_level(subclass.ptr(), p_script, p_class->subclasses[i], p_keep_state);
 			if (err)
 				return err;
-			parsing_classes.erase(name);
 		}
 
 #ifdef TOOLS_ENABLED