+ if (parentContext != null) {
+ verify(parentContext instanceof AbstractResumedStatement, "Unexpected parent context %s", parentContext);
+ current = (AbstractResumedStatement<?, ?, ?>) parentContext;
+ } else {
+ current = null;
+ }
+ }
+
+ private static @Nullable AbstractResumedStatement<?, ?, ?> lookupDeclaredChild(
+ final AbstractResumedStatement<?, ?, ?> current, final int childId) {
+ if (current == null) {
+ return null;
+ }
+
+ // Fast path: we are entering a statement which was emitted in previous phase
+ AbstractResumedStatement<?, ?, ?> existing = current.lookupSubstatement(childId);
+ while (existing != null && StatementSource.CONTEXT == existing.getStatementSource()) {
+ existing = existing.lookupSubstatement(childId);
+ }
+
+ return existing;