Package wyvern.tools.typedAST.core.binding.evaluation

Source Code of wyvern.tools.typedAST.core.binding.evaluation.VarValueBinding

package wyvern.tools.typedAST.core.binding.evaluation;

import wyvern.tools.errors.FileLocation;
import wyvern.tools.typedAST.core.binding.AbstractBinding;
import wyvern.tools.typedAST.core.binding.AssignableValueBinding;
import wyvern.tools.typedAST.core.expressions.Variable;
import wyvern.tools.typedAST.interfaces.TypedAST;
import wyvern.tools.typedAST.interfaces.Value;
import wyvern.tools.types.Environment;
import wyvern.tools.types.Type;

import java.util.Optional;

public class VarValueBinding extends ValueBinding implements AssignableValueBinding {
  private Value value;

  public VarValueBinding(String name, Type type, Value value) {
    super(name, type);
    this.value = value;
  }

  @Override
  public TypedAST getUse() {
    return new Variable(this, FileLocation.UNKNOWN);
  }

  @Override
  public void assign(Value value) {
    this.value = value;
  }

  @Override
  public Value getValue(Environment env) {
    return value;
  }
}
TOP

Related Classes of wyvern.tools.typedAST.core.binding.evaluation.VarValueBinding

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.