private StatementMap substatements = StatementMap.empty();
private @Nullable D declaredInstance;
+ private boolean implicitDeclared;
// Copy constructor
AbstractResumedStatement(final AbstractResumedStatement<A, D, E> original) {
@SuppressWarnings({ "rawtypes", "unchecked" })
private @NonNull Stream<DeclaredStatement<?>> substatementsAsDeclared() {
final Stream<AbstractResumedStatement<?, ?, ?>> stream;
- if (getImplicitDeclaredFlag()) {
+ if (implicitDeclared) {
stream = substatements.stream().map(AbstractResumedStatement::unmaskUndeclared);
} else {
stream = (Stream) substatements.stream();
final SubstatementContext<X, Y, Z> ret;
final var implicitParent = definition().getImplicitParentFor(this, def.getPublicView());
if (implicitParent.isPresent()) {
- setImplicitDeclaredFlag();
+ implicitDeclared = true;
final var parent = createUndeclared(offset, implicitParent.orElseThrow(), ref, argument);
ret = new SubstatementContext<>(parent, def, ref, argument);
parent.addEffectiveSubstatement(ret);
*/
private byte executionOrder;
- /**
- * This field should live in AbstractResumedStatement, but is placed here for memory efficiency to squat in the
- * alignment shadow of {@link #bitsAight} and {@link #executionOrder}.
- */
- private boolean implicitDeclaredFlag;
-
// TODO: we a single byte of alignment shadow left, we should think how we can use it to cache information we build
// during InferredStatementContext.tryToReusePrototype(). We usually end up being routed to
// copyAsChildOfImpl() -- which performs an eager instantiation and checks for changes afterwards. We should
* @return True if {@link #allSubstatements()} and {@link #allSubstatementsStream()} would return an empty stream.
*/
abstract boolean hasEmptySubstatements();
-
- // Note: these two are exposed for AbstractResumedStatement only
- final boolean getImplicitDeclaredFlag() {
- return implicitDeclaredFlag;
- }
-
- final void setImplicitDeclaredFlag() {
- implicitDeclaredFlag = true;
- }
}