import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStatement;
import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
-import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStatementStateAware;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.OnDemandSchemaTreeStorageNode;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
private final @NonNull StatementContextBase<A, D, E> prototype;
private final @NonNull StatementContextBase<?, ?, ?> parent;
private final @NonNull StmtContext<A, D, E> originalCtx;
+ // TODO: consider encoding this in StatementContextBase fields, there should be plenty of room
private final @NonNull CopyType childCopyType;
private final QNameModule targetModule;
private final A argument;
InferredStatementContext(final StatementContextBase<?, ?, ?> parent, final StatementContextBase<A, D, E> prototype,
final CopyType myCopyType, final CopyType childCopyType, final QNameModule targetModule) {
- super(prototype.definition(), CopyHistory.of(myCopyType, prototype.history()));
+ super(prototype, myCopyType);
this.parent = requireNonNull(parent);
this.prototype = requireNonNull(prototype);
this.argument = targetModule == null ? prototype.argument()
// First check if we can reuse the entire prototype
if (!factory.canReuseCurrent(this, prototype, origSubstatements)) {
- return deduplicate(tryToReuseSubstatements(factory, origEffective));
+ // FIXME: YANGTOOLS-1214: deduplicate this return
+ return tryToReuseSubstatements(factory, origEffective);
}
// We can reuse this statement let's see if all statements agree...
prototype.decRef();
// Values are the effective copies, hence this efficiently deals with recursion.
- return deduplicate(factory.createEffective(this, declared.stream(), effective.stream()));
+ // FIXME: YANGTOOLS-1214: deduplicate this return
+ return factory.createEffective(this, declared.stream(), effective.stream());
}
private @NonNull E tryToReuseSubstatements(final StatementFactory<A, D, E> factory, final @NonNull E original) {
return effective;
}
- private @NonNull E deduplicate(final @NonNull E effective) {
- if (effective instanceof EffectiveStatementStateAware) {
- final ReactorStmtCtx<A, D, E> source = unmodifiedEffectiveSource();
- if (source != this) {
- return source.attachCopy(((EffectiveStatementStateAware) effective).toEffectiveStatementState(),
- effective);
- }
- }
- return effective;
- }
-
private List<ReactorStmtCtx<?, ?, ?>> reusePrototypeReplicas() {
return reusePrototypeReplicas(Streams.concat(prototype.streamDeclared(), prototype.streamEffective()));
}