Exemplo n.º 1
0
 @Override
 public void compile(Obj args, CompiledCode code, VM vm, CompileEnv env) {
   // (let* ((x 1) (y 2)) body)
   checkArgsMin(args, 1);
   code.emitNewEnv();
   env = CompileEnv.extendEnv(env);
   Obj o = args.first();
   while (o != Symbol.NIL) {
     Symbol s;
     Obj val;
     if (o.first().isSymbol()) {
       s = o.first().asSymbol();
       val = Symbol.NIL;
     } else {
       s = o.first().first().asSymbol();
       val = o.first().second();
     }
     Compiler.compile(val, code, vm, env);
     if (env.isSpecial(s)) {
       code.emitDBind(s);
       env.sbind(s);
     } else {
       code.emitBind(s);
       env.bind(s);
     }
     o = o.rest();
   }
   Compiler.compileProgn(args.rest(), code, vm, env);
   code.emitPopEnv();
 }