summaryrefslogtreecommitdiff
path: root/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java
blob: cda3a56534dd8f7ac8965a535a7a0ed42982fb4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
package no.eliashaugsbakk.kompilator.IRGeneration.Instructions;

// allocate a new variable: set x: string = "Hello"; mut y: string?;
//
// Alloc("x", "string", false, "Hello") // Alloc("y", "string", true, "null")
public record Alloc(String name, String type, boolean mutable, String initializer) implements Instruction {
  @Override
  public String toString() {
    return "Alloc[name=" + name + ", type=" + type + ", mutable=" + mutable + ", initializer=\"" +
        initializer + "\"]";
  }
}