Move declaredInstance out of StatementContextBase
This caching field is useful, except it is clear that only the
original instance really needs it, as InferredStatementContext
will just walk through prototype to acquire it from there.
Move the field into AbstractResumedStatement, i.e.
originally-declared statements, taking buildDeclared() method
implementation there.
This reduces the size of StatementContextBase by one reference
field, which helps InferredStatementContext, as it can now hold
pointer to the original context without increasing object size.
Having the original context allows us to more efficiently shortcut
to the original definition -- which is useful for other methods
as well.
JIRA: YANGTOOLS-784
Change-Id: Ib8767a892b8c8aaa0e3f7da10ac794167269fff6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
4159f31b29b342181a5e19b3732b36954592a8a8)
(cherry picked from commit
309569041fb3a539ea7683729e357197956f0d8a)