
org.snapscript.tree.define.EnumList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree.define;
import org.snapscript.core.Type;
import org.snapscript.core.TypeFactory;
public class EnumList implements TypePart {
private final EnumValue[] values;
public EnumList(EnumValue... values){
this.values = values;
}
@Override
public TypeFactory define(TypeFactory factory, Type type) throws Exception {
return null;
}
@Override
public TypeFactory compile(TypeFactory factory, Type type) throws Exception {
TypeFactoryCollector collector = new TypeFactoryCollector();
int index = 0;
for(EnumValue value : values) {
TypeFactory initializer = value.compile(type, index++);
if(initializer != null) {
collector.update(initializer);
}
}
return collector;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy