Details
-
Bug
-
Status: Resolved
-
Highest
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
7037
Description
Our current handling of statements within a YANG extension performs encapsulation into UnknownNodes – this is done in the middle of SourceSpecificContext.createDeclaredChild().
As the associated FIXME indicates, the way this is done is inefficient, as we end up creating a new ModelDefinedStatementDefinition and a corresponding UnknownStatementImpl.Definition for each such instance.
In order to fix this we have to change the way we look up StatementDefinitionContext when creating a ContextBuilder. Instead of going directly to BuildGlobalContext, we should consult current StatementContextBase.definition(), which should return a StatementDefinitionContext for the requested child:
public StatementDefinitionContext getChildStatementDefinition(QName, SchemaSourceReference) { final StatementSupport<?, ?, ?> childSupport = support.getChildSupport(qname); SourceException.throwIfNull(childSupport, sourceReference, "Unsupported statement %s", qname); ... (consult & populate cache) ... }
There really need to be two implementations:
- one on top of BuildGlobalContext, which will contain intertwined globally-defined statements, reusing BuildGlobalContext.definitions as a cache,
- one for use with extensions, where the cache is bound to an instance of ModelDefinedStatementSupport.
This may mean we need to update what StatementDefinitionContext.substatementBuilder() does...
Attachments
Issue Links
- blocks
-
YANGTOOLS-705 Parser: Eliminate stmt.reactor dependency on stmt.rfc6020
- Verified
- is blocked by
-
YANGTOOLS-703 Rework 'type decimal64' lookup
- Resolved