+ // Exposed for InferredStatementContextr only, others do not need initialization
+ Iterable<StatementContextBase<?, ?, ?>> effectiveChildrenToComplete() {
+ return effective;
+ }
+
+ // exposed for InferredStatementContext only
+ final void addInitialEffectiveSubstatements(final Collection<? extends Mutable<?, ?, ?>> statements) {
+ verify(!substatementsInitialized, "Attempted to re-initialized statement {} with {}", this, statements);
+ substatementsInitialized = true;
+
+ if (!statements.isEmpty()) {
+ statements.forEach(StatementContextBase::verifyStatement);
+ beforeAddEffectiveStatementUnsafe(statements.size());
+ doAddEffectiveSubstatements(statements);
+ }
+ }
+
+ private void doAddEffectiveSubstatements(final Collection<? extends Mutable<?, ?, ?>> statements) {
+ final Collection<? extends StatementContextBase<?, ?, ?>> casted =
+ (Collection<? extends StatementContextBase<?, ?, ?>>) statements;
+ final ModelProcessingPhase phase = completedPhase;
+ if (phase != null) {
+ for (StatementContextBase<?, ?, ?> stmt : casted) {
+ ensureCompletedPhase(stmt, phase);
+ }