Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1503

Disconnect NamespaceStmtCtx from Current and StmtContext

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Medium Medium
    • None
    • None
    • parser

      The two user-facing contexts expose namespace access, each of which requires resolving a NamespaceAccess – which ends up going to BuildGlobalContext.

      This is currently dictated by legacy class hierarchy and APIs, but we should be able to disconnect these three and passing around a NamespaceCtx:

       

      interface NamespaceCtx {
       
          <K, V> @Nullable Map<K, V> namespace(CommonStmtCtx stmt, ParserNamespace<K, V> namespace);
      
          <K, V> @Nullable V namespaceItem(CommonStmtCtx stmt, ParserNamespace<K, V> namespace, K key);
      
          <K, V> @Nullable Map<K, V> localNamespacePortion(CommonStmtCtx stmt, ParserNamespace<K, V> namespace);
      }
      

      to all methods which are allowed to access namespaces.

       

      The reactor would implement this through BuildGlobalContext, which would mean that AbstractStorageNode would not need accessNamespace(). There are two wrinkles:

      1. the need to cast stmt to ReactorStmtCtx – which is essentially fine
      2. the amount of API changes – which entails a lot of work

       

            Unassigned Unassigned
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: