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


import org.shedlang.compiler.sources.Source;

/**
 * Pop a value from the temporary value stack, and assume it is a Bool. If it is
 * true, execute the "true" body, otherwise execute the "false" body.
 * <p>
 * Each branch body should push <code>resultCount</code> values onto the
 * temporary value stack.
 */
public record ShidIf(
    int resultCount,
    ShidBlock trueBody,
    ShidBlock falseBody,
    Source source
) implements ShidInstruction {
    @Override
    public boolean isBlockTerminator() {
        return false;
    }
}