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.
20 lines
401 B
Java
20 lines
401 B
Java
package de.hsrm.compiler.Klang.nodes;
|
|
|
|
import de.hsrm.compiler.Klang.visitors.Visitor;
|
|
|
|
public class EnumDefinition extends Node {
|
|
|
|
public String name;
|
|
public EnumValue[] enums;
|
|
|
|
public EnumDefinition(String name, EnumValue[] enums) {
|
|
this.name = name;
|
|
this.enums = enums;
|
|
}
|
|
|
|
@Override
|
|
public <R> R welcome(Visitor<R> v) {
|
|
return v.visit(this);
|
|
}
|
|
}
|