summaryrefslogtreecommitdiff
path: root/src/main/java/no/eliashaugsbakk/kompilator/parsing/node/statement/IdentifierDeclaration.java
blob: 69b0f1b034e88c84c62ee8e99f73087ecedcde50 (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 no.eliashaugsbakk.kompilator.parsing.node.statement;

import no.eliashaugsbakk.kompilator.parsing.Type;
import no.eliashaugsbakk.kompilator.parsing.node.expression.Expression;

public class IdentifierDeclaration extends Statement {
  // identifier name: [my_var]: type = 4;
  public final String identifier;

  // identifier type: my_var: [type] = 4;
  public final Type type;

  // identifier initialization:  my_var: type [4];
  // may be null: my_var: type?;
  public final Expression initializer; // may be null: x: int?;

  public final boolean mutable;

  public IdentifierDeclaration(String identifier, Type type, Expression initializer, boolean mutable) {
    this.identifier = identifier;
    this.type = type;
    this.initializer = initializer;
    this.mutable = mutable;
  }
}