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

import org.jetbrains.annotations.NotNull;

// 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
  @NotNull
  public String toString() {
    return "Alloc[name=" + name + ", type=" + type + ", mutable=" + mutable + ", initializer=\"" +
        initializer + "\"]";
  }
}