@@ -117,16 +117,16 @@ public static Property getPropertyByKey(JSDynamicObject thisObj, Object key) {
117117 *
118118 */
119119 private static boolean definePropertyExisting (JSDynamicObject thisObj , Object key , PropertyDescriptor descriptor , boolean doThrow , PropertyDescriptor currentDesc ) {
120- JSDynamicObject obj = thisObj ;
121- boolean currentEnumerable = currentDesc .getEnumerable ();
122- boolean currentConfigurable = currentDesc .getConfigurable ();
123- boolean currentWritable = currentDesc .getWritable ();
124-
125- // 5. Return true, if every field in Desc is absent.
120+ CompilerAsserts .neverPartOfCompilation ();
121+ assert currentDesc .isFullyPopulatedPropertyDescriptor ();
126122 if (descriptor .hasNoFields ()) {
127123 return true ;
128124 }
129125
126+ boolean currentEnumerable = currentDesc .getEnumerable ();
127+ boolean currentConfigurable = currentDesc .getConfigurable ();
128+ boolean currentWritable = currentDesc .getWritable ();
129+
130130 boolean enumerable = descriptor .getIfHasEnumerable (currentEnumerable );
131131 boolean configurable = descriptor .getIfHasConfigurable (currentConfigurable );
132132
@@ -143,10 +143,6 @@ private static boolean definePropertyExisting(JSDynamicObject thisObj, Object ke
143143 int newAttr ;
144144 if (descriptor .isGenericDescriptor ()) {
145145 // 8. "no further validation is required", however:
146- // if (current instanceof AccessorProperty) {
147- // // we need to adapt the attributes of the (existing) AccessorProperty
148- // attributes = current.getAttributes();
149- // }
150146 newAttr = JSAttributes .fromConfigurableEnumerableWritable (configurable , enumerable , currentWritable );
151147 } else if (currentDesc .isDataDescriptor () && descriptor .isDataDescriptor ()) {
152148 // 10. IsDataDescriptor(current) and IsDataDescriptor(Desc) are both true
@@ -172,7 +168,6 @@ private static boolean definePropertyExisting(JSDynamicObject thisObj, Object ke
172168 } else if (currentDesc .isAccessorDescriptor () && descriptor .isAccessorDescriptor ()) {
173169 // 11. IsAccessorDescriptor(current) and IsAccessorDescriptor(Desc) are both true
174170 if (!currentConfigurable ) { // 11.a.
175- // Accessor currentAccessor = (Accessor) current.get(obj, false);
176171 Accessor currentAccessor = getAccessorFromDescriptor (currentDesc , doThrow );
177172 if (currentAccessor == null ) {
178173 return false ;
@@ -195,7 +190,6 @@ private static boolean definePropertyExisting(JSDynamicObject thisObj, Object ke
195190 }
196191 // rest of 9 moved below, after duplicating the shapes
197192
198- // writable = false if Accessor->Data else true
199193 boolean writable = descriptor .getIfHasWritable (currentDesc .isDataDescriptor ());
200194 newAttr = JSAttributes .fromConfigurableEnumerableWritable (configurable , enumerable , writable );
201195 }
@@ -208,7 +202,7 @@ private static boolean definePropertyExisting(JSDynamicObject thisObj, Object ke
208202 Property currentProperty = getPropertyByKey (thisObj , key );
209203
210204 if (JSProperty .isProxy (currentProperty ) && descriptor .isDataDescriptor ()) {
211- PropertyProxy proxy = (PropertyProxy ) JSDynamicObject .getOrNull (obj , key );
205+ PropertyProxy proxy = (PropertyProxy ) JSDynamicObject .getOrNull (thisObj , key );
212206 if (currentProperty .getFlags () != newAttr ) {
213207 if (descriptor .hasValue ()) {
214208 JSObjectUtil .defineDataProperty (thisObj , key , descriptor .getValue (), newAttr );
@@ -227,7 +221,6 @@ private static boolean definePropertyExisting(JSDynamicObject thisObj, Object ke
227221 }
228222 } else if (currentDesc .isAccessorDescriptor () && descriptor .isAccessorDescriptor ()) {
229223 if (descriptor .hasSet () || descriptor .hasGet ()) {
230- // Accessor currentAccessor = (Accessor) current.get(obj, false);
231224 Accessor currentAccessor = getAccessorFromDescriptor (currentDesc , doThrow );
232225 Accessor newAccessor = getAccessorFromDescriptor (descriptor , doThrow );
233226 if (newAccessor == null || currentAccessor == null ) {
0 commit comments