src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java

Print this page




 168         if (sobj.has(SET)) {
 169             final Object setter = sobj.get(SET);
 170             if (setter == UNDEFINED || setter instanceof ScriptFunction) {
 171                 this.set = setter;
 172             } else {
 173                 throw typeError("not.a.function", ScriptRuntime.safeToString(setter));
 174             }
 175         } else {
 176             delete(SET, false);
 177         }
 178 
 179         return this;
 180     }
 181 
 182     @Override
 183     public int type() {
 184         return ACCESSOR;
 185     }
 186 
 187     @Override












 188     public boolean equals(final Object obj) {
 189         if (this == obj) {
 190             return true;
 191         }
 192         if (! (obj instanceof AccessorPropertyDescriptor)) {
 193             return false;
 194         }
 195 
 196         final AccessorPropertyDescriptor other = (AccessorPropertyDescriptor)obj;
 197         return sameValue(configurable, other.configurable) &&
 198                sameValue(enumerable, other.enumerable) &&
 199                sameValue(get, other.get) &&
 200                sameValue(set, other.set);
 201     }
 202 
 203     @Override
 204     public int hashCode() {
 205         int hash = 7;
 206         hash = 41 * hash + Objects.hashCode(this.configurable);
 207         hash = 41 * hash + Objects.hashCode(this.enumerable);


 168         if (sobj.has(SET)) {
 169             final Object setter = sobj.get(SET);
 170             if (setter == UNDEFINED || setter instanceof ScriptFunction) {
 171                 this.set = setter;
 172             } else {
 173                 throw typeError("not.a.function", ScriptRuntime.safeToString(setter));
 174             }
 175         } else {
 176             delete(SET, false);
 177         }
 178 
 179         return this;
 180     }
 181 
 182     @Override
 183     public int type() {
 184         return ACCESSOR;
 185     }
 186 
 187     @Override
 188     public boolean hasAndEquals(final PropertyDescriptor otherDesc) {
 189         if (! (otherDesc instanceof AccessorPropertyDescriptor)) {
 190             return false;
 191         }
 192         final AccessorPropertyDescriptor other = (AccessorPropertyDescriptor)otherDesc;
 193         return (!has(CONFIGURABLE) || sameValue(configurable, other.configurable)) &&
 194                (!has(ENUMERABLE) || sameValue(enumerable, other.enumerable)) &&
 195                (!has(GET) || sameValue(get, other.get)) &&
 196                (!has(SET) || sameValue(set, other.set));
 197     }
 198 
 199     @Override
 200     public boolean equals(final Object obj) {
 201         if (this == obj) {
 202             return true;
 203         }
 204         if (! (obj instanceof AccessorPropertyDescriptor)) {
 205             return false;
 206         }
 207 
 208         final AccessorPropertyDescriptor other = (AccessorPropertyDescriptor)obj;
 209         return sameValue(configurable, other.configurable) &&
 210                sameValue(enumerable, other.enumerable) &&
 211                sameValue(get, other.get) &&
 212                sameValue(set, other.set);
 213     }
 214 
 215     @Override
 216     public int hashCode() {
 217         int hash = 7;
 218         hash = 41 * hash + Objects.hashCode(this.configurable);
 219         hash = 41 * hash + Objects.hashCode(this.enumerable);