package absyn;

import env.Env;
import javaslang.collection.Tree;
import parse.Loc;
import semantic.SemanticHelper;
import types.INT;
import types.Type;

public class VarSimple extends Var {

   public final String name;

   public VarSimple(Loc loc, String name) {
      super(loc);
      this.name = name;
   }

   @Override
   public Tree.Node<String> toTree() {
      return Tree.of(annotateType("VarSimple: " + name));
   }

   @Override
   protected Type semantic_(Env env) {
      Type t = env.venv.get(name);
      if (t == null)
         throw SemanticHelper.undefined(loc, "variable", name);
      return t;
   }

}

@@ -88,68 +88,136 @@
 ort 
-semantic.SemanticHelper;%0Aimport types.INT;%0Aimport types.Type
+types.FUNCTION;%0Aimport types.Type;%0A%0Aimport static semantic.SemanticHelper.undefined;%0Aimport static semantic.SemanticHelper.error
 ;%0A%0Ap
@@ -574,24 +574,25 @@
 .get(name);%0A
+%0A
       if (t 
@@ -615,31 +615,16 @@
   throw 
-SemanticHelper.
 undefine
@@ -631,16 +631,117 @@
 d(loc, %22
+variable%22, name);%0A%0A      if (t instanceof FUNCTION)%0A         throw error(loc, %22function '%25s' used as 
 variable
@@ -750,16 +750,17 @@
  name);%0A
+%0A
       re

Fix semantic analysis of simple variables