nashorn/src/jdk/nashorn/internal/objects/NativeArray.java
changeset 16773 ed65c8a9ae7c
parent 16769 f0d7cca4e7fd
child 16779 61fd89656ce3
equal deleted inserted replaced
16772:68c2361a217f 16773:ed65c8a9ae7c
   158 
   158 
   159         // Step 3
   159         // Step 3
   160         if ("length".equals(key)) {
   160         if ("length".equals(key)) {
   161             // Step 3a
   161             // Step 3a
   162             if (!desc.has(VALUE)) {
   162             if (!desc.has(VALUE)) {
   163                 return super.defineOwnProperty("length", propertyDesc, reject);
   163                 return super.defineOwnProperty("length", desc, reject);
   164             }
   164             }
   165 
   165 
   166             // Step 3b
   166             // Step 3b
   167             final PropertyDescriptor newLenDesc = desc;
   167             final PropertyDescriptor newLenDesc = desc;
   168 
   168 
   240                 return false;
   240                 return false;
   241             }
   241             }
   242 
   242 
   243             // Step 4c
   243             // Step 4c
   244             // set the new array element
   244             // set the new array element
   245             final boolean succeeded = super.defineOwnProperty(key, propertyDesc, false);
   245             final boolean succeeded = super.defineOwnProperty(key, desc, false);
   246 
   246 
   247             // Step 4d
   247             // Step 4d
   248             if (!succeeded) {
   248             if (!succeeded) {
   249                 if (reject) {
   249                 if (reject) {
   250                     throw typeError("cant.redefine.property", key, ScriptRuntime.safeToString(this));
   250                     throw typeError("cant.redefine.property", key, ScriptRuntime.safeToString(this));
   261             // Step 4f
   261             // Step 4f
   262             return true;
   262             return true;
   263         }
   263         }
   264 
   264 
   265         // not an index property
   265         // not an index property
   266         return super.defineOwnProperty(key, propertyDesc, reject);
   266         return super.defineOwnProperty(key, desc, reject);
   267     }
   267     }
   268 
   268 
   269     /**
   269     /**
   270      * Return the array contents upcasted as an ObjectArray, regardless of
   270      * Return the array contents upcasted as an ObjectArray, regardless of
   271      * representation
   271      * representation