Fix multiple issues regarding validation cleanup
Good that I'm writing unit tests for this shit.
This commit is contained in:
parent
14b5989f26
commit
17cecf5ef3
1 changed files with 19 additions and 17 deletions
|
@ -23,8 +23,19 @@ var singles: Array[CoreValidationSingle]
|
|||
|
||||
# +++ module +++
|
||||
func _cleanup() -> void:
|
||||
# Schemas
|
||||
var schemas_remove_enty: Array[CoreValidationSchema] = []
|
||||
for schema in schemas:
|
||||
schemas_remove_enty.append(schema)
|
||||
if !is_instance_valid(schema): continue
|
||||
if !is_instance_valid(schema.parent):
|
||||
logger.diag("Removing schema '" + schema.name + "'")
|
||||
schema.queue_free()
|
||||
for schema in schemas_remove_enty:
|
||||
schemas.remove_at(schemas.find(schema))
|
||||
|
||||
# Singles
|
||||
var singles_remove_enty: Array[CoreLoggerInstance] = []
|
||||
var singles_remove_enty: Array[CoreValidationSingle] = []
|
||||
for single in singles:
|
||||
singles_remove_enty.append(single)
|
||||
if !is_instance_valid(single): continue
|
||||
|
@ -34,17 +45,6 @@ func _cleanup() -> void:
|
|||
for single in singles_remove_enty:
|
||||
singles.remove_at(singles.find(single))
|
||||
|
||||
# Schemas
|
||||
var schemas_remove_enty: Array[CoreLoggerInstance] = []
|
||||
for schema in schemas:
|
||||
singles_remove_enty.append(schema)
|
||||
if !is_instance_valid(schema): continue
|
||||
if !is_instance_valid(schema.parent):
|
||||
logger.diag("Removing schema '" + schema.name + "'")
|
||||
schema.queue_free()
|
||||
for schema in schemas_remove_enty:
|
||||
schemas.remove_at(schemas.find(schema))
|
||||
|
||||
func _schedule() -> void:
|
||||
# Singles
|
||||
for single in singles:
|
||||
|
@ -61,10 +61,12 @@ func _schedule() -> void:
|
|||
# +++ data validation +++
|
||||
## Returns a new [CoreValidationSingle]
|
||||
func get_single(data, parent: Node) -> CoreValidationSingle:
|
||||
singles.append(parent)
|
||||
return CoreValidationSingle.new(core, data, parent)
|
||||
var single: CoreValidationSingle = CoreValidationSingle.new(core, data, parent)
|
||||
singles.append(single)
|
||||
return single
|
||||
|
||||
## Returns a new [CoreValidationSchema]
|
||||
func get_schema(schema: Dictionary, parent: Node) -> CoreValidationSchema:
|
||||
schemas.append(parent)
|
||||
return CoreValidationSchema.new(core, schema, parent)
|
||||
func get_schema(schema_dict: Dictionary, parent: Node) -> CoreValidationSchema:
|
||||
var schema: CoreValidationSchema = CoreValidationSchema.new(core, schema_dict, parent)
|
||||
schemas.append(schema)
|
||||
return schema
|
||||
|
|
Loading…
Reference in a new issue