aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/shedlang/compiler/shid/instructions/ShidFieldLoad.java
blob: 9de2a4bee87c29b8efcc9af0ba044428efa07a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package org.shedlang.compiler.shid.instructions;

import org.shedlang.compiler.sources.Source;
import org.shedlang.compiler.types.NamespaceName;
import org.shedlang.compiler.types.SimpleStructType;
import org.shedlang.compiler.types.UserDefinedEffect;

/**
 * Pop a value from the temporary value stack, get the given field from the
 * popped value, and push the field's value onto the temporary value stack.
 */
public record ShidFieldLoad(
    Receiver receiver,
    String fieldName,
    Source source
) implements ShidInstruction {
    public sealed interface Receiver {
        record Effect(UserDefinedEffect effect) implements Receiver {}
        record Namespace(NamespaceName name) implements Receiver {}
        record Struct(SimpleStructType type) implements Receiver {}
    }

    @Override
    public boolean isBlockTerminator() {
        return false;
    }
}