abstract class AbstractResumedStatement<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
extends StatementContextBase<A, D, E> implements ResumedStatement {
private final @NonNull StatementSourceReference statementDeclSource;
- private final StmtContext<?, ?, ?> originalCtx;
- private final StmtContext<?, ?, ?> prevCopyCtx;
private final String rawArgument;
private StatementMap substatements = StatementMap.empty();
+ // Copy constructor
AbstractResumedStatement(final AbstractResumedStatement<A, D, E> original) {
super(original);
this.statementDeclSource = original.statementDeclSource;
this.rawArgument = original.rawArgument;
- this.originalCtx = original.getOriginalCtx().orElse(original);
- this.prevCopyCtx = original;
this.substatements = original.substatements;
}
super(def);
this.statementDeclSource = requireNonNull(ref);
this.rawArgument = def.internArgument(rawArgument);
- this.originalCtx = null;
- this.prevCopyCtx = null;
}
AbstractResumedStatement(final StatementDefinitionContext<A, D, E> def, final StatementSourceReference ref,
super(def, CopyHistory.of(copyType, CopyHistory.original()));
this.statementDeclSource = requireNonNull(ref);
this.rawArgument = rawArgument;
- this.originalCtx = null;
- this.prevCopyCtx = null;
}
@Override
public final Optional<StmtContext<?, ?, ?>> getOriginalCtx() {
- return Optional.ofNullable(originalCtx);
+ return Optional.empty();
}
@Override
public final Optional<? extends StmtContext<?, ?, ?>> getPreviousCopyCtx() {
- return Optional.ofNullable(prevCopyCtx);
+ return Optional.empty();
}
@Override
// a bit in terms of size -- but those are only a few and SchemaPath is on its way out anyway.
private volatile SchemaPath schemaPath;
+ // Copy constructor used by subclasses to implement reparent()
StatementContextBase(final StatementContextBase<A, D, E> original) {
this.copyHistory = original.copyHistory;
this.definition = original.definition;
+
+ this.isSupportedToBuildEffective = original.isSupportedToBuildEffective;
+ this.fullyDefined = original.fullyDefined;
+ this.completedPhase = original.completedPhase;
+ this.declaredInstance = original.declaredInstance;
+ this.flags = original.flags;
}
StatementContextBase(final StatementDefinitionContext<A, D, E> def) {