aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/shedlang/compiler/patio/instructions/PatioIf.java
blob: 9e5fe50fff232da78124abcdc6b6d1db236aa739 (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
package org.shedlang.compiler.patio.instructions;

import org.shedlang.compiler.patio.operands.PatioLocalRef;
import org.shedlang.compiler.patio.operands.PatioOperand;
import org.shedlang.compiler.sources.Source;

import java.util.List;

/// If the condition is true, execute the instructions in the "true" body,
/// otherwise execute the instructions in the "false" body.
///
/// Each block must have the same number of results as destinations. Each result is
/// assigned to the destination with the same index.
public record PatioIf(
    List<PatioLocalRef> destinations,
    PatioOperand condition,
    PatioBlock trueBody,
    PatioBlock falseBody,
    Source source
) implements PatioInstruction {
    @Override
    public boolean isBlockTerminator() {
        return false;
    }
}