Ejemplo n.º 1
0
 /*
  * If we visit a nested abstraction, we just launch a new lift operation on
  * this abstraction using current context as namespace and returns an
  * Application object
  *
  * @see jaskell.compiler.JaskellVisitor#visit(jaskell.compiler.core.Abstraction)
  */
 public Object visit(Abstraction a) {
   if (!lift) {
       /* top level abstractions */
     lift = true;
     a.setBody((Expression) a.getBody().visit(this));
     return a;
   }
   /* first visit body */
   a.setBody((Expression) a.getBody().visit(this));
   /* retrieve outer LocalBindings */
   Set captured = new HashSet();
   CaptureCollector cc = new CaptureCollector(captured);
   a.visit(cc);
   /* return the newly computed abstraction as an application spine */
   String vname;
   try {
     vname = lift(a, captured);
     Expression ex = applyLifted(vname, captured);
     ex.setParent(a.getParent());
     return ex;
   } catch (SymbolException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     return null;
   }
 }