Example #1
0
 @Specialization
 protected REnvironment doList2Env(RList list, REnvironment env) {
   RStringVector names = list.getNames();
   if (names == null) {
     throw RError.error(this, RError.Message.LIST_NAMES_SAME_LENGTH);
   }
   for (int i = list.getLength() - 1; i >= 0; i--) {
     String name = names.getDataAt(i);
     if (name.length() == 0) {
       throw RError.error(this, RError.Message.ZERO_LENGTH_VARIABLE);
     }
     // in case of duplicates, last element in list wins
     if (env.get(name) == null) {
       env.safePut(name, list.getDataAt(i));
     }
   }
   return env;
 }