+ final Optional<R> runtimeTypeOf(final @NonNull S stmt) {
+ return recursiveRuntimeType().map(childType -> rebaseRuntimeType(childType, stmt));
+ }
+
+ public final Optional<R> recursiveRuntimeType() {
+ AbstractExplicitGenerator<S, R> gen = this;
+ do {
+ final var ret = gen.runtimeType();
+ if (ret.isPresent()) {
+ return ret;
+ }
+
+ gen = gen.previous();
+ } while (gen != null);
+
+ return Optional.empty();
+ }
+
+ abstract @Nullable R createRuntimeType();
+
+ abstract @NonNull R rebaseRuntimeType(@NonNull R type, @NonNull S statement);
+