Use flyweight EffectiveStatement implementations
(YANGTOOLS-1067)
|
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 8.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 | ||
| Attachments: |
|
| Description |
|
In the following model:
module foo {
namespace foo;
prefix foo;
grouping grp {
container foo;
}
container bar {
uses grp;
}
container baz {
uses grp;
}
}
We end up with distinct objects for bar/foo and baz/foo. Disregarding SchemaPath, this is because the effectiveConfig property changes separately and the instantiation of baz/foo does not see the object at bar/foo (and vice-versa). In order to make this work we need to instantiate a statement-specific lookup table in grp/foo's ReactorStmtCtx. When instantiating bar/foo, this would be populated with an effective key, i.e. effectiveConfig + history (+ whatever) and pointing to bar/foo. When instantiating baz/foo, the bar/foo instance would be recognized as the equivalent and reused. |
| Comments |
| Comment by Robert Varga [ 01/Feb/21 ] |
|
An example of how this is important can be seen here:
the two expanded objects are the same, but due to 'flags' and 'original' (and their effects of substatements) being different from the original, these are instantiated separately. |