Defer statement initialization in InferredStatementContext
(YANGTOOLS-784)
|
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0 |
| Type: | Sub-task | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Description |
|
Performing lazy copy operations means we can end up copying a statement after it has been built and hence should no longer need its effective statements. Add an explicit ModelProcessingPhase.EFFECTIVE_VIEW, which will run after EFFECTIVE_MODEL has been completed and the effective statement has been built. It's execution is a straightforward children-first walk from root, just as any other processing phase. All copy operations need to hook a prerequisite for EFFECTIVE_VIEW on their source context – which prevents it from completing – for each copied statement. That hook needs to resolve when the copy acquires the substatements. |
| Comments |
| Comment by Robert Varga [ 27/Nov/20 ] |
|
Another processing phase does not solve the problem, as we need to be centered around references to parents and integrate with buildEffective() which runs separately. The alternative approach is to use a StatementContextBase refcount, so that we hold off cleaning substatements if there is an outstanding reference to source statement or any of its parents. |