Procházet zdrojové kódy

Copy node list when solving schema (consistency)

the sub-schema get a copy, so the parent schema should, too.
this also prevents schema from adding interface/prototype
stuff in the main node collection.

if this leads to bugs, then the sub-schema should get a reference
instead of a copy, too, when I change it back.

I haven't encountered any problems in testing.
Joseph Brandenburg před 5 měsíci
rodič
revize
7efe0af6cc
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      readtree.py

+ 2 - 2
readtree.py

@@ -205,7 +205,7 @@ def solve_schema_to_tree(nc, all_nc, roots=[], error_popups=False):
     from .utilities import get_node_prototype
     np = get_node_prototype(nc.signature, nc.base_tree)
     from .schema_solve import SchemaSolver
-    solver = SchemaSolver(nc, all_nc, np, error_popups=error_popups)
+    solver = SchemaSolver(nc, all_nc.copy(), np, error_popups=error_popups)
     try:
         solved_nodes = solver.solve()
     except Exception as e:
@@ -217,7 +217,7 @@ def solve_schema_to_tree(nc, all_nc, roots=[], error_popups=False):
     # maybe this should be done in schema solver. TODO invesitigate a more efficient way
     del_me = []
     for k, v in all_nc.items():
-        # delete all the schema's internal nodes. The links have already been deleted by the solver.
+        # delete all the schema's prototype and interface nodes. The links have already been deleted by the solver.
         if v.signature[0] not in ['MANTIS_AUTOGENERATED'] and is_signature_in_other_signature(nc.signature, k):
             del_me.append(k)
     for k in del_me: