summaryrefslogtreecommitdiff
path: root/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java
blob: 655597e169f81e47a84a1a8025e280ad3bfde198 (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: streng = "Hello"; mut y: streng?;
//
// Alloc("x", "streng", false, "Hello") // Alloc("y", "streng", 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 + "\"]";
  }
}