Bläddra i källkod

Fix: Some nodes are not prepared by schema parser

Schema parsing should identify all dependency nodes, prepare them, and continue.
However, it is not currently able to find them. My guess is that nested schema are not
tracing their dependencies into solve_only_these.
So instead, the schema solver goes back and prepares these dependencies.

This section of code needs refactoring - the schema parse happens in the middle of
parse_tree. This section is highly confusing without being stuck in the middle of a
huge, important function. And I've made it worse by handing over dependency
solving in part to schema solver. Further work must refactor, and do it all correctly in
one place.
Joseph Brandenburg 7 månader sedan
förälder
incheckning
36210826e1
2 ändrade filer med 9 tillägg och 1 borttagningar
  1. 4 0
      readtree.py
  2. 5 1
      schema_solve.py

+ 4 - 0
readtree.py

@@ -378,6 +378,10 @@ def parse_tree(base_tree):
         if n.signature in all_schema.keys():
             for dep in n.hierarchy_dependencies:
                 if dep not in schema_solve_done and (dep in solve_only_these):
+                    if dep.prepared: # HACK HACK HACK
+                        continue 
+                        # For some reason, the Schema Solver is able to detect and resolve dependencies outside
+                        #  of solve_only_these. So I have to figure out why.
                     solve_layer.appendleft(n)
                     break
             else:

+ 5 - 1
schema_solve.py

@@ -427,7 +427,11 @@ class SchemaSolver:
                 nc.bPrepare()
                 if nc.node_type == 'DUMMY_SCHEMA':
                     self.solve_nested_schema(nc)
-            else:
+            else: #TODO find out what I am missing elsewhere that makes this necessary
+                for dep in nc.hierarchy_dependencies:
+                    if not dep.prepared and dep not in unprepared:
+                        unprepared.appendleft(dep)
+                #TODO
                 unprepared.appendleft(nc) # just rotate them until they are ready.
         
         while(awaiting_prep_stage):