package xyz.avarel.aje.ast;

import xyz.avarel.aje.runtime.Any;

public class AttributeExpr implements Expr {
    private final Expr target;
    private final String name;

    public AttributeExpr(Expr target, String name) {
        this.target = target;
        this.name = name;
    }

    @Override
    public Any compute() {
        return target.compute().identity().get(name);
    }

    @Override
    public void ast(StringBuilder builder, String prefix, boolean isTail) {
        builder.append(prefix).append(isTail ? "└── " : "├── ").append("get\n");
        target.ast(builder, prefix + (isTail ? "    " : "│   "), false);
        builder.append('\n');
        builder.append(prefix).append("    ").append("└── ").append(name);
    }
}

@@ -126,21 +126,19 @@
 al Expr 
-targe
+lef
 t;%0A    p
@@ -194,21 +194,19 @@
 pr(Expr 
-targe
+lef
 t, Strin
@@ -232,22 +232,18 @@
 his.
-target = targe
+left = lef
 t;%0A 
@@ -330,21 +330,19 @@
  return 
-targe
+lef
 t.comput
@@ -557,13 +557,11 @@
     
-targe
+lef
 t.as
@@ -684,18 +684,36 @@
 .append(
-%22 
+isTail ? %22    %22 : %22%E2%94%82
    %22).ap

Fix get AST