package org.hummingbirdlang.nodes;

import com.oracle.truffle.api.frame.VirtualFrame;

import org.hummingbirdlang.types.TypeException;
import org.hummingbirdlang.types.realize.InferenceVisitor;

public class HBLetDeclarationNode extends HBStatementNode {
  private final String left;
  @Child private HBExpressionNode rightNode;

  public HBLetDeclarationNode(String left, HBExpressionNode rightNode) {
    this.left = left;
    this.rightNode = rightNode;
  }

  public void accept(InferenceVisitor visitor) throws TypeException {
    this.rightNode.accept(visitor);
    visitor.visit(this);
  }

  public String getLeft() {
    return this.left;
  }

  public HBExpressionNode getRightNode() {
    return this.rightNode;
  }

  @Override
  public Object executeGeneric(VirtualFrame frame) {
    return null;
  }

  @Override
  public String toString() {
    return "let " + this.left + " = " + this.rightNode.toString();
  }
}

@@ -29,16 +29,63 @@
 nodes;%0A%0A
+import com.oracle.truffle.api.frame.FrameSlot;%0A
 import c
@@ -829,24 +829,204 @@
 me frame) %7B%0A
+    Object value = this.rightNode.executeGeneric(frame);%0A    FrameSlot frameSlot = frame.getFrameDescriptor().findOrAddFrameSlot(this.left);%0A    frame.setObject(frameSlot, value);%0A
     return n

Make `let` declarations put their value in the local frame