There are a number of statements which should never be copied and
any such attempt should cause the reactor to fail. This adds the
appropriate copy policy.
JIRA: YANGTOOLS-694
Change-Id: I0c51f2d2b96b2de8a1dc1b287d9dbcef1bd6c463
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
return Optional.of(parent.childCopyOf(this, type, targetModule));
case IGNORE:
return Optional.empty();
+ case REJECT:
+ throw new IllegalStateException("Statement " + support.getPublicView() + " should never be copied");
default:
throw new IllegalStateException("Unhandled policy " + policy);
}
*/
// TODO: will the copy transition to ModelProcessingPhase.FULL_DECLARATION or which phase?
DECLARED_COPY,
+ /**
+ * Reject any attempt to copy this statement. This is useful for statements that are defined as top-level
+ * constructs, such as {@code contact}, {@code deviation} and similar.
+ */
+ REJECT,
/**
* Ignore this statement's existence for the purposes of the new place -- it is not impacted. This guidance
* is left here for completeness, as it can have justifiable uses (but I can't think of any). Any substatements