All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.tree.reference.ListReference Maven / Gradle / Ivy

package org.snapscript.tree.reference;

import static org.snapscript.core.constraint.Constraint.LIST;

import org.snapscript.core.error.InternalStateException;
import org.snapscript.core.scope.Scope;
import org.snapscript.core.type.Type;
import org.snapscript.core.variable.Value;
import org.snapscript.parse.StringToken;

public class ListReference extends ConstraintReference {
   
   public ListReference(StringToken token) {
      super();
   }
   
   @Override
   protected ConstraintValue create(Scope scope) {
      try {
         Type type = LIST.getType(scope);
         Value reference = Value.getReference(type);
         
         return new ConstraintValue(LIST, reference, type);
      } catch(Exception e) {
         throw new InternalStateException("Could not resolve list reference", e);
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy