This allows us to store the index of the enum value along the name. The index can be used to compare two enum values in assembler. Later on this might be used to enable users of KLang to set arbitrary values as the index of an enum value.
19 lines
379 B
Java
19 lines
379 B
Java
package de.hsrm.compiler.Klang.nodes;
|
|
|
|
import de.hsrm.compiler.Klang.visitors.Visitor;
|
|
|
|
public class EnumValue extends Node {
|
|
public String value;
|
|
public int index;
|
|
|
|
public EnumValue(String value, int index) {
|
|
this.value = value;
|
|
this.index = index;
|
|
}
|
|
|
|
@Override
|
|
public <R> R welcome(Visitor<R> v) {
|
|
return v.visit(this);
|
|
}
|
|
}
|