@@ -126,8 +126,20 @@ PropertyDescriptor array(JSDynamicObject thisObj, Object propertyKey,
126126 if (JSRuntime .isArrayIndex (idx )) {
127127 ScriptArray array = typeProfile .profile (JSAbstractArray .arrayGetArrayType (thisObj ));
128128 if (array .hasElement (thisObj , idx )) {
129- Object value = needValue ? array .getElement (thisObj , idx ) : null ;
130- return PropertyDescriptor .createData (value , true , needWritability && !array .isFrozen (), needConfigurability && !array .isSealed ());
129+ PropertyDescriptor desc = PropertyDescriptor .createEmpty ();
130+ if (needEnumerability ) {
131+ desc .setEnumerable (true );
132+ }
133+ if (needConfigurability ) {
134+ desc .setConfigurable (!array .isSealed ());
135+ }
136+ if (needWritability ) {
137+ desc .setWritable (!array .isFrozen ());
138+ }
139+ if (needValue ) {
140+ desc .setValue (array .getElement (thisObj , idx ));
141+ }
142+ return desc ;
131143 }
132144 }
133145 noSuchElementBranch .enter ();
@@ -188,22 +200,18 @@ private PropertyDescriptor ordinaryGetOwnProperty(JSDynamicObject thisObj, Prope
188200 if (hasPropertyBranch .profile (prop == null )) {
189201 return null ;
190202 }
191- PropertyDescriptor d ;
203+ PropertyDescriptor d = PropertyDescriptor . createEmpty () ;
192204 if (isDataPropertyBranch .profile (JSProperty .isData (prop ))) {
193- Object value = needValue ? getDataPropertyValue (thisObj , prop ) : null ;
194- d = PropertyDescriptor .createData (value );
195205 if (needWritability ) {
196206 d .setWritable (JSProperty .isWritable (prop ));
197207 }
208+ if (needValue ) {
209+ d .setValue (getDataPropertyValue (thisObj , prop ));
210+ }
198211 } else if (isAccessorPropertyBranch .profile (JSProperty .isAccessor (prop ))) {
199212 if (needValue ) {
200- Accessor acc = (Accessor ) prop .getLocation ().get (thisObj );
201- d = PropertyDescriptor .createAccessor (acc .getGetter (), acc .getSetter ());
202- } else {
203- d = PropertyDescriptor .createAccessor (null , null );
213+ d .setAccessor ((Accessor ) prop .getLocation ().get (thisObj ));
204214 }
205- } else {
206- d = PropertyDescriptor .createEmpty ();
207215 }
208216 if (needEnumerability ) {
209217 d .setEnumerable (JSProperty .isEnumerable (prop ));
0 commit comments