Пример #1
0
 @Override
 public void put(String name, Scriptable start, Object value) {
   int info = findInstanceIdInfo(name);
   if (info != 0) {
     if (start == this && isSealed()) {
       throw Context.reportRuntimeError1("msg.modify.sealed", name);
     }
     int attr = (info >>> 16);
     if ((attr & READONLY) == 0) {
       if (start == this) {
         int id = (info & 0xFFFF);
         setInstanceIdValue(id, value);
       } else {
         start.put(name, start, value);
       }
     }
     return;
   }
   if (prototypeValues != null) {
     int id = prototypeValues.findId(name);
     if (id != 0) {
       if (start == this && isSealed()) {
         throw Context.reportRuntimeError1("msg.modify.sealed", name);
       }
       prototypeValues.set(id, start, value);
       return;
     }
   }
   super.put(name, start, value);
 }
Пример #2
0
 final void set(int id, Scriptable start, Object value) {
   if (value == NOT_FOUND) throw new IllegalArgumentException();
   ensureId(id);
   int attr = attributeArray[id - 1];
   if ((attr & READONLY) == 0) {
     if (start == obj) {
       if (value == null) {
         value = UniqueTag.NULL_VALUE;
       }
       int valueSlot = (id - 1) * SLOT_SPAN + VALUE_SLOT;
       synchronized (this) {
         valueArray[valueSlot] = value;
       }
     } else {
       int nameSlot = (id - 1) * SLOT_SPAN + NAME_SLOT;
       String name = (String) valueArray[nameSlot];
       start.put(name, start, value);
     }
   }
 }